diff --git a/app/admin/controller/Wxserve.php b/app/admin/controller/Wxserve.php index a928c98f..e0ac360a 100644 --- a/app/admin/controller/Wxserve.php +++ b/app/admin/controller/Wxserve.php @@ -4,7 +4,7 @@ declare (strict_types=1); namespace app\admin\controller; use app\common\library\wxserver\Server; -use cores\exception\BaseException; +use app\job\controller\Wxserver as WxserverJob; use PHPQRCode\QRcode; use think\db\exception\DbException; use think\facade\Db; @@ -172,17 +172,18 @@ class Wxserve extends Controller /** * @notes:提交体验版 * @return Json - * @throws BaseException * @author: wanghousheng */ public function commit(): Json { $appid = $this->request->get('appid'); $template_id = $this->request->get('template_id'); - if ($template_id && $appid) { - $obj = new Server(); - $res = $obj->commit($appid, $template_id); - if ($res) { + if ($appid && $template_id) { + $appids = explode(',', $appid); + if ($appids) { + foreach ($appids as $item) { + WxserverJob::dispatch(['appid' => $item, 'template_id' => $template_id]); + } return $this->renderSuccess('success'); } } @@ -215,16 +216,13 @@ class Wxserve extends Controller { $appid = $this->request->get('appid'); if ($appid) { - $obj = new Server(); - $res = $obj->privacyInfo($appid); - if ($res == 'ok') { - if ($obj->submitAudit($appid)) { - return $this->renderSuccess('success'); + $appids = explode(',', $appid); + if ($appids) { + foreach ($appids as $item) { + WxserverJob::dispatch(['appid' => $item]); } - } else { - return $this->renderError($res); + return $this->renderSuccess('success'); } - } return $this->renderError('操作失败'); } diff --git a/app/job/controller/Wxserver.php b/app/job/controller/Wxserver.php new file mode 100644 index 00000000..13f9b3e5 --- /dev/null +++ b/app/job/controller/Wxserver.php @@ -0,0 +1,58 @@ +sendTestVersion($data['appid'], $data['template_id']); + } else { + $this->sendOfficialVersion($data['appid']); + } + } + return true; + } + + /** + * @notes:发布正式版 + * @param $appid + * @author: wanghousheng + */ + private function sendOfficialVersion($appid) + { + $obj = new Server(); + $res = $obj->privacyInfo($appid); + if ($res == 'ok') { + $obj->submitAudit($appid); + } + } + + /** + * @notes:发布体验版 + * @param $appid + * @param $template_id + * @throws BaseException + * @author: wanghousheng + */ + private function sendTestVersion($appid, $template_id) + { + $obj = new Server(); + $res = $obj->commit($appid, $template_id); + } +} \ No newline at end of file