|
|
@@ -62,8 +62,7 @@ class Chabao extends Api
|
|
|
public function register(UserModel $userModel)
|
|
|
{
|
|
|
|
|
|
- //判断地址存在
|
|
|
- if($userModel->getByAddress($this->params['address'])) $this->error('地址已存在');
|
|
|
+
|
|
|
//手机号存在
|
|
|
if($userModel::where('mobile', $this->params['mobile'])->find()) $this->error('账号已存在');
|
|
|
$newUserID = 0;
|
|
|
@@ -73,7 +72,6 @@ class Chabao extends Api
|
|
|
//注册
|
|
|
$time = time();
|
|
|
$data = [
|
|
|
- 'address' => $this->params['address'],
|
|
|
'mobile' => $this->params['mobile'],
|
|
|
'nickname' => "188" . substr((string)$time, 2) . rand(10, 99),//188开头,时间戳去掉开头两位,再后面再加两位随机数
|
|
|
'avatar' => $this->request->domain().'/assets/img/logo.png',
|
|
|
@@ -85,7 +83,7 @@ class Chabao extends Api
|
|
|
$newUserID = $userModel->insertGetId($data);
|
|
|
// 创建钱包
|
|
|
(new LedgerWalletModel())->insertGetId(['user_id' => $newUserID]);
|
|
|
- Token::marshal($newUserID, $this->params['address']);
|
|
|
+ Token::marshal($newUserID, $this->params['mobile']);
|
|
|
|
|
|
// 提交事务
|
|
|
Db::commit();
|