api文档.md 17 KB

接口文档


  • 接口方法扩展方便。只需要在接口IApiLogic中添加方法,完善各个版本实现即可。
  • 支持多版本并行。只需要实现接口IApiLogic,集成上一个版本,将需要修改的方法重写即可。
  • 支持接口开关、黑名单、版本控制功能。
  • 支持接口登陆验证以及验证开关。
  • 系统管理-》参数配置中,配置API.PARAM.ENCRYPT改为true,加入参数加密
  • 系统管理-》参数配置中,配置API.LOGIN.VALID改为true,加入登陆验证
  • 系统管理-》用户管理中,配置API账号密码,类型选择API用户,查看页面查看秘钥

接口使用说明


  • 公共请求参数
String apiNo; // 接口码,匹配输出输入
Integer pageNo; // 页数
Integer pageSize; // 页码
String method; // 方法名
String version; // 版本
String apiUser; // 调用用户
String time; //  时间戳,年月日时分秒
String checkSum; // 校验和
String p; // 参数,需要先base64加密,再进行URL编码,编码格式使用utf-8

加密URLEncoder.encode(Base64.encode(p),"UTF-8"); 解密URLDecoder.decode(Base64.decode(p),"utf-8")

  • 参数说明及示例
1. 访问必须携带版本号
/api?version=1.0.0

2. 以下两种访问方式效果相同,建议使用第二种方法
/api/action?version=1.0.1&apiNo=1000000&pageNo=1&pageSize=1&method=pageArticleSite&time=20170314160401&p={siteId:1}
与
/api/action/pageArticleSite?version=1.0.1&apiNo=1000000&pageNo=1&pageSize=1&time=20170314160401&p={siteId:1}

3. 分页有默认值pageNo=1,pageSize=20

4. 登陆验证功能说明
> 1)通过login接口进行登陆,获取key。
> 2)其他接口调用需要携带两个公共请求参数:apiUser为用户名,checkSum为登陆接口返回key。
> 3)如果退出调用logout接口。

5. p为json参数,携带我们接口想要的自定义参数。
p={siteId:1,test:"ok"}
  • 文档说明
暂无

接口


测试接口

  • 接口说明:测试
  • 请求方式: GET/POST
  • 请求地址:/api
  • 请求参数
  • 示例
/api?version=1.0.0
  • 返回结果
{
    data: {
        notice: "api is ok!"
    },
    code: 0,
    msg: "success"
}

调试接口

  • 接口说明:开关调试日志
  • 请求方式: GET/POST
  • 请求地址:/api/debug
  • 请求参数
  • 示例
/api/debug?version=1.0.0&apiNo=1000000&time=20170314160401
  • 返回结果
{
    data: {
        debug: true
    },
    code: 0,
    msg: "success"
}

登陆接口

  • 接口说明:获取配置信息
  • 请求方式: GET/POST
  • 请求地址:/api/action/login
  • 请求参数
username:用户名
password:密码
checkMoveId:滑动验证码ID
code:偏移量
  • 示例
/api/action/login?version=1.0.1&apiNo=1000000&time=20170314160401&p={username:"admin",password:"123"}
  • 返回结果
{
    data: {
        key: "oTkt"
    },
    code: 0,
    msg: "success"
}

登出接口

  • 接口说明:获取配置信息
  • 请求方式: GET/POST
  • 请求地址:/api/action/logout
  • 请求参数
  • 示例
/api/action/logout?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=admin&checkSum=YBrs
  • 返回结果
{
    data: {
        r: "ok"
    },
    code: 0,
    msg: "success"
}

登陆用户信息

  • 接口说明:获取配置信息
  • 请求方式: GET/POST
  • 请求地址:/api/user/info
  • 请求参数
/api/user/info?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=vFpUNO
checkSum:登陆token
apiUser:用户名
  • 返回结果 { "apiNo": "1000000", "msg": "success", "code": 0, "data": { "realName": "test", "userName": "test", "remaker": null, "titleUrl": null, "userType": 5 //2:运营部管理员 5:客户 } }

获取滑动验证码

  • 接口说明:获取滑动验证码
  • 请求方式: GET
  • 请求地址:/api/verify_code/getImageVerifyCode
  • 请求参数
/api/verify_code/getImageVerifyCode?version=1.0.1&apiNo=1000000&time=20170314160401
  • 返回结果 ```



### 订单相关



#### 分页获取订单列表

- 接口说明:获取订单列表

- 请求方式: **_GET_**

- 请求地址:**_/api/order/list_**

- 请求参数

/api/order/list?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=KsSBYv&pageNo=0&pageSize=15&p={"consumerName":"/linbenlei/nanyangnet/blob/dev/platform/doc/api文档.md#","orderNumber":"采购订单202006231592878528"}


consumerName:商品名称 orderNumber:订单编号


- 返回结果

  ```json
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": {
          "totalRow": 6,
          "pageNumber": 1,
          "lastPage": true,
          "firstPage": true,
          "totalPage": 1,
          "pageSize": 15,
          "list": [
              {
                  "update_time": "2020-06-23 11:01:07",
                  "commodity_number": 55,
                  "consumer_name": "aaaaa",
                  "receipt_number": null,
                  "commodity_id": 14,
                  "create_id": 4,
                  "create_time": "2020-06-23 10:15:28",
                  "order_number": "采购订单202006231592878528",
                  "active": true,
                  "id": 10,
                  "status": "RECEIVE_GOODS",
                  "commodity_name": "ceshi5"
              }
          ]
      }
  }

订单详情

  • 接口说明:获取订单详情

  • 请求方式: GET

  • 请求地址:/api/order/info

  • 请求参数

  • 返回结果

  /api/order/info/9?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=KsSBYv
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": {
          "contract_no": "",
          "total_number": 100,
          "create_time": "2020-07-07 11:02:17",
          "order_number": "CJ-202007071594090949",
          "active": true,
          "commodityList": [
              {
                  "number": 10,
                  "consumer_name": null,
                  "create_time": "2020-06-23 17:17:07",
                  "create_id": 4,
                  "price": "50",
                  "name": "运动鞋",
                  "id": 22,
                  "info": "女士运动鞋"
            },
              {
                  "number": 10,
                  "consumer_name": null,
                  "create_time": "2020-06-23 17:18:15",
                  "create_id": 4,
                  "price": "1.1",
                  "name": "中性笔",
                  "id": 23,
                  "info": "黑色"
              },
              {
                  "number": 30,
                  "consumer_name": null,
                  "create_time": "2020-06-23 17:20:34",
                  "create_id": 4,
                  "price": "3.2",
                  "name": "笔记本",
                  "id": 24,
                  "info": "大中小"
              },
              {
                  "number": 50,
                  "consumer_name": null,
                  "create_time": "2020-06-23 17:37:28",
                  "create_id": 4,
                  "price": "0.12",
                  "name": "打印纸",
                  "id": 25,
                  "info": "50箱打印纸"
              }
          ],
          "update_time": "2020-07-07 15:34:57",
          "consumer_name": "aaaaa",
          "receipt_number": null,
          "commodity_id": null,
          "create_id": 4,
          "id": 82,
          "total_money": "613.0",
          "status": "CREATE"
      }
  }

修改订单状态

  • 接口说明: 修改订单状态

  • 请求方式: __

  • 请求地址:/api/order/changestatus_

  • 请求参数

  /api/order/change_status/9
  {
       "receipt_number":["这里是采购合同发票数组","这里是采购合同发票数组","这里是采购合同发票数组"]
  }
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": null
  }

添加订单

  • 接口说明: 添加订单

  • 请求方式: post

  • 请求地址:/api/order/add

  • 请求参数

  /api/order/add?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=rMuFuY
  {
       "commoditys":[
                       {
                            "id":19,
                            "number":11
                       }, {
                            "id":20,
                            "number":12
                       }
        ],
      "consumer_name":"乐金",
      "contract_no":"123321321321321"
  }
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": null
  }

修改订单

  • 接口说明: 修改订单

  • 请求方式: post

  • 请求地址:/api/order/edit

  • 请求参数

  /api/order/edit/9?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=rMuFuY
  {
       "commodityIds":[1,2,3,4,5],
       "consumer_name":"乐金"
  }
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": null
  }

删除订单

  • 接口说明: 修改订单

  • 请求方式: get

  • 请求地址:api/order/delete/7

  • 请求参数

  /api/order/delete/7?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=rMuFuY
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": null
  }

商品相关

分页获取商品列表

  • 接口说明: 分页获取商品列表

  • 请求方式: get

  • 请求地址:/api/commodity/list

  • 请求参数

  api/commodity/list?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=BoeOfD&pageNo=0&pageSize=15&p={"name":"1"}
  name:商品名称
  • 返回结果
  {
        "msg": "success",
        "apiNo": "1000000",
        "code": 0,
        "data": {
            "totalRow": 1,
            "pageNumber": 1,
            "lastPage": true,
            "firstPage": true,
            "totalPage": 1,
            "pageSize": 15,
            "list": [
                {
                    "number": 11,
                    "consumer_name": "乐金",
                    "create_time": "2020-06-22 09:50:00",
                    "create_id": 1,
                    "name": "1111",
                    "id": 1
                }
            ]
        }
    }

商品列表

  • 接口说明: 获取商品列表

  • 请求方式: get

  • 请求地址:/api/commodity/option

  • 请求参数

  api/commodity/option?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=BoeOfD&p={"name":"1"}
  name:商品名称
  order_id:当前订单Id
  type: 不传/use 排除已使用,all 全部

  • 返回结果
  {
        "msg": "success",
        "apiNo": "1000000",
        "code": 0,
        "data": {
            "totalRow": 1,
            "pageNumber": 1,
            "lastPage": true,
            "firstPage": true,
            "totalPage": 1,
            "pageSize": 15,
            "list": [
                {
                    "number": 11,
                    "consumer_name": "乐金",
                    "create_time": "2020-06-22 09:50:00",
                    "create_id": 1,
                    "name": "1111",
                    "id": 1
                }
            ]
        }
    }

添加商品

  • 接口说明: 获取商品列表

  • 请求方式:POST

  • 请求地址:/api/commodity/add

  • 请求参数

   /api/commodity/add?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=BoeOfD
  {
      "name":"1111",
      "number":10,
      "price":1.25
  }
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

修改商品

  • 接口说明: 获取商品列表

  • 请求方式: POST

  • 请求地址:/api/commodity/edit

  • 请求参数

   /api/commodity/edit?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=BoeOfD
  {
      "name":"1111",
      "number":10,
      "price":12.5,
      "id":1
  }
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

删除商品

  • 接口说明: 获取商品列表

  • 请求方式: POST

  • 请求地址:/api/commodity/option

  • 请求参数

  /api/commodity/delete/1?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=BoeOfD
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

客户相关

客户列表

  • 接口说明: 获取客户列表

  • 请求方式: GET\

  • 请求地址:/api/user/list\

  • 请求参数

  /api/user/list?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI&pageNo=0&pageSize=100
  keyword:客户名称/客户账号
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": {
          "totalRow": 9,
          "pageNumber": 1,
          "lastPage": true,
          "firstPage": true,
          "totalPage": 1,
          "pageSize": 100,
          "list": [
              {
                  "create_time": "2020-07-02 10:25:44",
                  "tel": null,
                  "userid": 27,
                  "email": null,
                  "username": "likai123",
                  "realname": "李凯"
              }
          ]
      }
  }

添加客户

  • 接口说明: 添加客戶

  • 请求方式: POST\

  • 请求地址:/api/user/add\

  • 请求参数

  api/user/add?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI
  {
      "username": "zxcasd",  
      "password": "123456",
      "realname": "刘德华1",
      "remake":""
  }
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

修改客户

  • 接口说明: 修改客户

  • 请求方式: POST\

  • 请求地址:/api/user/edit\

  • 请求参数

  api/user/edit/29?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI
  {
      "username": "zxcasd",  
      "password": "654321",
      "realname": "刘德华2",
      "remake":""
  }
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

删除客户

  • 接口说明: 修改客户

  • 请求方式: GET\

  • 请求地址:/api/user/delete\

  • 请求参数

  api/user/delete/29?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI
  • 返回结果
  {
      "msg": "success",
      "apiNo": "1000000",
      "code": 0,
      "data": null
  }

客户详情

  • 接口说明: 客户详情

  • 请求方式: GET\

  • 请求地址:/api/user/get_info\

  • 请求参数

  api/user/get_info/29?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI

  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": {
          "realName": "李凯",
          "userType": 5,
          "userName": "李凯",
          "remaker": null,
          "userId": 27,
          "titleUrl": null
      }
  }

客户列表

  • 接口说明: 客户列表

  • 请求方式: GET\

  • 请求地址:/api/user/options\

  • 请求参数

  api/user/options?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI
  realName:客户名称
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": {
          "realName": "李凯",
          "userType": 5,
          "userName": "liaki",
          "remaker": null,
          "userId": 27,
          "titleUrl": null
      }
  }

修改密码

  • 接口说明: 客户列表

  • 请求方式: POST\

  • 请求地址:/api/user/update_password\

  • 请求参数

  api/user/update_password/27?version=1.0.1&apiNo=1000000&time=20170314160401&apiUser=test&checkSum=lNTrpI
  {
    "password":"123321"

  }
  • 返回结果
  {
      "apiNo": "1000000",
      "msg": "success",
      "code": 0,
      "data": {
          "realName": "李凯",
          "userType": 5,
          "userName": "liaki",
          "remaker": null,
          "userId": 27,
          "titleUrl": null
      }
  }