where(['<=', 'status', 0]); $countQuery = clone $query; $pages = new Pagination(['totalCount' => $countQuery->count()]); $models = $query->offset($pages->offset)->limit($pages->limit)->all(); //dump($models);die; return $this->render('list', [ 'models' => $models, 'pages' => $pages, ]); } /** * 审核门店,通过则向微信接口提交 */ public function actionCheckStore() { $id = Yii::$app->request->post('shopId'); $xhShopService = new xhShopService(); $weixinShopData = $xhShopService->getShopData($id); //向微信提交建立门店 $shop = xhShopService::getById($id); $merchantId = $shop['merchantId']; $merchant = xhMerchantService::getById($merchantId); $weixinUtil = new weixinUtil($merchant); $data = $response = $weixinUtil->createStore($weixinShopData); $response = json_decode($response, true); if($response['errcode'] == 0){ $shopId = $weixinUtil->getShopId($response['poi_id']); $shop['poiId'] = $response['poi_id']; $shop['shopId'] = $shopId; $shop['status'] = 1; //成功后更新数据库 $re = xhShopService::updateById($id, $shop);//存入表xhShop $wifiData = ['shopId' => $shop['shopId'], 'createTime' => date('Y-m-d H:i:s', time())]; xhWifi::add($wifiData);//初始化商家wifi } echo $data; Yii::$app->end(); } }