Browse Source

修改提示和逻辑判断

dev
李可松 5 years ago
parent
commit
8644f3c87d
  1. 15
      app/Http/Controllers/Controller.php

15
app/Http/Controllers/Controller.php

@ -30,17 +30,18 @@ class Controller extends BaseController
$this->user_id = Cache::get($auth);
if ($this->user_id) {
$user = User::query()->firstWhere(['id' => $this->user_id, 'status' => 1]);
}
if (empty($user)) {
$this->error('用户不存在或已被禁用' . $this->user_id);
exit();
if (empty($user)) {
$this->user_id = 0;
$this->error('登录信息已过期,请重新登录')->send();
exit();
}
}
}
//检查代理商
$agent = Agent::query()->firstWhere(['appid' => $appid, 'status' => 1]);
if (!$agent) {
$this->error('商户不存在或已被禁用');
$this->error('商户不存在或已被禁用')->send();
exit();
}
$this->agent_id = $agent->id;
@ -54,7 +55,7 @@ class Controller extends BaseController
'data' => $data,
'status' => $status,
'debug_time' => microtime(true) - LARAVEL_START
])->send();
]);
}
protected function error($msg = 'error', $code = -1, $status = 500)
@ -65,6 +66,6 @@ class Controller extends BaseController
'data' => [],
'status' => $status,
'debug_time' => microtime(true) - LARAVEL_START
])->send();
]);
}
}
Loading…
Cancel
Save