request; if ($request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['page', 'limit', 'shipping_type'], 'integer'], [['longitude', 'latitude', 'keyword', 'attr_id', 'attr_ids', 'goods_ids'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); if (!empty($get['attr_ids'])) $get['attr_ids'] = explode(',', $get['attr_ids']); if (!empty($get['goods_ids'])) $get['goods_ids'] = explode(',', $get['goods_ids']); $list = (new StoreService(['mall_id' => $this->mall_id, 'user_id' => $this->user_id]))->getStoreList($get); return $this->success('获取成功', $list); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //匹配最近门店 public function actionGetStore() { $request = Yii::$app->request; if ($request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['longitude', 'latitude', 'shipping_type', 'attr_id', 'attr_ids', 'goods_ids'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $get['mall_id'] = $this->mall_id; $get['user_id'] = $this->user_id; if (!empty($get['attr_ids'])) $get['attr_ids'] = explode(',', $get['attr_ids']); if (!empty($get['goods_ids'])) $get['goods_ids'] = explode(',', $get['goods_ids']); $info = (new StoreService())->getStore($get); return $this->success('获取成功', $info); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //获取历史门店 public function actionGetHistory() { $request = Yii::$app->request; if ($request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['longitude', 'latitude'], 'string'] ]); $list = (new StoreService(['mall_id' => $this->mall_id, 'user_id' => $this->user_id]))->getHistoryStore($get); return $this->success('获取成功', ['list' => $list]); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //删除历史门店 public function actionDelHistoryStore() { $request = Yii::$app->request; if ($request->isPost) { try { $post = $request->post(); $res = Yii::$app->services->validate->validate($post, [ [['id'], 'integer'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $res = (new StoreService(['mall_id' => $this->mall_id, 'user_id' => $this->user_id]))->delHistoryStore($post); return $this->success('操作成功'); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } //获取门店详情 public function actionGetStoreDetail() { $request = Yii::$app->request; if ($request->isGet) { try { $get = $request->get(); $res = Yii::$app->services->validate->validate($get, [ [['store_id'], 'integer'], [['longitude', 'latitude'], 'string'], ]); if (!$res) throw new Exception(Yii::$app->services->validate->getErrorMessage()); $info = (new StoreService(['mall_id' => $this->mall_id]))->getStoreDetail($get); return $this->success('获取成功', $info); } catch (\Exception $e) { return $this->error($e->getMessage()); } } } }