zhaojs
2023-07-17 408f1e8ff147a8ca4eb48745ae69a7d091669c12
application/api/controller/User.php
@@ -694,6 +694,7 @@
    public function bind_invitation()
    {
        $invite_code = request()->param('invite_code','');
        $deviceid=request()->param('deviceid','');
        if(empty($invite_code)) $this->error('邀请码不能为空');
        $is_official = false;
        $isOpenOfficialCode = config('site.isOpenOfficialCode');
@@ -714,6 +715,13 @@
            if($f_user['status'] != 'normal')$this->error('邀请人帐号已被锁定,暂时无法邀请');
            if($user['invitation_id'] != 0)$this->error('当前已绑定上级用户');
            $save_data['invitation_id'] = $f_user['id'];
            if(!empty($deviceid))
            {//设备id
                $save_data['login_deviceid'] = $deviceid;
            }
            else{
                $save_data['login_deviceid'] = 'cus'.self::guid();
            }
            if($f_user['invitation_id'] != 0)$save_data['f_invitation_id'] = $f_user['invitation_id'];
            $res2 = $ModelUser->where(['id'=>$f_user['id']])->setInc('fans',1);
            if(!$res2){
@@ -733,6 +741,27 @@
        $this->success('绑定成功',[]);    
    }
   public function guid()
    {
        if (function_exists('com_create_guid')) {
            return com_create_guid();
        } else {
            mt_srand((double)microtime() * 10000);
            $charid = strtoupper(md5(uniqid(rand(), true)));
            $uuid = substr($charid, 0, 8)
                . substr($charid, 8, 4)
                . substr($charid, 12, 4)
                . substr($charid, 16, 4)
                . substr($charid, 20, 12);
            return $uuid;
        }
    }
    /**
     * 获取用户预估金额 
     *