| | |
| | | const util = require("../utils/util.js") |
| | | |
| | | const originProperties = ['url', 'data', 'header', 'method', 'success', 'fail', 'complete']; |
| | | // const baseUrl = "http://192.168.0.137:8080" |
| | | // const baseUrl = "http://192.168.1.12:8080" |
| | | // const baseUrl = "https://fyami.com.cn:447" |
| | | const baseUrl = "https://fyami.com.cn" |
| | | |
| | |
| | | const baseIconUrl = `${bu}/images/weixin/eplaw/` |
| | | const baseFileUrl = `${bu}/meeting/file/` |
| | | |
| | | function request(fun) { |
| | | function request(fun, hostUrl) { |
| | | const bUrl = hostUrl ? hostUrl : baseUrl |
| | | if (fun.params != undefined) { |
| | | var param = "" |
| | | Object.keys(fun.params).forEach(key => { |
| | |
| | | } |
| | | }); |
| | | var url = fun.url |
| | | fun.url = baseUrl + url + "?" + param |
| | | fun.url = bUrl + url + "?" + param |
| | | } else { |
| | | var url = fun.url |
| | | fun.url = baseUrl + url |
| | | fun.url = bUrl + url |
| | | } |
| | | var fun1 = util.deepCopy(fun) |
| | | fun1.success = function (res) { |
| | |
| | | console.log("|--访问: ", fun.url); |
| | | console.log("|--结果: ", res); |
| | | |
| | | if (res.statusCode == 200) { |
| | | if (fun.onHead) { |
| | | fun.onHead(res.header) |
| | | } |
| | | fun.success(res.data) |
| | | } else { |
| | | fun.fail(res.statusCode) |
| | | } |
| | | // if(res.data.success) { |
| | | // var head = res.data['head'] |
| | | // if (head != undefined && fun.page != undefined) { |
| | |
| | | } |
| | | |
| | | module.exports = { |
| | | get: function (fun) { |
| | | get: function (fun, hostUrl) { |
| | | fun['method'] = 'GET' |
| | | request(fun) |
| | | request(fun, hostUrl) |
| | | }, |
| | | post: function (fun) { |
| | | post: function (fun, hostUrl) { |
| | | fun['method'] = 'POST' |
| | | request(fun) |
| | | request(fun, hostUrl) |
| | | }, |
| | | basePicUrl: basePicUrl, |
| | | baseUrl: baseUrl, |