Exemplo n.º 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', "绑定失败");
     }
 }
Exemplo n.º 2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $this->info('Start to create a shop, please wait...');
     $shop = Shop::where('seller_id', 1)->first();
     if (count($shop) > 0) {
         $this->info('A shop exist, seller_id = 1');
         return;
     }
     $seller = Seller::find(1);
     $shopService = new ShopService();
     $shopService->createShop($seller, 1, 1, '测试小店', '测试小店', 'test', 'http://mmbiz.qpic.cn/mmbiz/4atXZMyxUkdTkThhj8icicfHpd07oaflgJpwwLficHRaLZQzYU8C7A3gWpua4dogmUefNln5K4ChSU9LeCanib6vEw/0?wx_fmt=png');
     $this->info('Finished');
     return;
 }
Exemplo n.º 3
0
 public function addPost()
 {
     $input = Input::all();
     $validator = Validator::make($input, ['mobile' => 'required', 'realname' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->with('error_tips', "参数错误: " . $validator->messages()->first());
     }
     $mobile = trim($input['mobile']);
     $realname = trim($input['realname']);
     $sellerByMobile = Seller::where('mobile', $mobile)->first();
     if (count($sellerByMobile) > 0) {
         return redirect()->back()->with('error_tips', "手机号已存在")->withInput();
     }
     // add weixin user
     //        $wxUser = new WxUser();
     //        $wxUser->subscribe = 1;
     //        $wxUser->openid = Uuid::v4(false); //TODO
     //        $wxUser->nickname = $input['nickname'];
     //        $wxUser->sex = 1;
     //        $wxUser->city = '苏州';
     //        $wxUser->country = '中国';
     //        $wxUser->province = '江苏';
     //        $wxUser->language = 'zh_CN';
     //        $wxUser->headimgurl = '';
     //        $wxUser->role = WxUser::ROLE_SELLER;
     //        $wxUser->status = 1;
     //        $wxUser->save();
     //        $wxUserId = $wxUser->id;
     // add seller
     $seller = new Seller();
     //$seller->wx_user_id = $wxUserId;
     $seller->mobile = $mobile;
     $seller->status = 1;
     $seller->parent_id = 0;
     $seller->realname = $realname;
     $seller->save();
     // add shop
     $shopService = new ShopService();
     $shopService->createShop($seller, Shop::TYPE_DIRECT, Shop::MODE_NORMAL, '丫摇小店', '丫摇小店', '', 'images/logo_160.png', '/images/banner_' . rand(1, 9) . '.jpg');
     return redirect()->route('sellers')->with('success_tips', "操作成功");
 }