1.提交缺失的东西
This commit is contained in:
@ -38,7 +38,7 @@ class LoginController extends BaseApiController
|
||||
{
|
||||
$params = (new RegisterValidate())->post()->goCheck('register');
|
||||
$result = LoginLogic::register($params);
|
||||
if (true === $result) {
|
||||
if ($result) {
|
||||
return $this->success('注册成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(LoginLogic::getError());
|
||||
|
||||
@ -42,6 +42,7 @@ use think\facade\Db;
|
||||
use think\facade\Config;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Hook;
|
||||
use weixin\Getopenid;
|
||||
|
||||
class LoginLogic extends LogicBase
|
||||
{
|
||||
@ -90,13 +91,13 @@ class LoginLogic extends LogicBase
|
||||
// 生成分销会员基础表
|
||||
\app\common\logic\DistributionLogic::add($user->id);
|
||||
|
||||
//注册赠送
|
||||
self::registerAward($user->id);
|
||||
//消息通知
|
||||
Hook::listen('notice', [
|
||||
'user_id' => $user->id,
|
||||
'scene' => NoticeSetting::REGISTER_SUCCESS_NOTICE,
|
||||
]);
|
||||
// //注册赠送
|
||||
// self::registerAward($user->id);
|
||||
// //消息通知
|
||||
// Hook::listen('notice', [
|
||||
// 'user_id' => $user->id,
|
||||
// 'scene' => NoticeSetting::REGISTER_SUCCESS_NOTICE,
|
||||
// ]);
|
||||
return $token;
|
||||
}
|
||||
/**
|
||||
@ -339,6 +340,12 @@ class LoginLogic extends LogicBase
|
||||
->field(['id', 'nickname', 'avatar', 'level', 'disable', 'distribution_code'])
|
||||
->where(['account|mobile' => $post['account']])
|
||||
->find();
|
||||
if($user_info == null){
|
||||
$open=new Getopenid();
|
||||
$response['openid'] = $open;
|
||||
$response['mobile'] = $post['account'];
|
||||
$user_info = UserServer::createUser($response, Client_::mnp);
|
||||
}
|
||||
$user_info['token'] = self::createSession($user_info['id'], $post['client']);
|
||||
if (empty($user_info['avatar'])) {
|
||||
$user_info['avatar'] = UrlServer::getFileUrl(ConfigServer::get('website', 'user_image'));
|
||||
|
||||
@ -53,7 +53,7 @@ class UserServer
|
||||
$unionid = $response['unionid'] ?? '';
|
||||
$avatar_url = $response['headimgurl'] ?? '';
|
||||
$nickname = $response['nickname'] ?? '';
|
||||
|
||||
$mobile = $response['mobile'] ?? '';
|
||||
Db::startTrans();
|
||||
|
||||
// 获取存储引擎
|
||||
@ -84,6 +84,8 @@ class UserServer
|
||||
'sn' => create_user_sn(),
|
||||
'avatar' => $avatar,
|
||||
'create_time' => $time,
|
||||
'mobile' => $mobile,
|
||||
'account' => $mobile,
|
||||
'distribution_code' => generate_invite_code(),//分销邀请码
|
||||
'is_distribution' => DistributionLogic::isDistributionMember(),
|
||||
// 微信新用户
|
||||
|
||||
Reference in New Issue
Block a user