|
@@ -47,7 +47,6 @@ class User extends Api
|
|
|
{
|
|
|
$nickname = $this->request->post('nickname','');
|
|
|
$mobile = $this->request->post('mobile','');
|
|
|
- $introcode = $this->request->post('introcode','');
|
|
|
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
|
|
|
|
|
|
$data = [
|
|
@@ -62,13 +61,6 @@ class User extends Api
|
|
|
}
|
|
|
$data['mobile'] = $mobile;
|
|
|
}
|
|
|
- if ($introcode) {
|
|
|
- $intro_uid = \app\common\model\User::where('introcode', $introcode)->value('id');
|
|
|
- if (!$intro_uid) {
|
|
|
- $this->error('不存在的邀请码');
|
|
|
- }
|
|
|
- $data['intro_uid'] = $intro_uid;
|
|
|
- }
|
|
|
|
|
|
|
|
|
Db::name('user')->where('id',$this->auth->id)->update($data);
|
|
@@ -153,6 +145,7 @@ class User extends Api
|
|
|
*/
|
|
|
public function wxMiniProgramLogin() {
|
|
|
$openid = $this->request->request('openid');// openid值
|
|
|
+ $introcode = $this->request->request('introcode','');
|
|
|
|
|
|
if (!$openid) {
|
|
|
$this->error(__('Invalid parameters'));
|
|
@@ -171,8 +164,6 @@ class User extends Api
|
|
|
Db::name('user')->where('id',$userInfo['id'])->update(['logintime'=>time()]);
|
|
|
$res = $this->auth->direct($userInfo['id']);
|
|
|
} else {
|
|
|
- // 注册
|
|
|
-
|
|
|
// 用户信息不存在时使用
|
|
|
$extend = [
|
|
|
'mini_openid' => $openid,
|
|
@@ -180,6 +171,15 @@ class User extends Api
|
|
|
'unionid' => $openidInfo['unionid'],
|
|
|
];
|
|
|
|
|
|
+ // 注册
|
|
|
+ if ($introcode) {
|
|
|
+ $intro_uid = \app\common\model\User::where('introcode', $introcode)->value('id');
|
|
|
+ if (!$intro_uid) {
|
|
|
+ $this->error('不存在的邀请码');
|
|
|
+ }
|
|
|
+ $extend['intro_uid'] = $intro_uid;
|
|
|
+ }
|
|
|
+
|
|
|
// 默认注册一个会员
|
|
|
$result = $this->auth->register('', '', '','', $extend);
|
|
|
if (!$result) {
|