Explorar o código

用户相关接口,接收参数

lizhen_gitee hai 4 meses
pai
achega
81ba5a2cbe
Modificáronse 1 ficheiros con 19 adicións e 20 borrados
  1. 19 20
      application/api/controller/User.php

+ 19 - 20
application/api/controller/User.php

@@ -37,8 +37,8 @@ class User extends Api
      */
     public function login()
     {
-        $account = $this->request->post('account');
-        $password = $this->request->post('password');
+        $account = input('account');
+        $password = input('password');
         if (!$account || !$password) {
             $this->error(__('Invalid parameters'));
         }
@@ -60,8 +60,8 @@ class User extends Api
      */
     public function mobilelogin()
     {
-        $mobile = $this->request->post('mobile');
-        $captcha = $this->request->post('captcha');
+        $mobile = input('mobile');
+        $captcha = input('captcha');
         if (!$mobile || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
@@ -102,9 +102,9 @@ class User extends Api
      */
     public function register()
     {
-        $mobile = $this->request->post('mobile');
-        $captcha = $this->request->post('captcha');
-        $password = $this->request->post('password');
+        $mobile = input('mobile');
+        $captcha = input('captcha');
+        $password = input('password');
 
         if (!$mobile || !$captcha || !$password) {
             $this->error(__('Invalid parameters'));
@@ -127,7 +127,7 @@ class User extends Api
 
     //微信登录,预先假注册
     public function wechatlogin(){
-        $code = $this->request->param('code','');
+        $code = input('code','');
         if(!$code){
             $this->error(__('Invalid parameters'));
         }
@@ -197,9 +197,9 @@ class User extends Api
     public function bindmobile()
     {
 
-        $mobile = $this->request->param('mobile');
-        $captcha = $this->request->param('captcha');
-        $code = $this->request->param('code');
+        $mobile = input('mobile');
+        $captcha = input('captcha');
+        $code = input('code');
 
         if (!$mobile || !$captcha || !$code) {
             $this->error(__('Invalid parameters'));
@@ -231,7 +231,7 @@ class User extends Api
             }
             //如果已经有账号则直接登录
             $ret = $this->auth->direct($user['id']);
-            $this->success('success',$this->auth->getUserinfo_simple());
+            $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
         }
 
         //新的openid用户
@@ -250,7 +250,6 @@ class User extends Api
         } else {
             $extend = [
                 'wechat_openid' => $wechatCode['openid'],
-//                'plat_unique_id' => input('plat_unique_id','','trim'),
             ];
             $ret = $this->auth->register('', '','', $mobile, $extend);
         }
@@ -258,7 +257,7 @@ class User extends Api
             $this->error($this->auth->getError());
         }
 
-        $this->success('success',$this->auth->getUserinfo_simple());
+        $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
 
     }
 
@@ -361,8 +360,8 @@ class User extends Api
     {
         $user = $this->auth->getUser();
 
-        $mobile = $this->request->post('mobile');
-        $captcha = $this->request->post('captcha');
+        $mobile = input('mobile');
+        $captcha = input('captcha');
         if (!$mobile || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
@@ -388,7 +387,7 @@ class User extends Api
     public function changepwd()
     {
         $mobile = $this->auth->mobile;
-        $captcha = $this->request->post('captcha');
+        $captcha = input('captcha');
         $newpassword = input('newpassword','');
 
         if (!$mobile || !$captcha || !$newpassword) {
@@ -425,9 +424,9 @@ class User extends Api
      */
     public function resetpwd()
     {
-        $mobile = $this->request->post("mobile");
-        $captcha = $this->request->post("captcha");
-        $newpassword = $this->request->post("newpassword");
+        $mobile = input("mobile");
+        $captcha = input("captcha");
+        $newpassword = input("newpassword");
 
         if (!$mobile || !$captcha || !$newpassword) {
             $this->error(__('Invalid parameters'));