asJson($res); } /** * 快速注册小程序 */ public function actionFastRegisterMini(){ $form = new WechatThirdForm(); $form->name = post_params('name'); $form->code = post_params('code'); $form->code_type = post_params('code_type',1); $form->legal_persona_wechat = post_params('legal_persona_wechat'); $form->license_pic = post_params('license_pic'); $form->legal_persona_name = post_params('legal_persona_name'); $res = $form->fastRegisterMini(); return $this->asJson($res); } /** * 查询快速注册状态 */ public function actionGetFast(){ $form = new WechatThirdForm(); $form->getRegisterStatus(); } /** * 获取授权方的帐号基本信息 */ public function actionGetAuthInfo(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id"); $res = $form->api_get_authorizer_info(); return $this->asJson($res); } /** * @return \yii\web\Response * 获取扫码授权回调参数 */ public function actionGetBackInfo(){ $form = new WechatThirdForm(); $res = $form->backAuthInfo(); return $this->asJson($res); } /** * @return \yii\web\Response * 通过auth_code(授权码)换取小程序信息 */ public function actionGetMiniInfo(){ $form = new WechatThirdForm(); $form->store_id = get_store_id(); $res = $form->getAuthorization_info(post_params("auth_code")); return $this->asJson($res); } public function actionGetAuthorizers(){ $form = new WechatThirdForm(); $form->store_id = get_store_id(); $res = $form->getAuthorizers(); return $this->asJson($res); } /** * @return \yii\web\Response * 设置服务器域名 */ public function actionDomainName(){ $form = new WechatThirdForm(); $action = post_params("action",0); switch ($action){ case 0: $action = "get"; break; case 1: $action = "add"; break; case 2: $action = "delete"; break; case 3: $action = "set"; break; } $form->action = $action; $form->requestdomain = post_params("requestdomain"); $form->wsrequestdomain = post_params("wsrequestdomain"); $form->uploaddomain = post_params("uploaddomain"); $form->downloaddomain = post_params("downloaddomain"); $form->udpdomain = post_params("udpdomain"); $form->tcpdomai = post_params("tcpdomai"); $res = $form->setDomainName(); return $this->asJson($res); } /** * @return \yii\web\Response * 设置业务域名 * @throws \GuzzleHttp\Exception\GuzzleException */ public function actionWebviewDomain(){ $form = new WechatThirdForm(); $action = post_params("action",0); $form->mini_id = post_params("id")??get_params("id"); switch ($action){ case 0: $action = "get"; break; case 1: $action = "add"; break; case 2: $action = "delete"; break; case 3: $action = "set"; break; } $form->action = $action; $form->webviewdomain = post_params("webviewdomain"); $res = $form->setWebviewDomainName(); return $this->asJson($res); } /** * 设置名称 * 使用各项media_id,设置名称 */ public function actionSetNickname(){ $form = new WechatThirdForm(); $form->mini_nickname = post_params("nick_name"); $form->mini_id = post_params("id"); $form->id_card = post_params("id_card"); $form->license = post_params("license"); $form->naming_other_stuff_1 = post_params("naming_other_stuff_1",""); $form->naming_other_stuff_2 = post_params("naming_other_stuff_2",""); $form->naming_other_stuff_3 = post_params("naming_other_stuff_3",""); $form->naming_other_stuff_4 = post_params("naming_other_stuff_4",""); $form->naming_other_stuff_5 = post_params("naming_other_stuff_5",""); $res = $form->setMiniNianname(); return $this->asJson($res); } /** * @return \yii\web\Response * 微信认证名称检测 */ public function actionCheckNickname(){ $form = new WechatThirdForm(); $form->mini_nickname = post_params("nick_name"); $form->mini_id = post_params("id")??get_params("id"); $res = $form->checkWxVerifyNickname(); return $this->asJson($res); } //查询名称审核状态 public function actionGetNicknameAuditStatus(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id"); $res = $form->getNicknameAuditStatus(); return $this->asJson($res); } /** * 修改头像 */ public function actionSetHeadImage(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $form->head_img_media_id = post_params("head_img_media_id")??get_params("head_img_media_id"); $form->x1 = post_params("x1"); $form->y1 = post_params("y1"); $form->x2 = post_params("x2"); $form->y2 = post_params("y2"); $res = $form->setHeadImage(); return $this->asJson($res); } /** * 修改简介 */ public function actionSetSignature(){ $form = new WechatThirdForm(); $form->signature = post_params("signature"); $form->mini_id = post_params("id")??get_params("id"); $res = $form->setSignature(); return $this->asJson($res); } /** * 获取可以设置的所有类目 */ public function actionGetAllCategories(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getAllCategories(); return $this->asJson($res); } /** * 获取已经设置的类目 */ public function actionGetCategories(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getCategories(); return $this->asJson($res); } /** * 添加类目 */ public function actionAddCategory(){ $form = new WechatThirdForm(); $form->categories = post_params("categories"); $form->mini_id = post_params("id")??get_params("id"); $res = $form->addCategory(); return $this->asJson($res); } /** * 删除类目 */ public function actionDelCategory(){ $form = new WechatThirdForm(); $form->cate_first = post_params("cate_first"); $form->cate_second = post_params("cate_second"); $form->mini_id = post_params("id")??get_params("id"); $res = $form->delCategory(); return $this->asJson($res); } /** * 获取模版列表 */ public function actionTemplateList(){ $form = new WechatThirdForm(); $res = $form->getTemplateList(); return $this->asJson($res); } /** * 上传小程序 */ public function actionCanUsePlug(){ $form = new WechatThirdForm(); $form->mini_id = input_params("id"); $appid = input_params('appid', 'wx2b03c6e691cd7370'); $aid = input_params('aid', 52); $res = $form->canUsePlugin($appid, $aid); return $this->asJson($res); } /** * 上传小程序 */ public function actionUpMini(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $form->user_version = post_params('user_version'); $form->user_desc = post_params('user_desc'); $useLive = input_params('is_live', 0); $useStudent = input_params('is_student', 0); $useB2b = input_params('is_b2b', 0); $res = $form->upMini($useLive, $useStudent, $useB2b); return $this->asJson($res); } //添加体验者 public function actionAddTester(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $form->wechatId = post_params("wechatId"); $res = $form->addTester(); return $this->asJson($res); } /** * 获取体验版二维码 */ public function actionGetMiniQrcode(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getMiniQrcode(); return $this->asJson($res); } /** * 获取小程序二维码 */ public function actionGetMiniQr(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getMiniQr(); return $this->asJson($res); } /** * 提交审核 */ public function actionSubmitAudit(){ $form = new WechatThirdForm(); $form->user_version = post_params('user_version'); $form->user_desc = post_params('user_desc'); $form->mini_id = post_params("id")??get_params("id"); $form->is_fast_audit = post_params('is_fast_audit',0); $form->mini_id = post_params("id")??get_params("id"); $form->feedback_stuff = post_params("feedback_stuff"); $form->feedback_info = post_params("feedback_info"); $form->item_list = post_params("item_list"); $res = $form->submitAudit(); return $this->asJson($res); } /** * 撤回审核 */ public function actionUndoCodeAudit(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->unDoCodeAudit(); return $this->asJson($res); } /** * 查询最后一次提交审核的状态 */ public function actionLastAuditStatus(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->lastAuditStatus(); return $this->asJson($res); } /** * 发布已经通过审核的小程序 */ public function actionRelease(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->release(); return $this->asJson($res); } /** * 设置小程序用户隐私保护指引 */ public function actionSetPrivacySetting(){ $form = new WechatThirdForm(); $form->privacy_ver = post_params('privacy_ver'); $form->owner_setting = post_params("owner_setting"); $form->setting_list = post_params("setting_list"); $form->mini_id = post_params("id")??get_params("id"); $res = $form->setPrivacySetting(); return $this->asJson($res); } /** * 查询小程序用户隐私保护指引 */ public function actionGetPrivacySetting(){ $form = new WechatThirdForm(); $form->privacy_ver = post_params('privacy_ver',2); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getPrivacySetting(); return $this->asJson($res); } /** * 上传txt/上传小程序用户隐私保护指引 */ public function actionUpFile(){ $filename = $_FILES['file']['name']; $tmpname = $_FILES['file']['tmp_name']; $path = \Yii::$app->basePath . '/web/temp/txt/'; if(!is_dir($path)){ mkdir($path, 0777, true); } $ext = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); if (($ext != 'txt') ) { return $this->asJson([ 'code' => 1, 'msg' => '请上传txt文件' ]); } $file = time() . $this->store_id . '.' . $ext; $uploadfile = $path . $file; $result = move_uploaded_file($tmpname, $uploadfile); if($result){ $form = new WechatThirdForm(); $form->file_url = $uploadfile; $res = $form->uploadPrivacySetting(); return $this->asJson($res); } return $this->asJson([ 'code' => 1, 'msg' => '上传失败' ]); } /** * @return \yii\web\Response * 获取小程序列表 */ public function actionGetMiniList(){ $form = new WechatThirdForm(); $form->mini_nickname = get_params("mini_nickname"); $form->status = get_params("status",0); $form->is_use = get_params("is_use",0); $form->fuwu_type = input_params("fuwu_type",0); $res = $form->getMiniList(); return $this->asJson($res); } /** * @return \yii\web\Response * 获取小程序状态 */ public function actionGetMini(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->getMini(); return $this->asJson($res); } public function actionOpenGet(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->openGet(); return $this->asJson($res); } public function actionOpenCreate(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->openCreate(); return $this->asJson($res); } public function actionOpenBind(){ $open_appid = input_params('open_appid'); $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->openBind($open_appid); return $this->asJson($res); } public function actionOpenUnbind(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->openUnbind(); return $this->asJson($res); } /** * @return \yii\web\Response * 获取小程序开始使用/暂停使用 */ public function actionMiniIsUse(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $form->is_use = post_params("is_use"); $res = $form->unbind(); return $this->asJson($res); } /** * @return \yii\web\Response * 微信支付进件 */ public function actionMchRegister(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id")??get_params("id"); $res = $form->mchRegister(); return $this->asJson($res); } //绑定普通二维码 public function actionBindQrcode(){ $form = new NewSalesmanForm(); $form->type = "weixin"; $form->mini_id = post_params("id"); $res = $form->bindPayQrcode(); return $this->asJson($res); } //删除普通二维码 public function actionDelBindQrcode(){ $form = new WechatThirdForm(); $form->mini_id = post_params("id"); $res = $form->delQrcodeRules(); return $this->asJson($res); } //获取小店指南 public function actionShopHelp() { return $this->asJson([ 'code' => 0, 'msg' => 'success', 'data' => [ 'platform_wechat_fuwu_help_qrcode' => Option::get('platform_wechat_fuwu_help_qrcode', 0, 'saas', '')['value'], 'platform_wechat_fuwu_help_tel' => Option::get('platform_wechat_fuwu_help_tel', 0, 'saas', '')['value'], 'platform_wechat_fuwu_help_link' => Option::get('platform_wechat_fuwu_help_link', 0, 'saas', '')['value'], ], ]); } //添加小店 public function actionAddShop() { $form = new VideoShopForm(); $form->params = post_params("params"); $form->store_id = get_store_id(); $res = $form->addShop(); return $this->asJson($res); } //删除小店 public function actionDelShop() { $form = new VideoShopForm(); $form->attributes = post_params(); $form->store_id = get_store_id(); $res = $form->delShop(); return $this->asJson($res); } //邀请分享员 public function actionInviteSharer() { $form = new VideoShopForm(); $form->params = post_params("params"); $base_ = new WechatMini(); $form->miniProgram = $base_::getWechatConfig(get_store_id(), input_params('mini_id', (post_params("params")['mini_id'] ?: 0)), 1); $form->mini_id = $base_::$mini_id; $form->store_id = get_store_id(); $res = $form->inviteSharer(); return $this->asJson($res); } //修改分享员 public function actionEditSharerInfo() { $form = new VideoShopForm(); $form->params = post_params("params"); $form->store_id = get_store_id(); $res = $form->editSharerInfo(); return $this->asJson($res); } //解绑小店分享员 public function actionUnbindSharer() { $form = new VideoShopForm(); $form->attributes = post_params(); $form->miniProgram = (new WechatMini())::getWechatConfig(get_store_id(), input_params('mini_id', 0), 1); $form->store_id = get_store_id(); $res = $form->unbindSharer(); return $this->asJson($res); } // 获取小店分享员列表 public function actionGetSharerList() { cache()->getOrSet('actionSyncVideoShopSharer_' . get_store_id(), function(){ $res = $this->actionSyncVideoShopSharer(); // debug_log(['actionGetSharerList', $res->data], __CLASS__ . '.log'); return 1; }); $form = new VideoShopForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $res = $form->getSharerList(); return $this->asJson($res); } // 获取同步小店产品 public function actionSyncGoodsList() { $form = new VideoShopGoodsForm(); $base_ = new WechatMini(); $miniProgram = $base_::getWechatConfig(get_store_id(), get_mini_id(), 1); $form->miniProgram = $miniProgram; $form->store_id = get_store_id(); $form->mini_id = $base_::$mini_id; $res = $form->syncGoodsList(); return $this->asJson($res); } //获取小店同步产品列表 public function actionShopGoodsList() { $form = new VideoShopGoodsForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $res = $form->shopGoodsList(all_params()); return $this->asJson($res); } public function actionShopProductListing() { $form = new VideoShopGoodsForm(); $form->store_id = get_store_id(); $res = $form->product_listing(input_params('product_id'), input_params('delisting')); return $this->asJson($res); } //修改小店产品分佣状态 public function actionShopGoodsSetStatus() { $form = new VideoShopGoodsForm(); $form->attributes = post_params(); $form->store_id = get_store_id(); $res = $form->setStatus(); return $this->asJson($res); } //修改小店产品分佣 public function actionShopGoodsSetRateParams() { $form = new VideoShopGoodsForm(); $form->attributes = post_params(); $form->store_id = get_store_id(); $res = $form->setRateParams(); return $this->asJson($res); } //获取分享员订单列表 public function actionSharerOrderList() { $form = new VideoShopOrderForm(); $form->attributes = get_params(); $form->store_id = get_store_id(); $res = $form->getSharerOrderList(); return $this->asJson($res); } //同步分享员信息 public function actionSyncVideoShopSharer() { $form = new VideoShopForm(); $store_id = get_store_id(); // 同步视频号小店 queue_push(new SyncSharerListJob(['store_id' => $store_id, 'type' => 0]), 0, 1); return $this->asJson([ 'code' => 0, 'msg' => '同步完成' ]); } //同步订单 public function actionSyncVideoShopOrder() { $form = new VideoShopOrderForm(); $store_id = get_store_id(); queue_push(new SyncSharerListJob(['store_id' => $store_id, 'type' => 2]), 0, 1); return $this->asJson([ 'code' => 0, 'msg' => '同步完成' ]); } public function actionSetWebviewDomain() { $form = new WechatThirdForm(); $form->mini_id = input_params('mini_id'); return $this->asJson($form->setWebviewDomain()); } public function actionGetWebviewFile() { $form = new WechatThirdForm(); $form->mini_id = get_params('mini_id'); return $this->asJson($form->getWebviewFile()); } //获取短链 public function actionGetShortLink() { $form = new WechatThirdForm(); $form->store_id = get_store_id(); $path = post_params('path', ''); $mini_id = post_params('mini_id', ''); $is_platform = post_params('is_platform', ''); $is_serve = post_params('is_serve', ''); return $this->asJson($form->getShortLink($path, $mini_id, $is_platform, $is_serve)); } }