request->isPost){ $form = new NewSalesmanForm(); $form->contact_info = post_params("contact_info"); $form->subject_info = post_params("subject_info"); $form->business_info = post_params("business_info"); $form->bank_account_info = post_params("bank_account_info"); // $form->mini_apply_info = post_params("mini_apply_info"); $form->bind_store_id = post_params("bind_store_id",136); $res = $form->saveMerchant(); }else{ $form = new NewSalesmanForm(); $form->id = get_params('id'); $res = $form->getMerchant(); } return $this->asJson($res); } //快速注册小程序 public function actionApplyMini(){ $form = new NewSalesmanForm(); $form->mini_apply_info = json_decode(post_params("mini_apply_info")); $form->bind_store_id = post_params("bind_store_id"); $form->type = post_params("type",'weixin'); $res = $form->applyMini(); return $this->asJson($res); } //绑定小程序码 public function actionBindPayQrcode(){ $form = new NewSalesmanForm(); $form->qrcode_id = post_params("qrcode_id"); $form->type = post_params("type",'weixin'); $form->bind_store_id = post_params("bind_store_id"); $res = $form->bindPayQrcode(); return $this->asJson($res); } //获取进度信息 public function actionProgress(){ $form = new NewSalesmanForm(); $form->bind_store_id = post_params("bind_store_id"); $form->type = post_params("type",'weixin'); $res = $form->getProgress(); return $this->asJson($res); } //查看个人中心信息 public function actionGetUserInfo(){ $form = new NewSalesmanForm(); $res = $form->getUserInfo(); return $this->asJson($res); } //查看店铺列表 public function actionMchList(){ $form = new NewSalesmanForm(); $form->page = post_params("page"); $form->status = post_params("status"); $form->sort = post_params("sort"); $form->category_id = post_params("category_id"); $form->type = post_params("type",'weixin'); $res = $form->merchantList(); return $this->asJson($res); }// //查看店铺列表 public function actionMchNewList(){ $form = new NewSalesmanForm(); $form->page = post_params("page"); $form->status = post_params("status"); $form->sort = post_params("sort"); $form->category_id = post_params("category_id"); $form->type = post_params("type",'weixin'); $form->store_id = get_store_id(); //当前接口由商城管理员打开 直接获取商城管理员的商城id try { $payload = \Yii::$app->jwt->getPayload(); $store_admin_id = $payload['store_admin_id']; if ($store_admin_id > 0) { $StoreMiniAdmin = \app\models\StoreAdmin::findOne(['id' => $store_admin_id, 'status' => 1, 'is_delete' => 0]); $store_id = $StoreMiniAdmin->store_id; } else { $admin = \app\models\Admin::findOne(['id' => $payload['admin_id']]); $store_id = $admin->type_id; } $form->store_id = $store_id; } catch (\Exception $e) { return $this->asJson([ 'code' => 1, 'msg' => '需要重新登录' ]); } $res = $form->merchantNewList(); return $this->asJson($res); } // public function actionAudit(){ $form = new NewSalesmanForm(); $form->id = post_params("id"); $form->status = post_params("status"); $form->business_model = post_params("business_model"); $form->qrcode_id = post_params("qrcode_id"); $res = $form->audit(); return $this->asJson($res); } // public function actionGetQrcode(){ $form = new NewSalesmanForm(); $form->business_model = post_params("business_model"); $res = $form->getQrcode(); return $this->asJson($res); } //获取进件资料信息 public function actionGetApplyInfo(){ $form = new NewSalesmanForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->getInfo(); return $this->asJson($res); } /// /// 微信小程序 /// //修改信息 public function actionEditMiniInfo(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $form->mini_nickname = post_params("mini_nickname"); $form->head_img_media_id = post_params("mini_url"); $form->signature = post_params("signature"); $res = $form->setHeadImage(); if($res['code'] === 0){ $res = $form->setSignature(); if($res['code'] === 0){ $res = $form->setMiniNianname(); return $this->asJson($res); } } return $this->asJson($res); } //获取分类 public function actionGetAllCategory(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->getAllCategories(); return $this->asJson($res); } //获取已经设置的分类 public function actionGetCategory(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->getCategories(); return $this->asJson($res); } //修改分类 public function actionSetCategory(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $form->categories = post_params("categories"); $res = $form->addCategory(); return $this->asJson($res); } //删除分类 public function actionDelCategory(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $form->cate_first = post_params("cate_first"); $form->cate_second = post_params("cate_second"); $res = $form->delCategory(); return $this->asJson($res); } //上传小程序 public function actionUpMini(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->upMini(); return $this->asJson($res); } //审核小程序 public function actionSubmitAudit(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->submitAudit(); return $this->asJson($res); } //审核撤回 public function actionCancelSubmitAudit(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->unDoCodeAudit(); return $this->asJson($res); } //发布已经通过审核的小程序 public function actionRelease(){ $form = new WechatThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->release(); return $this->asJson($res); } /// /// 支付宝小程序 /// //获取支付宝进度 public function actionAliProgress(){ $form = new NewSalesmanForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->getProgress(); return $this->asJson($res); } //修改资料 public function actionSetInfo(){ $form = new AlipayThirdForm(); $form->AppName = post_params("app_name"); $form->AppEnglishName = post_params("app_english_name"); $form->AppSlogan = post_params("app_slogan"); $form->AppLogo = post_params("app_logo"); $form->AppDesc = post_params("app_desc"); $form->ServicePhone = post_params("service_phone"); $form->ServiceEmail = post_params("service_email"); $form->MiniCategoryIds = post_params("mini_categoryIds"); $form->bind_store_id = post_params("bind_store_id"); $res = $form->setMiniBaseInfo(); return $this->asJson($res); } //上传代码 public function actionUpAliMini(){ $form = new AlipayThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->updateMiniVersion(); return $this->asJson($res); } //签约流程 public function actionSignContract(){ $form = new AlipayThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->agentCreate(); return $this->asJson($res); } //审核小程序 public function actionAuditAliMini(){ $form = new AlipayThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $aliMini = StoreAliMini::find()->where(['store_id'=>post_params("bind_store_id")])->orderBy('id desc')->select('license_no,license_pic,app_name,app_english_name,app_slogan,app_logo,app_desc,service_phone,service_email,mini_categoryIds,license_name,license_date,is_long_effective')->one(); $audit = [ "AppName"=>$aliMini->app_name, "AppEnglishName"=>$aliMini->app_english_name, "AppSlogan"=>$aliMini->app_slogan, "AppLogo"=>$aliMini->app_logo, "AppDesc"=>$aliMini->app_desc, "ServicePhone"=>$aliMini->service_phone, "ServiceEmail"=>$aliMini->service_email, "MiniCategoryIds"=>$aliMini->mini_categoryIds, "license_no"=>$aliMini->license_no, "license_pic"=>$aliMini->license_pic, "license_name"=>$aliMini->license_name, "license_date"=>$aliMini->license_date, "is_long_effective"=>$aliMini->is_long_effective, ]; $form->auditData = $audit; $res = $form->miniAuditApply(); return $this->asJson($res); } //发布小程序 public function actionPushMini(){ $form = new AlipayThirdForm(); $form->bind_store_id = post_params("bind_store_id"); $res = $form->miniOnline(); return $this->asJson($res); } //进件 public function actionApply() { $StoreSchedule = StoreSchedule::find()->where(['store_id'=>post_params("bind_store_id")])->select('merchant_info,audit_id')->one(); if(!empty($StoreSchedule->audit_id)){ $StoreAudit = StoreAudit::find()->where(['id'=>$StoreSchedule->audit_id])->select('merchant_info_id')->one(); } $appid = ""; $store = Store::findOne(post_params("bind_store_id")); if ($store->business_model === 1) { $StoreMini = StoreMini::find()->where(['store_id'=>post_params("bind_store_id")])->select('appid')->orderBy('id desc')->one(); if(!empty($StoreMini->appid)){ $appid = $StoreMini->appid; } } else { $appid = ""; } $merchant_info = json_decode(post_params("merchant_info"),true); if(empty(post_params("merchant_info"))){ if(!empty($StoreSchedule->merchant_info)){ $merchant_info = json_decode($StoreSchedule->merchant_info,true); } } $contact_info = $merchant_info['contact_info']; $subject_info = $merchant_info['subject_info']; $business_info = $merchant_info['business_info']; $bank_account_info = $merchant_info['bank_account_info']; $apply_id = !empty($StoreAudit->merchant_info_id)?$StoreAudit->merchant_info_id:0; try { $merchant = new Merchant(); } catch (\Exception $e) { return $this->asJson([ 'code' => 1, 'msg' => $e->getMessage() ]); } return $this->asJson($merchant->submit($contact_info, $subject_info, $business_info, $bank_account_info, $apply_id, $appid)); } }