From 7adc36ae4f82bfb9224fc98935e8ed1dbeee53cf Mon Sep 17 00:00:00 2001 From: Karson Date: Mon, 5 Jul 2021 11:27:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E9=94=AE=E7=94=9F?= =?UTF-8?q?=E6=88=90API=E6=96=87=E6=A1=A3=20=E4=BC=98=E5=8C=96=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=AF=B7=E6=B1=82=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/Ems.php | 2 + application/api/controller/Sms.php | 2 + application/api/controller/User.php | 54 +++++++++------- application/api/controller/Validate.php | 8 +++ public/api.html | 82 ++++++++++++------------- 5 files changed, 84 insertions(+), 64 deletions(-) diff --git a/application/api/controller/Ems.php b/application/api/controller/Ems.php index 7e487a3f..40d65f55 100644 --- a/application/api/controller/Ems.php +++ b/application/api/controller/Ems.php @@ -31,6 +31,7 @@ class Ems extends Api /** * 发送验证码 * + * @ApiMethod (POST) * @param string $email 邮箱 * @param string $event 事件名称 */ @@ -68,6 +69,7 @@ class Ems extends Api /** * 检测验证码 * + * @ApiMethod (POST) * @param string $email 邮箱 * @param string $event 事件名称 * @param string $captcha 验证码 diff --git a/application/api/controller/Sms.php b/application/api/controller/Sms.php index d1d1ec20..373b1299 100644 --- a/application/api/controller/Sms.php +++ b/application/api/controller/Sms.php @@ -18,6 +18,7 @@ class Sms extends Api /** * 发送验证码 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $event 事件名称 */ @@ -65,6 +66,7 @@ class Sms extends Api /** * 检测验证码 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $event 事件名称 * @param string $captcha 验证码 diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 5ff63766..df467131 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -32,13 +32,14 @@ class User extends Api /** * 会员登录 * + * @ApiMethod (POST) * @param string $account 账号 * @param string $password 密码 */ public function login() { - $account = $this->request->request('account'); - $password = $this->request->request('password'); + $account = $this->request->post('account'); + $password = $this->request->post('password'); if (!$account || !$password) { $this->error(__('Invalid parameters')); } @@ -54,13 +55,14 @@ class User extends Api /** * 手机验证码登录 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $captcha 验证码 */ public function mobilelogin() { - $mobile = $this->request->request('mobile'); - $captcha = $this->request->request('captcha'); + $mobile = $this->request->post('mobile'); + $captcha = $this->request->post('captcha'); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); } @@ -92,6 +94,7 @@ class User extends Api /** * 注册会员 * + * @ApiMethod (POST) * @param string $username 用户名 * @param string $password 密码 * @param string $email 邮箱 @@ -100,11 +103,11 @@ class User extends Api */ public function register() { - $username = $this->request->request('username'); - $password = $this->request->request('password'); - $email = $this->request->request('email'); - $mobile = $this->request->request('mobile'); - $code = $this->request->request('code'); + $username = $this->request->post('username'); + $password = $this->request->post('password'); + $email = $this->request->post('email'); + $mobile = $this->request->post('mobile'); + $code = $this->request->post('code'); if (!$username || !$password) { $this->error(__('Invalid parameters')); } @@ -139,6 +142,7 @@ class User extends Api /** * 修改会员个人信息 * + * @ApiMethod (POST) * @param string $avatar 头像地址 * @param string $username 用户名 * @param string $nickname 昵称 @@ -147,10 +151,10 @@ class User extends Api public function profile() { $user = $this->auth->getUser(); - $username = $this->request->request('username'); - $nickname = $this->request->request('nickname'); - $bio = $this->request->request('bio'); - $avatar = $this->request->request('avatar', '', 'trim,strip_tags,htmlspecialchars'); + $username = $this->request->post('username'); + $nickname = $this->request->post('nickname'); + $bio = $this->request->post('bio'); + $avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars'); if ($username) { $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); if ($exists) { @@ -174,6 +178,7 @@ class User extends Api /** * 修改邮箱 * + * @ApiMethod (POST) * @param string $email 邮箱 * @param string $captcha 验证码 */ @@ -181,7 +186,7 @@ class User extends Api { $user = $this->auth->getUser(); $email = $this->request->post('email'); - $captcha = $this->request->request('captcha'); + $captcha = $this->request->post('captcha'); if (!$email || !$captcha) { $this->error(__('Invalid parameters')); } @@ -208,14 +213,15 @@ class User extends Api /** * 修改手机号 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $captcha 验证码 */ public function changemobile() { $user = $this->auth->getUser(); - $mobile = $this->request->request('mobile'); - $captcha = $this->request->request('captcha'); + $mobile = $this->request->post('mobile'); + $captcha = $this->request->post('captcha'); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); } @@ -242,14 +248,15 @@ class User extends Api /** * 第三方登录 * + * @ApiMethod (POST) * @param string $platform 平台名称 * @param string $code Code码 */ public function third() { $url = url('user/index'); - $platform = $this->request->request("platform"); - $code = $this->request->request("code"); + $platform = $this->request->post("platform"); + $code = $this->request->post("code"); $config = get_addon_config('third'); if (!$config || !isset($config[$platform])) { $this->error(__('Invalid parameters')); @@ -273,17 +280,18 @@ class User extends Api /** * 重置密码 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $newpassword 新密码 * @param string $captcha 验证码 */ public function resetpwd() { - $type = $this->request->request("type"); - $mobile = $this->request->request("mobile"); - $email = $this->request->request("email"); - $newpassword = $this->request->request("newpassword"); - $captcha = $this->request->request("captcha"); + $type = $this->request->post("type"); + $mobile = $this->request->post("mobile"); + $email = $this->request->post("email"); + $newpassword = $this->request->post("newpassword"); + $captcha = $this->request->post("captcha"); if (!$newpassword || !$captcha) { $this->error(__('Invalid parameters')); } diff --git a/application/api/controller/Validate.php b/application/api/controller/Validate.php index 82b3a98a..adb36d0f 100644 --- a/application/api/controller/Validate.php +++ b/application/api/controller/Validate.php @@ -22,6 +22,7 @@ class Validate extends Api /** * 检测邮箱 * + * @ApiMethod (POST) * @param string $email 邮箱 * @param string $id 排除会员ID */ @@ -39,6 +40,7 @@ class Validate extends Api /** * 检测用户名 * + * @ApiMethod (POST) * @param string $username 用户名 * @param string $id 排除会员ID */ @@ -56,6 +58,7 @@ class Validate extends Api /** * 检测昵称 * + * @ApiMethod (POST) * @param string $nickname 昵称 * @param string $id 排除会员ID */ @@ -73,6 +76,7 @@ class Validate extends Api /** * 检测手机 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $id 排除会员ID */ @@ -90,6 +94,7 @@ class Validate extends Api /** * 检测手机 * + * @ApiMethod (POST) * @param string $mobile 手机号 */ public function check_mobile_exist() @@ -105,6 +110,7 @@ class Validate extends Api /** * 检测邮箱 * + * @ApiMethod (POST) * @param string $mobile 邮箱 */ public function check_email_exist() @@ -120,6 +126,7 @@ class Validate extends Api /** * 检测手机验证码 * + * @ApiMethod (POST) * @param string $mobile 手机号 * @param string $captcha 验证码 * @param string $event 事件 @@ -138,6 +145,7 @@ class Validate extends Api /** * 检测邮箱验证码 * + * @ApiMethod (POST) * @param string $email 邮箱 * @param string $captcha 验证码 * @param string $event 事件 diff --git a/public/api.html b/public/api.html index fba5e716..54ade365 100755 --- a/public/api.html +++ b/public/api.html @@ -1119,7 +1119,7 @@
@@ -1208,7 +1208,7 @@
-
+
@@ -1260,7 +1260,7 @@
@@ -1355,7 +1355,7 @@
- +
@@ -1528,7 +1528,7 @@
@@ -1617,7 +1617,7 @@
- +
@@ -1669,7 +1669,7 @@
@@ -1764,7 +1764,7 @@
- +
@@ -2163,7 +2163,7 @@
@@ -2252,7 +2252,7 @@
- +
@@ -2304,7 +2304,7 @@
@@ -2393,7 +2393,7 @@
- +
@@ -2445,7 +2445,7 @@
@@ -2552,7 +2552,7 @@
- +
@@ -2729,7 +2729,7 @@
@@ -2830,7 +2830,7 @@
- +
@@ -2890,7 +2890,7 @@
@@ -2979,7 +2979,7 @@
- +
@@ -3031,7 +3031,7 @@
@@ -3120,7 +3120,7 @@
- +
@@ -3172,7 +3172,7 @@
@@ -3261,7 +3261,7 @@
- +
@@ -3313,7 +3313,7 @@
@@ -3408,7 +3408,7 @@
- +
@@ -3466,7 +3466,7 @@
@@ -3555,7 +3555,7 @@
- +
@@ -3607,7 +3607,7 @@
- +
@@ -3748,7 +3748,7 @@
@@ -3837,7 +3837,7 @@
- +
@@ -3889,7 +3889,7 @@
@@ -3978,7 +3978,7 @@
- +
@@ -4030,7 +4030,7 @@
@@ -4113,7 +4113,7 @@
- +
@@ -4161,7 +4161,7 @@
@@ -4244,7 +4244,7 @@
- +
@@ -4292,7 +4292,7 @@
@@ -4387,7 +4387,7 @@
- +
@@ -4443,7 +4443,7 @@
@@ -4538,7 +4538,7 @@
- +
@@ -4600,7 +4600,7 @@
- Generated on 2020-12-21 11:39:26 我的网站 + Generated on 2021-06-08 17:27:40 我的网站