attributes = get_params(); return $this->asJson($form->list()); } /** * 店铺列表搜索配置参数 */ public function actionSearchParams() { $form = new StoreListForm(); $form->attributes = get_params(); return $this->asJson($form->config()); } /** * 服务端小程序是否开启审核 */ public function actionServerMpAudit() { $status = Option::get('platform_mch_is_shenhe', 0, 'saas', 0)['value']; // 根据版本判断是否开启审核,低版本的不开启,最新版本开启 if (\client_version() < \cyy_version()) { $status = 0; } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'status' => (int)$status, ] ]); } /** * 小程序是否开启审核 */ public function actionMpAudit() { $status = Option::get('shenhe', 0, 'saas', 0)['value']; // 根据版本判断是否开启审核,低版本的不开启,最新版本开启 if (\client_version() < \cyy_version()) { $status = 0; } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'status' => $status, ] ]); } public function actionRecommendKey() { return $this->asJson( [ 'code' => 0, 'msg' => 'success', 'data' => Json::decode(Store::findOne(get_store_id())->recommend_keyword) ] ); } /** * 关键词联想 * @return \yii\web\Response */ public function actionGoodsKeyword() { $store_id = get_store_id(); $keyword = get_params('keyword'); $query = Goods::find()->where(['store_id' => $store_id]); if ($store_id == -1) { $query = Goods::find(); $Store = Store::find()->where(['business_model' => [2, 3]])->select('recommend_keyword, id')->asArray()->all(); $recommend_key = []; foreach ($Store as &$item) { $keywords = Json::decode($item['recommend_keyword']) ?: []; $recommend_key[] = array_column($keywords, 'value'); } } else { $recommend_keyword = Store::findOne($store_id)->recommend_keyword; if ($recommend_keyword) { $recommend_key = array_column(Json::decode(Store::findOne($store_id)->recommend_keyword), 'value'); } else { $recommend_key = []; } } if (!empty($keyword)) { $query->andWhere(['like', 'key_word', $keyword]); } $query->andWhere([ 'and', ['!=', 'key_word', ''], ['!=', 'key_word', 'null'] ]); $list = $query->orderBy(['virtual_sales' => SORT_DESC, 'created_at' => SORT_DESC])->select('key_word')->asArray()->all(); return $this->asJson([ 'code' => 0, 'msg' => 'success', 'recommend_key' => $recommend_key, 'data' => empty($list) ? $list : array_column($list, 'key_word') ]); } public function actionGoodsList() { $form = new GoodsListForm(); $form->store_id = get_store_id(); $form->attributes = get_params(); $form->type = get_params('type', -1); $form->searchType = get_params('searchType', 'store'); return $this->asJson($form->newSearch()); } public function actionClerkCard(){ $form = new WriteOffCodeForm(); $form->sale_id = post_params("sale_id")??get_params("sale_id"); $res = $form->clerkCard(); return $this->asJson($res); } /** * 判断是否缴纳成功 */ public function actionGetIsPay(){ $order_id = get_params('order_id'); $form = new StoreAdminForm(); return $this->asJson($form->isPay($order_id)); } //业务员新建商家列表 public function actionSalesmanNewStoreList(){ $type = post_params('type', 0); $data = post_params(); $form = new SalesmanNewStoreForm(); $form->saas_user_id = get_saas_user_id(); return $this->asJson($form->getList($type, $data)); } //业务员新建商家详情 public function actionSalesmanNewStoreInfo(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $form->saas_user_id = get_saas_user_id(); return $this->asJson($form->info($id)); } //业务员新建商家 public function actionSalesmanNewStore(){ $data = post_params('data'); $type = post_params('type', 0); $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $form->saas_user_id = get_saas_user_id(); return $this->asJson($form->save($id, $data, $type)); } //业务员新建商家绑定商户二维码 public function actionSalesmanNewStoreQr() { $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $form->saas_user_id = get_saas_user_id(); return $this->asJson($form->qr($id)); } //业务员新建商家扫码绑定商户(商户扫码) public function actionSalesmanNewStoreQrBind() { // $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $form->saas_user_id = get_saas_user_id(); return $this->asJson($form->qrBind($id)); } //微信快速注册小程序 public function actionWxFastRegisterMini(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); $msg = []; return $this->asJson($form->wxFastRegisterMini($model, $msg, 1)); } //微信小程序基础信息 public function actionWechatMiniInfo(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); return $this->asJson(SalesmanNewStoreForm::setMiniInfo($model, 1)); } //微信进件 public function actionWechatPayApply(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); return $this->asJson($form->wechatPayApply($model, 1)); } //支付宝快速注册小程序 public function actionAliIsvCreateMini(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); $msg = []; return $this->asJson($form->isvCreateMini($model, $msg, 1)); } //签约当面付 public function actionAliSignFaceToFace(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); return $this->asJson($form->signFaceToFace($model, 1)); } //创建门店 public function actionAliCreatedShop(){ $id = post_params('id', 0); $form = new SalesmanNewStoreForm(); $model = SalesmanNewStore::findOne(['salesman_saas_id' => get_saas_user_id(), 'id' => $id]); return $this->asJson($form->aliCreatedShop($model, 1)); } //创建门店 public function actionTest(){ // $msg = '{"AppId":"wxd808cccf0e9b5f7a","CreateTime":"1678959225","InfoType":"notify_third_fasteregister","status":"0","msg":"OK","appid":"wx2c72840ee240aab3","auth_code":"queryauthcode@@@e3J929egOVk68yUDuVfPQpXQyoKa-3YV-xmZn1BClu7C96d25Q0OKGdwThReZRu6jy80eGyg2toNdhtFRdng1w","info":{"name":"重庆赤晓店信息科技有限公司","code":"91500107MAC87H772P","code_type":"1","legal_persona_wechat":"wxid_it87b576mpnu12","legal_persona_name":"张启秀","component_phone":"18538854912"}}'; // $msg = json_decode($msg, true); // $mini = \app\models\StoreMini::findOne(94); // \app\modules\alliance\models\store\SalesmanNewStoreForm::wechatPush($msg, $mini); // $msg = '{"order_no":"2023031611555117500062525","out_order_no":"20230316115550317001","pid":"2088141927114860","min_app_id":"2021003183678964","status":"AGREED"}'; // $msg = json_decode($msg, true); // $store_ali_mini = \app\models\StoreAliMini::findOne(84); // \app\modules\alliance\models\store\SalesmanNewStoreForm::aliPush($msg, $store_ali_mini); $model = SalesmanNewStore::findOne(['id' => 71]); \app\modules\alliance\models\store\SalesmanNewStoreForm::setMiniInfo($model); die; } // 获取App信息 public function actionStoreAppInfo() { try { $keys = [ 'platform_app_store_android',//供应链安卓app地址 'platform_app_store_android_version'//供应链安卓app版本 ]; $data = Option::get($keys, 0, 'saas'); if (empty($data)) { $data = [ 'platform_app_store_android' => '',//供应链安卓app地址 'platform_app_store_android_version' => '',//供应链安卓app版本 ]; } else { $arr = []; foreach ($data as $value) { $index = array_search($value['name'], $keys); unset($keys[$index]); $arr[$value['name']] = $value['value']; } foreach ($keys as $key) { $arr[$key] = ''; } $data = $arr; } return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => $data, ]); } catch (\Exception $e) { return $this->asJson([ 'code' => 1, 'msg' => $e->getMessage() ]); } } public function actionSearchHotel() { $form = new GoodsListForm(); $form->store_id = get_store_id(); $form->attributes = get_params(); $form->searchType = null; $form->type = Goods::GOODS_TYPE_DATE; return $this->asJson($form->newSearch()); } }