代码优化

This commit is contained in:
wong
2025-04-30 11:15:19 +08:00
parent 43a27ef35f
commit 209cc96dce
8 changed files with 281 additions and 154 deletions

View File

@@ -15,15 +15,15 @@ class WechatController extends BaseController
*
* @param string $pageIndex 页码
* @param string $pageSize 每页大小
* @param bool $isJob 是否为任务调用
* @param bool $isInner 是否为任务调用
* @return \think\response\Json
*/
public function getList($pageIndex = '', $pageSize = '', $isJob = false)
public function getList($pageIndex = '', $pageSize = '', $isInner = false)
{
// 获取授权token
$authorization = trim($this->request->header('authorization', $this->authorization));
if (empty($authorization)) {
if ($isJob) {
if ($isInner) {
return json_encode(['code' => 500, 'msg' => '缺少授权信息']);
} else {
return errorJson('缺少授权信息');
@@ -62,13 +62,13 @@ class WechatController extends BaseController
// 获取并更新微信账号状态信息
$this->getListTenantWechatPartial($authorization);
if ($isJob) {
if ($isInner) {
return json_encode(['code' => 200, 'msg' => '获取微信账号列表成功', 'data' => $response]);
} else {
return successJson($response);
}
} catch (\Exception $e) {
if ($isJob) {
if ($isInner) {
return json_encode(['code' => 500, 'msg' => '获取微信账号列表失败:' . $e->getMessage()]);
} else {
return errorJson('获取微信账号列表失败:' . $e->getMessage());