Browse Source

生成接口文档

Cherry 2 years ago
parent
commit
a2f99b7196
2 changed files with 221 additions and 196 deletions
  1. 10 2
      application/api/controller/User.php
  2. 211 194
      public/api.html

+ 10 - 2
application/api/controller/User.php

@@ -367,18 +367,26 @@ class User extends Api
         return $data;
     }
 
+    /**
+     * 绑定微信手机号
+     * @ApiMethod (POST)
+     * @ApiParams (name=code,description="获取手机号code")
+     */
     public function bind_wechat_phone(){
         $code = $this->request->post("code");
+        if(!$code){
+            $this->error('参数错误');
+        }
         $access_token_result = \app\common\service\WxService::getWxAccessToken();
         if(!$access_token_result){
-            $this->error('请稍后重试');
+            $this->error('请刷新后重试');
         }
         $access_token = $access_token_result['access_token'];
 
         // 获取手机号
         $phone_info = \app\common\service\WxService::getWxphonenumber($access_token,$code);
         if(!$phone_info){
-            $this->error('请后重试!');
+            $this->error('请刷新后重试!');
         }
 
         //{"ret":true,"msg":"{\"errcode\":0,\"errmsg\":\"ok\",\"phone_info\":{\"phoneNumber\":\"18206485031\",\"purePhoneNumber\":\"18206485031\",\"countryCode\":\"86\",\"watermark\":{\"timestamp\":1679738067,\"appid\":\"wx20bb65dcc885b693\"}}}"}

File diff suppressed because it is too large
+ 211 - 194
public/api.html


Some files were not shown because too many files changed in this diff