| | |
| | | use app\api\logic\ActivityInfo as InfoActivityInfo; |
| | | use app\common\model\UserExtend as ModelUserExtend; |
| | | use think\Db; |
| | | |
| | | use EasyWeChat\Kernel\Support\AES; |
| | | /** |
| | | * 会员接口 |
| | | */ |
| | | class User extends Api |
| | | { |
| | | protected $noNeedLogin = ['GetRecomInviter','login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register']; |
| | | protected $noNeedLogin = ['GetDfgToken','GetRecomInviter','login', 'mobilelogin', 'resetpwd', 'changemobile', 'wxapplogin','bind_mobile_login','register']; |
| | | protected $noNeedRight = '*'; |
| | | |
| | | public function _initialize() |
| | |
| | | $data = ['userinfo' => $userInfo]; |
| | | $this->success('获取成功', $data); |
| | | } |
| | | |
| | | |
| | | public function GetDfgToken() |
| | | { |
| | | $userId=$this->request->post('userid'); |
| | | if (!$userId) { |
| | | $this->error(__('Invalid parameters')); |
| | | } |
| | | //aes加密 |
| | | $enKey="wp4hs3bvu7wq2mud"; |
| | | $iv = 'fedcba9876543210'; |
| | | $decrypted = base64_encode(AES::encrypt($userId,$enKey, $iv)); |
| | | $this->success($decrypted); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | 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'); |
| | |
| | | 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){ |
| | |
| | | $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; |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取用户预估金额 |
| | | * |