feat : basic

This commit is contained in:
2024-11-12 11:02:38 +08:00
parent 235acbea9c
commit a9f81888b7
26 changed files with 342 additions and 209 deletions

View File

@@ -13,7 +13,7 @@ namespace App\Service\Api\Login;
use App\Cache\Redis\Api\ApiRedisKey;
use App\Cache\Redis\RedisCache;
use App\Constants\Common\UserCode;
use App\Exception\ApiException;
use App\Exception\ErrException;
use App\Extend\StringUtil;
use App\Extend\SystemUtil;
use App\Lib\Crypto\CryptoFactory;
@@ -91,7 +91,7 @@ abstract class LoginBaseService extends BaseService
$this->userId = empty($this->userId) ? $this->userInfo->id : $this->userId;
if (empty($this->userId)) {
throw new ApiException('登录失败');
throw new ErrException('登录失败');
}
//todo 判断注销 判断封号
@@ -137,7 +137,7 @@ abstract class LoginBaseService extends BaseService
};
if (0 == ($this->redis->addLock($this->lockKey))){
throw new ApiException('请勿重复点击');
throw new ErrException('请勿重复点击');
}
}
@@ -154,7 +154,7 @@ abstract class LoginBaseService extends BaseService
$model->avatar_id = 0;
$model->reg_ip = SystemUtil::getClientIp();
if (!$model->save()) throw new ApiException('数据保存失败-注册失败');
if (!$model->save()) throw new ErrException('数据保存失败-注册失败');
$this->userId = $model->id;
$this->userInfo = $model;