Commit 8e0b2768 by wkliang

test curl

parent 66e730cb
...@@ -74,6 +74,14 @@ class RejAPI extends APIBase { ...@@ -74,6 +74,14 @@ class RejAPI extends APIBase {
} }
} }
async testpost() {
try {
console.log('into')
return await this.rejcbSve.testpost()
} catch (error) {
}
}
classDesc () { classDesc () {
return { return {
groupName: "auth", groupName: "auth",
......
...@@ -5,6 +5,7 @@ class RejcbService extends ServiceBase { ...@@ -5,6 +5,7 @@ class RejcbService extends ServiceBase {
super() super()
this.tcDao = system.getObject('db.rejreex.trademarkcaseDao') this.tcDao = system.getObject('db.rejreex.trademarkcaseDao')
this.bcDao = system.getObject('db.common.bcdataDao') this.bcDao = system.getObject('db.common.bcdataDao')
this.restClient = system.getObject("util.restClient")
this.isTest = true this.isTest = true
} }
...@@ -171,5 +172,17 @@ class RejcbService extends ServiceBase { ...@@ -171,5 +172,17 @@ class RejcbService extends ServiceBase {
async initStatus () { async initStatus () {
return await this.tcDao.model.update({ rejStatus: "待提报" }, { where: { caseId: { [this.db.Op.like]: `%TESTCB%` } } }) return await this.tcDao.model.update({ rejStatus: "待提报" }, { where: { caseId: { [this.db.Op.like]: `%TESTCB%` } } })
} }
async testpost () {
console.log('into')
let url = 'https://gsb-zc.oss-cn-beijing.aliyuncs.com/zc_word2picb2bcb9fc564ef2a1f4b3cbe9352f39.jpg'
let res = await this.restClient.execGet(null, url)
if(res) {
console.log('1 ')
} else {
console.log(' 2')
}
return res
}
} }
module.exports = RejcbService; module.exports = RejcbService;
...@@ -93,9 +93,27 @@ class RestClient { ...@@ -93,9 +93,27 @@ class RestClient {
return result; return result;
} }
async execGet (subData, url) { async execGet (subData, url) {
let cmd = this.FetchGetCmd(subData, url); console.log(settings.env)
var result = await this.exec(cmd); if (settings.env == 'dev') {
return result; try {
console.log('get ??')
const rs = await axios.get(url);
console.log('rs --', rs , ' type --', typeof rs)
const ret = {
stdout: JSON.stringify(rs.data)
}
return ret;
} catch (error) {
console.log(error.response.status)
}
}
try {
let cmd = this.FetchGetCmd(subData, url);
var result = await this.exec(cmd);
return result;
} catch (error) {
}
} }
async execGet2 (subData, url) { async execGet2 (subData, url) {
var data = querystring.stringify(subData); var data = querystring.stringify(subData);
...@@ -106,6 +124,7 @@ class RestClient { ...@@ -106,6 +124,7 @@ class RestClient {
async execPost (subData, url) { async execPost (subData, url) {
if (settings.env == 'dev') { if (settings.env == 'dev') {
const rs = await axios.post(url, subData); const rs = await axios.post(url, subData);
console.log(rs)
const ret = { const ret = {
stdout: JSON.stringify(rs.data) stdout: JSON.stringify(rs.data)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment