예제 #1
0
 /**
  * 激活 第一步 POST
  * @author Hanxinag
  */
 public function activateS1Post()
 {
     $input = Input::all();
     $validator = Validator::make($input, ['mobile' => 'required', 'code' => 'required', 'sn' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->with('error_tips', $validator->messages()->first());
     }
     // check mobile and code
     $check = SmsCode::checkCode($input['mobile'], $input['code']);
     if (!$check) {
         return redirect()->back()->with('error_tips', "验证码错误");
     }
     // check seller
     $seller = Seller::where('mobile', $input['mobile'])->first();
     if (count($seller) == 0) {
         return redirect()->back()->with('error_tips', "手机号不存在");
     }
     $shop = $seller->shop;
     $shopService = new ShopService();
     $bindResult = $shopService->bindDevice($shop, $input['sn']);
     if ($bindResult) {
         return redirect()->route('sellerActivateS2')->with('success_tips', "绑定成功");
     } else {
         return redirect()->back()->with('error_tips', "绑定失败");
     }
 }