|
|
@@ -63,16 +63,7 @@ class Login extends Base
|
|
|
$user = (new SystemUser)->where($map)->findOrEmpty();
|
|
|
if ($user->isEmpty()) return [0,trans("error.user-empty"),[]];
|
|
|
if ($user['status'] <> 1) return [0,trans("error.user-status"),[]];
|
|
|
- if ($user['type'] > 1) {
|
|
|
- $typeUser = $this->getTypeUser($user['store_id']);
|
|
|
- if (empty($typeUser)) return [0,trans("empty.agent"),[]];
|
|
|
- if ($typeUser['status'] <> 1) return [0,trans("error.agent"),[]];
|
|
|
- if (time() > strtotime($typeUser['vip_end'])) return [0,trans("error.agent-out"),[]];
|
|
|
- $user['shop_name'] = $typeUser['poi_name'];
|
|
|
- }
|
|
|
- if ($type == 2) {
|
|
|
- if (md5($param['password'].$user['salt']) <> $user['password']) return [0,trans("error.passwd"),[]];
|
|
|
- }
|
|
|
+ if (md5($param['password'].$user['salt']) <> $user['password']) return [0,trans("error.passwd"),[]];
|
|
|
$user->login_at = getDateFull();
|
|
|
$user->login_ip = request()->getRealIp();
|
|
|
$user->login_num = Db::raw("login_num+1");
|
|
|
@@ -80,42 +71,17 @@ class Login extends Base
|
|
|
return [1,'success',$user->toArray()];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 获取代理信息
|
|
|
- * @param int $agentId
|
|
|
- * @return array
|
|
|
- */
|
|
|
- protected function getTypeUser(int $agentId = 0): array
|
|
|
- {
|
|
|
- return (new SaasStore)->where("poi_id",$agentId)->findOrEmpty()->toArray();
|
|
|
- }
|
|
|
-
|
|
|
#[GetMapping('profile')]
|
|
|
public function getLoginUser(): Response
|
|
|
{
|
|
|
try {
|
|
|
$userData = (new Auth)->guard("admin")->user()->toArray();
|
|
|
if (isset($userData['password'])) unset($userData['password']);
|
|
|
- $agent = (new SaasStore)->where("poi_id",$userData['store_id'])->findOrEmpty();
|
|
|
- if (empty($agent['vip_end']))
|
|
|
- {
|
|
|
- $userData['vip_end'] = 0;
|
|
|
- } else {
|
|
|
- $userData['vip_end'] = strtotime($agent['vip_end']);
|
|
|
- }
|
|
|
return successTrans("success.data",[
|
|
|
"username" => $userData['username'],
|
|
|
"userId" => $userData['id'],
|
|
|
"truename" => $userData['truename'],
|
|
|
- "vip_at" => $userData['vip_end'],
|
|
|
- "agent_id" => $userData['agent_id'],
|
|
|
- "store_id" => $userData['store_id'],
|
|
|
- "super" => $userData['is_super'],
|
|
|
- "shop" => $agent['poi_name']??'',
|
|
|
- "trade" => $agent['trade_type']??0,
|
|
|
- "type" => $userData['type'],
|
|
|
- "logo" => $agent['poi_logo']??'-'
|
|
|
+ "super" => $userData['is_super']
|
|
|
]);
|
|
|
} catch (\Throwable $throwable) {
|
|
|
return error($throwable->getMessage());
|