diff --git a/app/admin/controller/Wxserve.php b/app/admin/controller/Wxserve.php index e0ac360a..e50cdfbd 100644 --- a/app/admin/controller/Wxserve.php +++ b/app/admin/controller/Wxserve.php @@ -176,16 +176,16 @@ class Wxserve extends Controller */ public function commit(): Json { - $appid = $this->request->get('appid'); + $appids = $this->request->get('appid'); + if (!is_array($appids)) { + $appids = [$appids]; + } $template_id = $this->request->get('template_id'); - 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'); + if ($appids && $template_id) { + foreach ($appids as $item) { + WxserverJob::dispatch(['appid' => $item, 'template_id' => $template_id]); } + return $this->renderSuccess('success'); } return $this->renderError('操作失败'); } @@ -214,15 +214,15 @@ class Wxserve extends Controller */ public function audit(): Json { - $appid = $this->request->get('appid'); - if ($appid) { - $appids = explode(',', $appid); - if ($appids) { - foreach ($appids as $item) { - WxserverJob::dispatch(['appid' => $item]); - } - return $this->renderSuccess('success'); + $appids = $this->request->get('appid'); + if (!is_array($appids) && $appids) { + $appids = [$appids]; + } + if ($appids) { + foreach ($appids as $item) { + WxserverJob::dispatch(['appid' => $item]); } + return $this->renderSuccess('success'); } return $this->renderError('操作失败'); }