request->isAjax) { if ($this->request->isGet) { $param = \Yii::$app->request->get(); $params['where'] = [ ['mall_id' => $this->mall_id], ['status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]], ]; $params['limit'] = $param['limit'] ?? 15; $params['page'] = $param['page'] ?? 1; $list = WechatVideoShop::listPage($params); if ($list === false) { return $this->error(WechatVideoShop::getStaticError()); } return $this->success('数据请求成功', $list); } } return $this->render($this->action->id); } /** * @Description: 店铺编辑 * @Author: zsan * @DateTime 2023-06-23 14:56:48 * @return mixed */ public function actionEdit() { if ($this->request->isAjax) { if ($this->request->isGet) { $param = \Yii::$app->request->get(); $where = [ ['mall_id' => $this->mall_id], ['status' => [StatusEnum::ENABLED, StatusEnum::DISABLED]], ['id' => $param['id']] ]; $detail = WechatVideoShop::getOne($where, true, ['provinceInfo', 'cityInfo', 'districtInfo']); $detail['callback_url'] = \Yii::getAlias('@apiUrl') . "/wechat-video-shop/v1/event/callback"; return $this->success('数据请求成功', $detail ?? []); } elseif ($this->request->isPost) { $param = \Yii::$app->request->post(); $params = $param['setting']; $params['mall_id'] = $this->mall_id; // 获取店铺信息 $model = WechatVideoShop::setData($params); if ($model === false) return $this->error(WechatVideoShop::getStaticError()); return $this->success('数据保存成功'); } } return $this->render($this->action->id, ['callback_url' => \Yii::getAlias('@apiUrl') . "/wechat-video-shop/v1/event/callback"]); } public function actionRegion() { $id = intval(\Yii::$app->request->get('region_id', 0)); $ret = Region::lists([ 'where' => [ ['parent_id' => $id] ] ]); return $this->success('获取成功', $ret); } public function actionList() { } }