Browse Source

兼容ios,post的问题

lizhen_gitee 3 years ago
parent
commit
f8741167a7
3 changed files with 17 additions and 15 deletions
  1. 13 11
      application/api/controller/User.php
  2. 3 3
      application/database.php
  3. 1 1
      thinkphp/helper.php

+ 13 - 11
application/api/controller/User.php

@@ -48,8 +48,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'));
         }
@@ -71,8 +71,10 @@ 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'));
         }
@@ -433,12 +435,12 @@ class User extends Api
      */
     public function resetpwd()
     {
-        //$type = $this->request->post("type");
+        //$type = input("type");
         $type = 'mobile';
-        $mobile = $this->request->post("mobile");
-        $email = $this->request->post("email");
-        $newpassword = $this->request->post("newpassword");
-        $captcha = $this->request->post("captcha");
+        $mobile = input("mobile");
+        $email = input("email");
+        $newpassword = input("newpassword");
+        $captcha = input("captcha");
         if (!$newpassword || !$captcha) {
             $this->error(__('Invalid parameters'));
         }
@@ -487,8 +489,8 @@ class User extends Api
      * @param string $oldpassword 旧密码
      */
     public function changepwd(){
-        $newpassword = input('post.newpassword');
-        $oldpassword = input('post.oldpassword','');
+        $newpassword = input('newpassword');
+        $oldpassword = input('oldpassword','');
 
         if (!$newpassword) {
             $this->error(__('Invalid parameters'));

+ 3 - 3
application/database.php

@@ -16,13 +16,13 @@ return [
     // 数据库类型
     'type'            => Env::get('database.type', 'mysql'),
     // 服务器地址
-    'hostname'        => Env::get('database.hostname', '127.0.0.1'),
+    'hostname'        => Env::get('database.hostname', '1.14.197.70'),
     // 数据库名
     'database'        => Env::get('database.database', 'mita'),
     // 用户名
-    'username'        => Env::get('database.username', 'root'),
+    'username'        => Env::get('database.username', 'mita'),
     // 密码
-    'password'        => Env::get('database.password', 'root'),
+    'password'        => Env::get('database.password', 'RHNfhbdepaZEHzBH'),
     // 端口
     'hostport'        => Env::get('database.hostport', ''),
     // 连接dsn

+ 1 - 1
thinkphp/helper.php

@@ -153,7 +153,7 @@ if (!function_exists('input_post')) {
      */
     function input_post($key = '', $default = null, $filter = '')
     {
-        return Request::instance()->post($key, $default, $filter);
+        return Request::instance()->request($key, $default, $filter);
     }
 }