Commit f10a1c64 by 胡悦

修改设备登录接口

1 parent 86508d32
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: chenwq * @Author: chenwq
* @Date: 2020-06-16 10:40:02 * @Date: 2020-06-16 10:40:02
* @Last Modified by: huyue * @Last Modified by: huyue
* @Last Modified time: 2020-11-24 17:59:15 * @Last Modified time: 2020-11-25 14:23:16
*/ */
"use strict"; "use strict";
...@@ -45,8 +45,8 @@ ...@@ -45,8 +45,8 @@
* @Request searcher * @Request searcher
* @Response 200 response ok * @Response 200 response ok
*/ */
async searchlogin({ request: { body: { pager, searcher } } }) { async searchlogin({ request: { body: searcher } }) {
const result = await this.devicesService.searchlogin({ pager, searcher }); const result = await this.devicesService.searchlogin({ searcher });
this.ctx.body = this.ServerResponse.Success(result); this.ctx.body = this.ServerResponse.Success(result);
} }
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: chenwq * @Author: chenwq
* @Date: 2020-06-16 10:02:39 * @Date: 2020-06-16 10:02:39
* @Last Modified by: huyue * @Last Modified by: huyue
* @Last Modified time: 2020-11-24 18:14:52 * @Last Modified time: 2020-11-25 14:23:10
* 设备信息 * 设备信息
*/ */
...@@ -131,21 +131,33 @@ class DevicesService extends Service { ...@@ -131,21 +131,33 @@ class DevicesService extends Service {
* 调用后台接口 * 调用后台接口
*/ */
async searchlogin({ async searchlogin({
pager = {},
searcher = {} searcher = {}
}) { }) {
const ctx = this.ctx const ctx = this.ctx
const result = await ctx.curl('https://oss-config.test.glsx.com.cn/mock/5e87f9bda9495b066dc5010b/glsx-staging/user.loginTem', { let req = ''
dataType: 'json', for (let i in searcher) {
method: 'POST', req = req + `${i}=${searcher[i]}&`
data: { }
pager: pager, req = req.substr(0, req.length - 1)
searcher: searcher const result = await ctx.curl(`http://192.168.3.20:8099/?${req}`, {
}, dataType: 'text',
method: 'GET',
timeout: 3000, timeout: 3000,
}) })
// ctx.body = result.data let data = result.data.split('\n')
return result.data console.log('---------')
console.log(result.data, data)
let datalist = []
if (data[1]) {
// 有数据,去掉头尾
for (let i = 1; i < data.length - 1; i++) {
let [deviceno,ip,login,logoff,iccid]= data[i].split(',')
datalist.push({deviceno,ip,login,logoff,iccid})
}
} else {
datalist = []
}
return datalist
} }
} }
module.exports = DevicesService; module.exports = DevicesService;
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!