From 2367bedd1ad9a8df85bc461c657506cf0e740a33 Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Tue, 23 Jul 2024 18:27:59 +0800 Subject: [PATCH] 1 --- app/admin/controller/Wxwholesaler.php | 23 +++++++++++++++++++++- app/common/library/wxserver/Wholesaler.php | 9 +++++---- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/admin/controller/Wxwholesaler.php b/app/admin/controller/Wxwholesaler.php index d59a4ba4..b12d612a 100644 --- a/app/admin/controller/Wxwholesaler.php +++ b/app/admin/controller/Wxwholesaler.php @@ -5,6 +5,7 @@ namespace app\admin\controller; use app\common\library\wxserver\Wholesaler; use app\job\controller\Wxholesaler as WxserverJob; +use cores\exception\BaseException; use PHPQRCode\QRcode; use think\db\exception\DbException; use think\facade\Db; @@ -188,13 +189,17 @@ class Wxwholesaler extends Controller return $this->renderError('操作失败'); } + /** 单个操作发布体验版 + * @throws BaseException + */ public function commitOne(): Json { $appid = $this->request->get('appid'); + $template_id = $this->request->get('template_id'); $obj = new Wholesaler(); $msg = $obj->privacyInfo($appid); if ($msg == 'ok') { - $msg = $obj->submitAudit($appid); + $msg = $obj->commit($appid, $template_id); if ($msg == 'ok') { return $this->renderSuccess('success'); } @@ -239,6 +244,22 @@ class Wxwholesaler extends Controller return $this->renderError('操作失败'); } + /** + * @notes:单个提交正式版审核 + * @return Json + * @author: wanghousheng + */ + public function auditOne(): Json + { + $appid = $this->request->get('appid'); + $obj = new Wholesaler(); + $msg = $obj->submitAudit($appid); + if ($msg == 'ok') { + return $this->renderSuccess('success'); + } + return $this->renderError($msg); + } + /** * @notes:发布正式版前检查 * @return Json diff --git a/app/common/library/wxserver/Wholesaler.php b/app/common/library/wxserver/Wholesaler.php index f3ca3d0b..43bc223d 100644 --- a/app/common/library/wxserver/Wholesaler.php +++ b/app/common/library/wxserver/Wholesaler.php @@ -211,12 +211,13 @@ class Wholesaler * @notes:发布体验版 * @param $appid * @param $template_id - * @return bool + * @return mixed|string * @throws BaseException * @author: wanghousheng */ - public function commit($appid, $template_id): bool + public function commit($appid, $template_id): string { + $msg = '提交体验版失败'; $version = ''; $access_token = $this->authorizerAccessToken($appid); //获取模板 @@ -244,14 +245,14 @@ class Wholesaler $result = json_decode($result, true); if ($result && !empty($result['errmsg']) && $result['errmsg'] == 'ok') { //体验码 + $msg = $result['errmsg']; $qr_code = $this->getQrcode($appid); if ($qr_code) { $model = new WxwholesalerAccount(); $model->update(['experience_code' => $qr_code], ['appid' => $appid]); } - return true; } - return false; + return !empty($result['errmsg']) ? $result['errmsg'] : $msg; } /**