'', 'secretKey' => '', 'region' => '', ]); } $setting = json_decode($setting,true); $setting['status'] = (int)Option::get('tencent_image_setting_status', get_store_id(),'saas',0)['value']; $setting['storeId'] = get_store_id(); return $this->asJson([ 'code' => 0, 'data' => $setting, 'get_store_id' => get_store_id(), ]); } /** * 保存腾讯云以图搜图设置信息 * @return \yii\web\Response * User: hankaige * DATE TIME: 2023/1/12 09:55 */ public function actionSaveSetting(){ $form = new ImageSearchSettingFrom(); $form->attributes = post_params(); $result = $form->save(); return $this->asJson($result); } /** * 获取商城对应图库信息 生成商城图库 * @return \yii\web\Response * User: hankaige * DATE TIME: 2023/1/12 13:43 */ public function actionStoreSetting(){ $storeId = get_store_id(); $model = StoreImageSearchSetting::findOne(['store_id'=>$storeId]); if(empty($model)){ $model = new StoreImageSearchSetting(); $err_num = 0; }else{ /*// 查询一下当前图库的信息 $tiia = new TiiaHelper(); // 查询图库是否存在 返回code==0的时候标识图库已存在 $checkRes = $tiia::describeGroup($model->group_id); $model['image_num'] = $checkRes['data']['Groups'][0]['PicCount'];*/ $err_num = UploadGoodsImage::find()->where(['store_id'=>get_store_id(),'status'=>2])->count(); } if(\Yii::$app->request->isPost){ $form = new StoreImageSearchSettingForm(); $form->attributes = post_params(); $form->store_id = $storeId; $form->model = $model; $result = $form->save(); return $this->asJson($result); }else{ // 平台以图搜索是否开启状态 $status = (int)Option::get('tencent_image_setting_status',0,'saas',0)['value']; return $this->asJson([ 'code'=>0, 'data'=>[ 'model'=>!empty($model->id) ? $model : [ 'id' => 0, 'group_id' => '', 'group_name' => '', 'max_capacity' => '', ],'status'=>$status,'err_num' => $err_num]]); } } /** * 请求更新图库信息 * @return \yii\web\Response * User: hankaige * DATE TIME: 2023/1/12 15:52 */ public function actionUploadImage(){ $form = new UploadImageForm(); $res = $form->uploadImage(); return $this->asJson($res); } /** * 更新图片库图片数量数据 * @return \yii\web\Response * User: hankaige * DATE TIME: 2023/1/12 16:24 */ public function actionRefreshImageGroup(){ $storeId = get_store_id(); $model = StoreImageSearchSetting::findOne(['store_id'=>$storeId]); $form = new StoreImageSearchSettingForm(); $form->model = $model; $res = $form->refresh(); return $this->asJson($res); } /** * 查看异常图片列表 * @return \yii\web\Response * User: hankaige * DATE TIME: 2023/1/30 14:46 */ public function actionGetErrImage(){ $query = UploadGoodsImage::find()->alias('ugi')->where(['ugi.store_id'=>get_store_id(),'ugi.status'=>2,'ugi.is_delete'=>0])->leftJoin(['g' => Goods::tableName()],'g.id = ugi.goods_id')->select('ugi.*,g.name'); $list = pagination_make($query); return $this->asJson(['code'=>0,'data'=>['data'=>$list['list'],'pageNo'=>$list['pageNo'],'totalCount'=>$list['totalCount']]]); } }