quguofeng 1 vuosi sitten
vanhempi
commit
f8a1788353
2 muutettua tiedostoa jossa 16 lisäystä ja 0 poistoa
  1. 14 0
      application/api/controller/User.php
  2. 2 0
      application/common/library/Auth.php

+ 14 - 0
application/api/controller/User.php

@@ -28,6 +28,20 @@ class User extends Api
     }
     /**
      * 用户信息
+     * @ApiMethod (POST)
+     * @ApiReturnParams (name=code,type="integer",description=错误码:0=失败1=成功401=未登录403=没有权限)
+     * @ApiReturnParams (name=msg,type="string",description=提示信息)
+     * @ApiReturnParams (name=data,type="array",description=要返回的数据)
+     * @ApiReturnParams (name=data.id,type="integer",description=用户ID)
+     * @ApiReturnParams (name=data.username,type="string",description=用户姓名)
+     * @ApiReturnParams (name=data.email,type="string",description=邮箱)
+     * @ApiReturnParams (name=data.mobile,type="integer",description=手机号)
+     * @ApiReturnParams (name=data.avatar,type="string",description=头像地址)
+     * @ApiReturnParams (name=data.gender,type="string",description=性别)
+     * @ApiReturnParams (name=data.birthday,type="string",description=出生年月)
+     * @ApiReturnParams (name=data.rights,type="integer",description=是否有权益:0=没有1=有)
+     * @ApiReturnParams (name=data.mobile,type="integer",description=手机号)
+     * @ApiReturnParams (name=data.avatar,type="string",description=头像地址)
      */
     public function index()
     {

+ 2 - 0
application/common/library/Auth.php

@@ -159,6 +159,7 @@ class Auth
             'password' => $password,
             'email'    => $email,
             'mobile'   => $mobile,
+            'gender' => '男',
             'level'    => 1,
             'score'    => 0,
             'avatar'   => '',
@@ -389,6 +390,7 @@ class Auth
         $allowFields = $this->getAllowFields();
         $userinfo = array_intersect_key($data, array_flip($allowFields));
         $userinfo = array_merge($userinfo, Token::get($this->_token));
+        unset($userinfo['token'],$userinfo['user_id'],$userinfo['createtime'],$userinfo['expiretime'],$userinfo['expiretime'],$userinfo['expires_in']);
         return $userinfo;
     }