小程序端接口需求分析


微信用户登录

请求URL:

  • ./public/wxAppUserCodeComes

请求方式:

  • POST

参数:

参数名 必选 类型 说明
code string wx.login

返回示例

  {
  "code":"OK",
  "data":{
    "token": 'IamTokenFromWxAPPAPI',
    "user_info": {
      "wx_app_open_id": "IamOpenId",
      "wx_app_session_key": "12154545"
    }
    }
  }

返回参数说明

参数名 类型 说明
wx_app_open_id string open_id
wx_app_session_key string session_key

备注

  • 公众号尚未被用户授权时,user_info中nick_name,province等信息暂无,前端调用wx.getUserInfo获取raw_data,session_key用于encryptedData解密;
  • 系统目前open_id和系统账号只是绑定关联,没有绝对依赖,可以暂不考虑wx.checkSession;

微信用户更新微信用户信息接口(用户授权后)

请求URL:

  • ./public/updateWxUserInfo

请求方式:

  • POST

参数:

参数名 必选 类型 说明
token string Get from wx.login response
nick_name string getUserInfo解密后的nick_name
avatar_url string ...avatar_url
gender string ...gender
city string ...city
province string ...province
country string ...country
language string ...language

返回示例

 {
  "code":"OK",
  "data":{
    "done": true
    }
  }

返回参数说明

参数名 类型 说明
done string true or false 更新成功或失败

高校推荐模块


获取高校信息列表

请求URL:

  • ./public/HomeController/universityList

请求方式:

  • POST

参数:

返回示例

{
    "code": "OK",
    "data": {
        "list": [
            {
                "university_id": 1,
                "university_name": "Harvard",
                "badge": "jss292424.png",
                "image": "bsdihdjaass.png",
                "rank": 1,
                "status": "NORMAL",
                "desc": "Philadelphia University is located in Philadelphia, Pennsylvania, USA. In 1884, the Philadelphia Philology School",
                "address": "Philadelphia, Pennsylvania, USA"
            },
            {
                "university_id": 2,
                "university_name": "William and Mary College",
                "badge": "jss26524.png",
                "image": "bsdihd455ss.png",
                "rank": 2,
                "status": "NORMAL",
                "desc": "Founded in 1693, the William and Mary College, also known as the William and Mary College, is the second oldest institution of higher education in the nation with a history just behind Harvard University founded in 1636",
                "address": "Virginia, United States"
            },
        ]
    }

获取某高校详情

请求URL:

  • ./public/HomeController/universityItem

请求方式:

  • POST

参数:

参数名 必选 类型 说明
university_id int

返回示例

{
    "code": "OK",
    "data": {
        "universityItem":  {
                "university_id": 1,
                "university_name": "Harvard",
                "badge": "jss292424.png",
                "image": "bsdihdjaass.png",
                "rank": 1,
                "status": "NORMAL",
                "desc": "Philadelphia University is located in Philadelphia, Pennsylvania, USA. In 1884, the Philadelphia Philology School",
                "address": "Philadelphia, Pennsylvania, USA"
            }
    }

搜索高校

请求URL:

  • ./public/HomeController/search

请求方式:

  • POST

参数:

参数名 必选 类型 说明
token string Get from wx.login response
keywords string 默认为空字符串
page int 默认为1

返回示例

{
    "code": "OK",
    "data": {
        "list": [
            {
                "university_id": 1,
                "university_name": "Harvard",
                "badge": "jss292424.png",
                "image": "bsdihdjaass.png",
                "rank": 1,
                "status": "NORMAL",
                "desc": "Philadelphia University is located in Philadelphia, Pennsylvania, USA. In 1884, the Philadelphia Philology School",
                "address": "Philadelphia, Pennsylvania, USA"
            }
        ]
    }

评估模块

当用户符合评估条件时,小程序获取用户个人信息,若在返回信息中获取不到用户邮箱(这里只是用来做判断)则要求用户填写详细信息,上传用户详细个人信息,若用户上传成功则提示用户可下单,当用户点击下单则创建订单,当用户点击支付确定取消或者则记录订单支付结果。


获取用户个人信息

请求URL:

  • ./public/UserController/getUserInfo

请求方式:

  • POST
    参数:
参数名 必选 类型 说明
token string

返回示例

{
    "code": "OK",
    "data": {
        "user_info": {
                "open_id": "olx8H0UHfk3RrzTe4ofZBWzl8J-0",
                "nick_name": "花开",
                "user_name": "朱梓骁",
                "avatar_url": "https://wx.qlogo.cn/mmopen/vi_32/wUMSLGCic1FOhTM5yV1Nw3S7txib7v0Fp0TPogtegNUeqvKS9t0OFxRiaqo27KgxtwReJmicUkeHl3FX2fxVVuZwmA/0",
                "gender": 2,
                "city": "Hangzhou",
                "province": "Zhejiang",
                "country": "China",
                "language": "zh_CN",
                "status": "NORMAL",
                "mobile": "13588235393",
                "email": "[email protected]",
                "university": "杭州电子科技大学",
                "subject": "数字媒体技术",
                "degree": "本科",
            }
    }
}

更新用户个人信息

请求URL:

  • ./public/updateWxUserInfo

请求方式:

  • POST
    参数:
参数名 必选 类型 说明
token string Get from wx.login response
user_name string
mobile string
email string
university string
province string
subject string
degree string

返回示例

 {
  "code":"OK",
  "data":{
    "done": true
    }
  }

创建订单

请求URL:

  • ./OrderController/placeOrder

请求方式:

  • POST
    参数:
参数名 必选 类型 说明
token string Get from wx.login response
publication string
citation string
review string
immigration_type string
payment string

返回示例

 {
    "code": "OK",
    "data": {
        "order_info": {
            "order_id": 2,
            "order_sn": "18021250445844",
            "open_id": "olx8H0Tx0rlev97sa2bCIOQcWVKo",
            "status": "INIT",
            "payment": "200.00",
            "order_time": "2018-02-05 10:31:42",
            "pay_time": null,
            "publication": 200,
            "citation": 200,
            "review": 100,
            "immigration_type": "EB1A",
             "user_info":{
                "open_id": "olx8H0UHfk3RrzTe4ofZBWzl8J-0",
                "nick_name": "花开",
                "user_name": "朱梓骁",
                "avatar_url": "https://wx.qlogo.cn/mmopen/vi_32/wUMSLGCic1FOhTM5yV1Nw3S7txib7v0Fp0TPogtegNUeqvKS9t0OFxRiaqo27KgxtwReJmicUkeHl3FX2fxVVuZwmA/0",
                "gender": 2,
                "city": "Hangzhou",
                "province": "Zhejiang",
                "country": "China",
                "language": "zh_CN",
                "status": "NORMAL",
                "mobile": "13588235393",
                "email": "[email protected]",
                "university": "杭州电子科技大学",
                "subject": "数字媒体技术",
                "degree": "本科",
            }        
        }
    }
}

记录支付结果

请求URL:

  • ./OrderController/recordOrder

请求方式:

  • POST
    参数:
参数名 必选 类型 说明
token string Get from wx.login response
order_id int
order_sn string
status string

返回示例

 {
  "code":"OK",
  "data":{
    "done": true
    }
  }

status为订单状态,分为INIT(待付款),PAID(已付款),SERVED(已服务),CANCELLED(已取消)。
注:只要订单的状态为已付款则系统将把订单信息发送至管理员邮箱

个人中心模块

获取订单列表

请求URL:

  • ./OrderController/getOrderList

请求方式:

  • POST
    参数:
参数名 必选 类型 说明
token string Get from wx.login response
status string

返回示例

 {
    "code": "OK",
    "data": {
            "order_list": [
             { 
                "order_id": 1,
                "order_sn": "18021250445844",
                "open_id": "olx8H0Tx0rlev97sa2bCIOQcWVKo",
                "status": "INIT",
                "payment": "200.00",
                "order_time": "2018-02-05 10:31:42",
                "pay_time": null,
                "publication": 200,
                "citation": 200,
                "review": 100,
                "immigration_type": "EB1A",
                 "user_info":{
                      "open_id": "olx8H0UHfk3RrzTe4ofZBWzl8J-0",
                      "nick_name": "花开",
                      "user_name": "朱梓骁",
                      "avatar_url": "https://wx.qlogo.cn/mmopen/vi_32/wUMSLGCic1FOhTM5yV1Nw3S7txib7v0Fp0TPogtegNUeqvKS9t0OFxRiaqo27KgxtwReJmicUkeHl3FX2fxVVuZwmA/0",
                      "gender": 2,
                      "city": "Hangzhou",
                      "province": "Zhejiang",
                      "country": "China",
                      "language": "zh_CN",
                      "status": "NORMAL",
                      "mobile": "13588235393",
                      "email": "[email protected]",
                      "university": "杭州电子科技大学",
                      "subject": "数字媒体技术",
                      "degree": "本科",
                       }        
                },
              {  
                "order_id": 2,
                "order_sn": "18021250445844",
                "open_id": "olx8H0Tx0rlev97sa2bCIOQcWVKo",
                "status": "INIT",
                "payment": "200.00",
                "order_time": "2018-02-05 10:31:42",
                "pay_time": null,
                "publication": 200,
                "citation": 200,
                "review": 100,
                "immigration_type": "EB1A",
                 "user_info":{
                      "open_id": "olx8H0UHfk3RrzTe4ofZBWzl8J-0",
                      "nick_name": "花开",
                      "user_name": "朱梓骁",
                      "avatar_url": "https://wx.qlogo.cn/mmopen/vi_32/wUMSLGCic1FOhTM5yV1Nw3S7txib7v0Fp0TPogtegNUeqvKS9t0OFxRiaqo27KgxtwReJmicUkeHl3FX2fxVVuZwmA/0",
                      "gender": 2,
                      "city": "Hangzhou",
                      "province": "Zhejiang",
                      "country": "China",
                      "language": "zh_CN",
                      "status": "NORMAL",
                      "mobile": "13588235393",
                      "email": "[email protected]",
                      "university": "杭州电子科技大学",
                      "subject": "数字媒体技术",
                      "degree": "本科",
            }        
         }
      ]      
    }
}

你可能感兴趣的:(小程序端接口需求分析)