33 lines
917 B
PHP
33 lines
917 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace app\http\model;
|
||
|
|
|
||
|
|
use fastphp\base\Model;
|
||
|
|
|
||
|
|
class User extends Model
|
||
|
|
{
|
||
|
|
|
||
|
|
// private $url_root = 'https://sandbox.sgxz.cn';
|
||
|
|
private $url_root = 'https://merchant.sgxz.cn';
|
||
|
|
|
||
|
|
protected $table = 'user';
|
||
|
|
|
||
|
|
//获取用户的http相关信息 并且初始化sgUserId
|
||
|
|
public function get_http_user($id){
|
||
|
|
$user_info = $this->getOne(['Id' => $id],'Id,sgUserId,ju_money,is_verify');
|
||
|
|
|
||
|
|
if (empty($user_info['sgUserId'])) {
|
||
|
|
$request_data = ['account' => $user_info['Id']];
|
||
|
|
$url = $this->url_root.'/register/user';
|
||
|
|
|
||
|
|
$request_data = formatHttpRequert($request_data);
|
||
|
|
|
||
|
|
$http_data = json_decode(linkcurl($url,'POST',$request_data,[],0));
|
||
|
|
|
||
|
|
$update_user_info['sgUserId'] = $user_info['sgUserId'] = $http_data->d->id;
|
||
|
|
|
||
|
|
$this->updateOne(['Id' => $id],$update_user_info);
|
||
|
|
}
|
||
|
|
return $user_info;
|
||
|
|
}
|
||
|
|
}
|