...
|
...
|
@@ -22,6 +22,7 @@ class User extends Api |
|
|
public function _initialize()
|
|
|
{
|
|
|
parent::_initialize();
|
|
|
$this->model = model('app\common\model\User');
|
|
|
$this->user = $this->auth->getUser();
|
|
|
}
|
|
|
|
...
|
...
|
@@ -40,7 +41,7 @@ class User extends Api |
|
|
public function index()
|
|
|
{
|
|
|
// 当前用户信息
|
|
|
$user = $this->auth->getUser();
|
|
|
$user = $this->user;
|
|
|
$coupon_count = \app\common\model\UserCoupon::alias('uc')
|
|
|
->join('coupon c','c.id = uc.coupon_id')
|
|
|
->where('uc.user_id',$this->user['id'])
|
...
|
...
|
@@ -73,8 +74,8 @@ class User extends Api |
|
|
// $session = Wechat::miniProgram()->auth->session($code);
|
|
|
// // 自动注册用户
|
|
|
// $userInfo = json_decode(htmlspecialchars_decode($user_info), true);
|
|
|
// if (!$user = UserModel::get(['openid' => $session['openid']])) {
|
|
|
// $user = new UserModel;
|
|
|
// if (!$user = $this->model->get(['openid' => $session['openid']])) {
|
|
|
// $user = $this->model;
|
|
|
// $userInfo['openid'] = $session['openid'];
|
|
|
// }
|
|
|
// $userInfo['nickname'] = preg_replace('/[\xf0-\xf7].{3}/', '', $userInfo['nickname']);
|
...
|
...
|
@@ -84,7 +85,7 @@ class User extends Api |
|
|
$session = [
|
|
|
'openid' => $testopenid ?: 'test',
|
|
|
];
|
|
|
$user = UserModel::get(['openid' => $session['openid']]);
|
|
|
$user = $this->model->get(['openid' => $session['openid']]);
|
|
|
// 生成token (session3rd)
|
|
|
$guid = guidv4();// 生成一个不会重复的随机字符串
|
|
|
$timeStamp = microtime(true);// 当前时间戳 (精确到毫秒)
|
...
|
...
|
@@ -143,7 +144,7 @@ class User extends Api |
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
|
if (UserModel::where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) {
|
|
|
if ($this->model->where('mobile', $mobile)->where('id', '<>', $this->user['id'])->find()) {
|
|
|
$this->error(__('Mobile already exists'));
|
|
|
}
|
|
|
// $result = Sms::check($mobile, $captcha, 'changemobile');
|
...
|
...
|
@@ -176,7 +177,7 @@ class User extends Api |
|
|
*/
|
|
|
public function scoreLog(){
|
|
|
$page = $this->request->request('page');
|
|
|
$list = UserModel::scoreLog($this->user['id'],$page);
|
|
|
$list = $this->model->scoreLog($this->user['id'],$page);
|
|
|
$this->success(__('成功'),compact('list'));
|
|
|
}
|
|
|
|
...
|
...
|
|