Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
4253173a
Commit
4253173a
authored
Apr 01, 2021
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
渠道增加
parent
1b34e4d4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
11 deletions
+61
-11
igirl-channel/app/base/service/impl/trademark/tmquerySve.js
+27
-5
igirl-channel/app/base/utils/execClient.js
+34
-6
No files found.
igirl-channel/app/base/service/impl/trademark/tmquerySve.js
View file @
4253173a
...
@@ -49,70 +49,87 @@ class TmqueryService {
...
@@ -49,70 +49,87 @@ class TmqueryService {
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
var
resultTmpSign
=
md5
(
resultSignStr
).
toUpperCase
();
return
system
.
getResultSuccess
(
resultTmpSign
);
return
system
.
getResultSuccess
(
resultTmpSign
);
}
}
async
findTrademarkNameAccurate
(
queryobj
,
req
)
{
//通过商标名来进行精准查询
async
findTrademarkNameAccurate
(
queryobj
,
req
)
{
//通过商标名来进行精准查询
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkNameAccurate"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkNameAccurate"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
findTrademarkNameIndex
(
queryobj
,
req
)
{
//根据商标名称模糊查询,首次查询,
async
findTrademarkNameIndex
(
queryobj
,
req
)
{
//根据商标名称模糊查询,首次查询,
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkNameIndex"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkNameIndex"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
findTrademarkName
(
queryobj
,
req
)
{
//根据商标名称模糊查询
async
findTrademarkName
(
queryobj
,
req
)
{
//根据商标名称模糊查询
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkName"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkName"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
findTrademarkzchAccurate
(
queryobj
,
req
)
{
//通过商标号来进行精准查询
async
findTrademarkzchAccurate
(
queryobj
,
req
)
{
//通过商标号来进行精准查询
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkzchAccurate"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkzchAccurate"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
findTrademarkzcr
(
queryobj
,
req
)
{
//通过注册人模糊查询
async
findTrademarkzcr
(
queryobj
,
req
)
{
//通过注册人模糊查询
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkzcr"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findTrademarkzcr"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
imagequery
(
queryobj
,
req
)
{
//图像检索
async
imagequery
(
queryobj
,
req
)
{
//图像检索
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/imagequery"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/imagequery"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
findImageSearch
(
queryobj
,
req
)
{
//图像检索查询,
async
findImageSearch
(
queryobj
,
req
)
{
//图像检索查询,
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findImageSearch"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/findImageSearch"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
tradeMarkDetail
(
queryobj
,
req
)
{
//商标详情
async
tradeMarkDetail
(
queryobj
,
req
)
{
//商标详情
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/tradeMarkDetail"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/tradeMarkDetail"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
sbzuixinsearch
(
queryobj
,
req
)
{
async
sbzuixinsearch
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/sbzuixinsearch"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/sbzuixinsearch"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
noticequeryTMZCSQ
(
queryobj
,
req
)
{
async
noticequeryTMZCSQ
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticequeryTMZCSQ"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticequeryTMZCSQ"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
noticequery
(
queryobj
,
req
)
{
async
noticequery
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticequery"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticequery"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
noticezcggsearch
(
queryobj
,
req
)
{
async
noticezcggsearch
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticezcggsearch"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticezcggsearch"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
noticesearch
(
queryobj
,
req
)
{
async
noticesearch
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticesearch"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/noticesearch"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
getCompanyInfoNoUser
(
queryobj
,
req
)
{
async
getCompanyInfoNoUser
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/getCompanyInfoNoUser"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/getCompanyInfoNoUser"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
getNclDetail
(
queryobj
,
req
)
{
async
getNclDetail
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/getNclDetail"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/getNclDetail"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
gettwoNcl
(
queryobj
,
req
)
{
async
gettwoNcl
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/gettwoNcl"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/gettwoNcl"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
}
}
async
nclFuwuSearch
(
queryobj
,
req
)
{
async
nclFuwuSearch
(
queryobj
,
req
)
{
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/nclFuwuSearch"
;
var
url
=
this
.
zcApiUrl
+
"api/trademark/tmqueryApi/nclFuwuSearch"
;
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
return
await
this
.
opReqResult
(
url
,
queryobj
,
req
);
...
@@ -130,7 +147,7 @@ class TmqueryService {
...
@@ -130,7 +147,7 @@ class TmqueryService {
*/
*/
let
failOrders
=
[];
let
failOrders
=
[];
try
{
try
{
const
data
=
await
this
.
execClient
.
execPos
t
({
const
data
=
await
this
.
execClient
.
execPostTimeOu
t
({
"query"
:
{
"query"
:
{
"bool"
:
{
"bool"
:
{
"must"
:
[
"must"
:
[
...
@@ -150,7 +167,7 @@ class TmqueryService {
...
@@ -150,7 +167,7 @@ class TmqueryService {
"created_at"
:
"desc"
"created_at"
:
"desc"
}
}
]
]
},
`
${
this
.
reqEsAddr
}
bigdata_zc_op_log/_search`
);
},
`
${
this
.
reqEsAddr
}
bigdata_zc_op_log/_search`
,
20000
);
let
result
=
data
.
stdout
;
let
result
=
data
.
stdout
;
result
=
JSON
.
parse
(
result
);
result
=
JSON
.
parse
(
result
);
result
=
result
.
hits
.
hits
;
result
=
result
.
hits
.
hits
;
...
@@ -201,7 +218,8 @@ class TmqueryService {
...
@@ -201,7 +218,8 @@ class TmqueryService {
}
//工商产品订单
}
//工商产品订单
let
reqUrl
=
this
.
channelApiUrl
+
"/action/tmOrder/springBoard"
;
let
reqUrl
=
this
.
channelApiUrl
+
"/action/tmOrder/springBoard"
;
let
rtn
=
await
this
.
execClient
.
execPushDataPost
(
param
,
reqUrl
,
tokenInfo
.
data
.
token
,
req
.
headers
[
"request-id"
]);;
let
rtn
=
await
this
.
execClient
.
execPushDataPost
(
param
,
reqUrl
,
tokenInfo
.
data
.
token
,
req
.
headers
[
"request-id"
]);
;
if
(
!
rtn
||
!
rtn
.
stdout
)
{
if
(
!
rtn
||
!
rtn
.
stdout
)
{
failOrders
.
push
(
failOrders
.
push
(
{
{
...
@@ -225,7 +243,7 @@ class TmqueryService {
...
@@ -225,7 +243,7 @@ class TmqueryService {
)
)
}
}
}
}
return
{
successOrders
:
buildResult
,
failOrders
};
return
{
successOrders
:
buildResult
,
failOrders
};
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
error
)
console
.
log
(
error
)
return
system
.
getResultFail
(
-
200
,
"操作error"
);
return
system
.
getResultFail
(
-
200
,
"操作error"
);
...
@@ -235,7 +253,10 @@ class TmqueryService {
...
@@ -235,7 +253,10 @@ class TmqueryService {
async
getToken
()
{
async
getToken
()
{
var
reqTokenUrl
=
this
.
channelApiUrl
+
"/auth/accessAuth/getToken"
;
var
reqTokenUrl
=
this
.
channelApiUrl
+
"/auth/accessAuth/getToken"
;
var
reqParam
=
{};
var
reqParam
=
{};
var
rtn
=
await
this
.
execClient
.
execPost
({
appkey
:
"201911251551"
,
secret
:
"56006077354d48858026c80c0e10bef6"
},
reqTokenUrl
);
var
rtn
=
await
this
.
execClient
.
execPost
({
appkey
:
"201911251551"
,
secret
:
"56006077354d48858026c80c0e10bef6"
},
reqTokenUrl
);
if
(
!
rtn
.
stdout
)
{
if
(
!
rtn
.
stdout
)
{
return
system
.
getResult
(
null
,
"获取token失败"
);
return
system
.
getResult
(
null
,
"获取token失败"
);
}
}
...
@@ -247,4 +268,5 @@ class TmqueryService {
...
@@ -247,4 +268,5 @@ class TmqueryService {
}
}
}
}
module
.
exports
=
TmqueryService
;
module
.
exports
=
TmqueryService
;
igirl-channel/app/base/utils/execClient.js
View file @
4253173a
...
@@ -2,6 +2,7 @@ var childproc = require('child_process');
...
@@ -2,6 +2,7 @@ var childproc = require('child_process');
const
util
=
require
(
'util'
);
const
util
=
require
(
'util'
);
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
exec
=
util
.
promisify
(
require
(
'child_process'
).
exec
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
uuidv4
=
require
(
'uuid/v4'
);
class
ExecClient
{
class
ExecClient
{
constructor
()
{
constructor
()
{
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
this
.
cmdPostPattern
=
"curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}"
;
...
@@ -10,30 +11,33 @@ class ExecClient {
...
@@ -10,30 +11,33 @@ class ExecClient {
this
.
cmdDataPostByTokenUserPinPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'userpin:{UPIN}' -d '{data}' {url}"
;
this
.
cmdDataPostByTokenUserPinPattern
=
"curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'userpin:{UPIN}' -d '{data}' {url}"
;
}
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
return
u
;
}
}
async
exec
(
cmd
)
{
async
exec
(
cmd
)
{
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//await后面表达式返回的promise对象,是then的语法糖,await返回then函数的返回值
//异常需要try/catch自己捕获或外部catch捕获
//异常需要try/catch自己捕获或外部catch捕获
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
);
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
);
return
{
stdout
,
stderr
};
return
{
stdout
,
stderr
};
}
}
async
exec2
(
cmd
)
{
async
exec2
(
cmd
)
{
return
exec
(
cmd
,
{
encoding
:
"base64"
});
return
exec
(
cmd
,
{
encoding
:
"base64"
});
}
}
FetchPostCmd
(
subData
,
url
)
{
FetchPostCmd
(
subData
,
url
)
{
var
data
=
JSON
.
stringify
(
subData
);
var
data
=
JSON
.
stringify
(
subData
);
var
cmd
=
this
.
cmdPostPattern
.
replace
(
/
\{
data
\}
/g
,
var
cmd
=
this
.
cmdPostPattern
.
replace
(
/
\{
data
\}
/g
,
data
).
replace
(
/
\{
url
\}
/g
,
url
);
data
).
replace
(
/
\{
url
\}
/g
,
url
);
console
.
log
(
cmd
);
console
.
log
(
cmd
,
"cmd......................................"
);
return
cmd
;
return
cmd
;
}
}
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
)
{
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
)
{
var
requestId
=
requestId
||
this
.
getUUID
();
var
requestId
=
requestId
||
this
.
getUUID
();
var
data
=
JSON
.
stringify
(
subData
);
var
data
=
JSON
.
stringify
(
subData
);
...
@@ -42,6 +46,7 @@ class ExecClient {
...
@@ -42,6 +46,7 @@ class ExecClient {
console
.
log
(
cmd
);
console
.
log
(
cmd
);
return
cmd
;
return
cmd
;
}
}
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
)
{
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
)
{
var
data
=
JSON
.
stringify
(
subData
);
var
data
=
JSON
.
stringify
(
subData
);
var
cmd
=
this
.
cmdDataPostByTokenUserPinPattern
.
replace
(
/
\{
data
\}
/g
,
var
cmd
=
this
.
cmdDataPostByTokenUserPinPattern
.
replace
(
/
\{
data
\}
/g
,
...
@@ -49,21 +54,43 @@ class ExecClient {
...
@@ -49,21 +54,43 @@ class ExecClient {
console
.
log
(
cmd
);
console
.
log
(
cmd
);
return
cmd
;
return
cmd
;
}
}
async
execPost
(
subData
,
url
)
{
async
execPost
(
subData
,
url
)
{
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
var
result
=
await
this
.
exec
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
return
result
;
}
}
/**
* 带超时时间的post请求
* @param {*} params 请求数据-json格式
* @param {*} url 请求地址
* @param {*} ContentType 请求头类型,默认application/json
* @param {*} headData 请求头内容-json格式,如:请求头中传递token,格式:{token:"9098902q849q0434q09439"}
* @param {*} timeOut 超时时间设置,单位秒
*/
async
execPostTimeOut
(
params
,
url
,
timeOut
=
5000
)
{
let
cmd
=
this
.
FetchPostCmd
(
params
,
url
);
let
options
=
{
timeout
:
timeOut
,
maxBuffer
:
1024
*
1024
*
20
};
let
result
=
await
this
.
exec
(
cmd
,
options
);
return
result
;
}
async
execPushDataPost
(
subData
,
url
,
token
,
requestId
)
{
async
execPushDataPost
(
subData
,
url
,
token
,
requestId
)
{
let
cmd
=
this
.
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
);
let
cmd
=
this
.
FetchPushDataPostCmd
(
subData
,
url
,
token
,
requestId
);
var
result
=
await
this
.
exec
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
return
result
;
}
}
async
execDataPostByTokenUserPin
(
subData
,
url
,
token
,
userPin
)
{
async
execDataPostByTokenUserPin
(
subData
,
url
,
token
,
userPin
)
{
let
cmd
=
this
.
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
);
let
cmd
=
this
.
execDataPostByTokenUserPinCmd
(
subData
,
url
,
token
,
userPin
);
var
result
=
await
this
.
exec
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
return
result
;
}
}
async
execPost2
(
subData
,
url
)
{
async
execPost2
(
subData
,
url
)
{
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
let
cmd
=
this
.
FetchPostCmd
(
subData
,
url
);
var
result
=
await
this
.
exec2
(
cmd
);
var
result
=
await
this
.
exec2
(
cmd
);
...
@@ -83,6 +110,7 @@ class ExecClient {
...
@@ -83,6 +110,7 @@ class ExecClient {
var
result
=
await
this
.
exec
(
cmd
);
var
result
=
await
this
.
exec
(
cmd
);
return
result
;
return
result
;
}
}
async
execGet2
(
subData
,
url
)
{
async
execGet2
(
subData
,
url
)
{
let
cmd
=
this
.
FetchGetCmd
(
subData
,
url
);
let
cmd
=
this
.
FetchGetCmd
(
subData
,
url
);
console
.
log
(
cmd
);
console
.
log
(
cmd
);
...
@@ -96,8 +124,8 @@ class ExecClient {
...
@@ -96,8 +124,8 @@ class ExecClient {
var
options
=
{
var
options
=
{
timeout
:
timeOut
,
timeout
:
timeOut
,
};
};
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
const
{
stdout
,
stderr
}
=
await
exec
(
cmd
,
options
);
return
{
stdout
,
stderr
};
return
{
stdout
,
stderr
};
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment