6
0
Fork 0

添加经销商端登录

release
vine_liutk 2022-01-12 16:54:19 +08:00 committed by 李静
parent 580e97203d
commit c3f1882814
3 changed files with 22 additions and 0 deletions

View File

@ -9,4 +9,7 @@ class Device
// 商户端
public const MERCHANT = 'merchant';
// 经销商端
public const DEALER = 'dealer';
}

View File

@ -52,7 +52,16 @@ class LoginController extends Controller
// 颁发新的商户端令牌
$token = $user->createToken($device);
break;
case Device::DEALER:
if (!$user->isDealer()) {
throw new BizException('账户没有权限');
}
// 清理此用户的商户端令牌
$user->tokens()->where('name', $device)->delete();
// 颁发新的商户端令牌
$token = $user->createToken($device);
break;
default:
$device = Device::UNIAPP;
// 清理此用户的商城端令牌

View File

@ -137,6 +137,16 @@ class User extends Model implements AuthorizableContract, AuthenticatableContrac
return $this->userInfo?->growth_value >= config('agent.upgrade_rules.vip.sales_value');
}
/**
* todo-确认这个用户是否是经销商
*
* @return boolean
*/
public function isDealer(): bool
{
return true;
}
/**
* 属于此用户的售后订单
*/