当前位置: 首页>>代码示例>>PHP>>正文


PHP Helper::getCustomer方法代码示例

本文整理汇总了PHP中Helper::getCustomer方法的典型用法代码示例。如果您正苦于以下问题:PHP Helper::getCustomer方法的具体用法?PHP Helper::getCustomer怎么用?PHP Helper::getCustomer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Helper的用法示例。


在下文中一共展示了Helper::getCustomer方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: coupon

 public function coupon(Request $request)
 {
     $result = [];
     $customer = \Helper::getCustomer();
     $list = ShopCard::where('customer_id', $customer['id'])->get();
     foreach ($list as $item) {
         $result[] = ['name' => $item->cardType->name, 'no' => $item->number, 'password' => $item->secret, 'marked' => $item->marked];
     }
     return view('activity.coupon')->with(['result' => json_encode($result)]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:10,代码来源:ActivityController.php

示例2: customerInformation

 public function customerInformation()
 {
     $customer = \Helper::getCustomer();
     $default_address = $customer->addresses()->where('is_default', true)->first();
     $default_address_array = null;
     if ($default_address) {
         $default_address_array = $default_address->toArray();
         $post_fee = \Helper::getCustomerPostFee($customer, $default_address->province);
         $default_address_array['post_fee'] = $post_fee;
     }
     return response()->json(['success' => true, 'data' => ['beans' => $customer->beans_total, 'default_address' => $default_address_array, 'post_fee' => $default_address ? $post_fee : 0]]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:12,代码来源:CartController.php

示例3: clearUser

 public function clearUser()
 {
     $customer = \Helper::getCustomer();
     if ($customer->openid == 'oDVXNw_37oPhtTb96WpqoqOCkAm8') {
         $customer->openid = $customer->openid . '_modified';
         $customer->save();
         \Session::clear();
         return response()->json(['success' => true]);
     } else {
         return response()->json(['success' => false]);
     }
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:12,代码来源:HackController.php

示例4: yiyuanIndex

 public function yiyuanIndex()
 {
     $customer = \Helper::getCustomer();
     // \Log::info('Location-yiyuan---'.$customer  );
     //      if ($customer->yikangQuestionnaire()->first() == null) {
     // // \Log::info('yiyuan---不存在用户' );
     //          return redirect('/questionnaire2');
     //      }
     //      if ($customer->hasPurchesedOneSale()) {
     // // \Log::info('yiyuan---已购买过' );
     //          return '<a style="font-size: 50px;display:block;width: 100%;margin: 20% auto;text-align: center;">每人仅能参加一次活动!</a>';
     //      }
     // \Log::info('yiyuan---进入一元专区' );
     //		 $jssdk = new Jssdk(env('WX_APPID'), env('WX_SECRET'));
     //		 $signPackage = $jssdk->getSignPackage();
     return view('shop.yiyuan-index')->with(['items' => Commodity::where('special_sale', '=', '1元专区')->with('images')->orderBy('priority', 'desc')->get()]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:17,代码来源:ShopController.php

示例5: generateConfig

 /**
  * 依据前台post消息创建订单
  *
  * @param Request $request
  * @return \Response
  */
 public function generateConfig(Request $request)
 {
     $validator = \Validator::make($request->all(), ['address_id' => 'required|exists:addresses,id', 'cart' => 'required']);
     if ($validator->fails()) {
         return response()->json($validator->errors()->getMessages());
     }
     $customer = \Helper::getCustomer();
     $items = $request->input('cart');
     $sale = $request->input('sale', null);
     if ($sale != null && !$this->checkSaleCredential($customer, $sale)) {
         return response()->json(['success' => false, 'error_message' => '你不具有参加特卖资格!']);
     }
     $order = new Order();
     $address = Address::findOrFail($request->input('address_id'));
     $order->initWithCustomerAndAddress($customer, $address, $sale);
     $order->save();
     $order->addCommodities($items);
     $order->calculate();
     $order->save();
     $result = \Wechat::generatePaymentConfig($order, $customer);
     return response()->json(['success' => true, 'data' => ['result' => $result, 'order_id' => $order->id]]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:28,代码来源:OrderController.php

示例6: store

 public function store(Request $request)
 {
     $user = \Helper::getUser();
     $customer = \Helper::getCustomer();
     if ($customer->is_registered) {
         return '请勿重复注册';
     }
     $validator = \Validator::make($request->all(), ['phone' => 'required|digits:11|unique:customers,phone,' . $customer->id, 'code' => 'required|digits:6']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     if ($request->input('code') != $customer->auth_code || $request->input('code') == '000000') {
         return redirect()->back()->with('error_message', '验证码不匹配!')->withInput();
     }
     if (Carbon::now()->diffInMinutes($customer->auth_code_expire) > 0) {
         return redirect()->back()->with('error_message', '验证码过期!')->withInput();
     }
     $beans_total_update = 0;
     if ($customer->beans_total > 0) {
         $beans_total_update = $customer->beans_total;
     }
     $customer->update(['phone' => $request->input('phone'), 'is_registered' => true, 'beans_total' => $beans_total_update, 'nickname' => $user['nickname'], 'head_image_url' => $user['headimgurl'], 'qr_code' => \Wechat::getForeverQrCodeUrl($customer->id)]);
     if ($ci = CustomerInformation::where('phone', '=', $request->input('phone'))->first()) {
         $ci->customer_id = $customer->id;
         $ci->save();
     }
     //        $ret = $customer->register();
     if ($customer->referrer_id) {
         //            \BeanRecharger::invite($customer->getReferrer());
         \Analyzer::updateBasicStatistics($customer->referrer_id, AnalyzerConstant::CUSTOMER_FRIEND);
     }
     \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_REGISTER);
     event(new Register($customer));
     if (\Session::has('register_next_url')) {
         return redirect(\Session::get('register_next_url'));
     }
     return redirect('register/success');
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:38,代码来源:RegisterController.php

示例7: buy

 public function buy(Request $request)
 {
     $amount = $request->input('amount');
     $customer = \Helper::getCustomer();
     try {
         \DB::transaction(function () use($amount, $customer) {
             $cards = \DB::table('shop_cards')->where('customer_id', '=', null)->limit($amount);
             $cards->lockForUpdate();
             if ($cards->count() < $amount) {
                 throw new \Exception();
             }
             $customer->lockForUpdate();
             if ($customer->beans_total >= $amount * 10000) {
                 $customer->minusBeansByHand($amount * 10000);
                 $cards->update(['customer_id' => $customer->id, 'bought_at' => Carbon::now()]);
             } else {
                 throw new \Exception();
             }
         });
     } catch (\Exception $e) {
         return response()->json(['success' => false]);
     }
     return response()->json(['success' => true]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:24,代码来源:CardController.php

示例8: updateBean

 public function updateBean(Request $request)
 {
     $customer = \Helper::getCustomer();
     if (!$customer) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     if (!$customer->is_registered) {
         return response()->json(['result' => '-1']);
     }
     /*if>*/
     $article = Article::where('id', $request->input('id'))->first();
     \Analyzer::updateArticleStatistics($customer->id, $article->type_id);
     \Analyzer::updateBasicStatistics($customer->id, AnalyzerConstant::CUSTOMER_ARTICLE);
     \EnterpriseAnalyzer::updateArticleStatistics($article->type_id);
     \EnterpriseAnalyzer::updateBasic(AnalyzerConstant::ENTERPRISE_ARTICLE);
     if (\DailyAnalyzer::getDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE)) {
         \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
         return response()->json(['result' => '-1']);
     }
     \DailyAnalyzer::updateDailyItemCount($customer->id, AnalyzerConstant::CUSTOMER_DAILY_ARTICLE);
     \BeanRecharger::executeEducation($customer);
     return response()->json(['result' => '1']);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:24,代码来源:EducationController.php

示例9: update

 /**
  * @param Request $request
  * @return \Illuminate\Http\JsonResponse
  */
 public function update(Request $request)
 {
     $validator = \Validator::make($request->all(), ['id' => 'required|exists:addresses', 'phone' => 'digits:11']);
     if ($validator->fails()) {
         return response()->json(['success' => false, 'error_messages' => $validator->errors()->getMessages()]);
     }
     $customer = \Helper::getCustomer();
     $address = Address::find($request->input('id'));
     if ($address->customer_id != $customer->id) {
         return response()->json(['success' => false, 'error_messages' => 'not matched']);
     }
     //先重置所有default
     if ($request->has('is_default') and $request->input('is_default') == "true") {
         $customer->addresses()->update(['is_default' => false]);
     }
     Address::find($request->input('id'))->update($request->all());
     return response()->json(['success' => true, 'id' => $address->id]);
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:22,代码来源:AddressController.php

示例10: statistics

 public function statistics()
 {
     $customer = \Helper::getCustomer();
     if ($customer->type->type_en == AppConstant::CUSTOMER_ENTERPRISE) {
         $enterpriseCommodityStatistics = EnterpriseCommodityStatistics::getAllStatistics();
         $enterpriseArticleStatistics = EnterpriseArticleStatistics::getAllStatistics();
         //            $enterpriseBasicStatistics = EnterpriseBasicStatistics::where('date', Carbon::now()->format('Y-m-d'))->get()->toArray();
         $enterpriseBasicStatistics = EnterpriseBasicStatistics::getAllStatistics();
         return view('personal.enterprise', ['data' => ['enterprise_commodity_statistics' => EnterpriseCalculator::commodity(), 'enterprise_article_statistics' => $enterpriseArticleStatistics, 'enterprise_basic_statistics' => EnterpriseCalculator::basic()]]);
     } else {
         $customerCommodityStatistics = CustomerCommodityStatistics::getStatisticsByCustomerID($customer->id);
         $customerArticleStatistics = CustomerArticleStatistics::getStatisticsByCustomerID($customer->id);
         $customerStatistics = CustomerStatistics::where('customer_id', $customer->id)->get()->toArray();
         return view('personal.customer', ['data' => ['customer_commodity_statistics' => $customerCommodityStatistics, 'customer_article_statistics' => $customerArticleStatistics, 'customer_statistics' => $customerStatistics, 'doctor_type' => $customer->doctorType(), 'monthly_invite_count' => (new CustomerInvitationCounter($customer))->getMonthlyCount(), 'focus_count' => $customer->focus_count, 'register_count' => $customer->register_count, 'questionnaire_count' => $customer->questionnaire_count]]);
     }
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:16,代码来源:PersonalController.php


注:本文中的Helper::getCustomer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。