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
4a85a274
Commit
4a85a274
authored
May 14, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
f001b4c8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
108 additions
and
28 deletions
+108
-28
center-channel/app/base/api/impl/action/tmTransaction.js
+7
-4
center-channel/app/base/api/impl/auth/taskapi.js
+39
-23
center-channel/app/base/db/dao.base.js
+32
-1
center-channel/app/base/service/impl/common/pushlogSve.js
+29
-0
center-channel/app/config/localsettings.js
+1
-0
No files found.
center-channel/app/base/api/impl/action/tmTransaction.js
View file @
4a85a274
...
...
@@ -3,6 +3,7 @@ var system = require("../../../system");
class
TmTransactionAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
pushlogSve
=
system
.
getObject
(
"service.common.pushlogSve"
);
}
/**
* 接口跳转-POST请求
...
...
@@ -14,20 +15,22 @@ class TmTransactionAPI extends WEBBase {
if
(
!
pobj
.
actionProcess
)
{
return
system
.
getResult
(
null
,
"actionProcess参数不能为空"
);
}
if
(
!
pobj
.
action
_t
ype
)
{
if
(
!
pobj
.
action
T
ype
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
.
actionProcess
,
pobj
.
actionType
,
pobj
.
actionBody
,
req
);
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
action_process
,
action_type
,
action_body
,
req
)
{
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
// sy
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
null
,
"测试成功"
);
break
;
case
"addPushContent"
:
//添加推送信息
opResult
=
await
this
.
pushlogSve
.
addPublicServiceLog
(
pobj
,
req
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-channel/app/base/api/impl/auth/taskapi.js
View file @
4a85a274
...
...
@@ -39,6 +39,7 @@ class AccessAuthAPI extends APIBase {
if
(
result
.
status
!=
0
||
!
result
.
data
||
result
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"push data is empty"
);
}
var
self
=
this
;
for
(
let
index
=
0
;
index
<
result
.
data
.
length
;
index
++
)
{
const
element
=
result
.
data
[
index
];
if
(
element
)
{
...
...
@@ -46,12 +47,12 @@ class AccessAuthAPI extends APIBase {
contentData
.
id
=
element
.
id
;
contentData
.
pushNumber
=
element
.
pushNumber
+
1
;
if
(
element
.
failType
==
1
)
{
this
.
taskAgainPushOneOldBusInfo
(
contentData
);
self
.
taskAgainPushOneOldBusInfo
(
contentData
);
}
else
if
(
element
.
failType
==
2
)
{
this
.
taskAgainPushOneNewBusInfo
(
contentData
);
self
.
taskAgainPushOneNewBusInfo
(
contentData
);
}
else
if
(
element
.
failType
==
4
)
{
this
.
taskAgainFqPushInfo
(
contentData
);
self
.
taskAgainFqPushInfo
(
contentData
);
}
//FQ
}
}
...
...
@@ -59,26 +60,41 @@ class AccessAuthAPI extends APIBase {
}
async
taskPushPublicService
(
pobj
,
qobj
,
req
)
{
// var result = await this.pushlogSve.getFailLogList();
// if (result.status != 0 || !result.data || result.data.length == 0) {
// return system.getResult(null, "push data is empty");
// }
// for (let index = 0; index < result.data.length; index++) {
// const element = result.data[index];
// if (element) {
// var contentData = JSON.parse(element.content);
// contentData.id = element.id;
// contentData.pushNumber = element.pushNumber + 1;
// if (element.failType == 1) {
// this.taskAgainPushOneOldBusInfo(contentData);
// }
// else if (element.failType == 2) {
// this.taskAgainPushOneNewBusInfo(contentData);
// } else if (element.failType == 4) {
// this.taskAgainFqPushInfo(contentData);
// }//FQ
// }
// }
var
result
=
await
this
.
pushlogSve
.
getPublicServiceLogList
();
if
(
result
.
status
!=
0
||
!
result
.
data
||
result
.
data
.
length
==
0
)
{
return
system
.
getResult
(
null
,
"PushPublicService data is empty"
);
}
var
self
=
this
;
for
(
let
index
=
0
;
index
<
result
.
data
.
length
;
index
++
)
{
const
element
=
result
.
data
[
index
];
if
(
element
&&
element
.
pushUrl
)
{
var
contentData
=
JSON
.
parse
(
element
.
pushContent
);
var
opResult
=
await
self
.
restPostUrl
(
contentData
,
element
.
pushUrl
);
if
((
!
opResult
&&
opResult
.
status
!=
0
)
||
opResult
.
code
!=
1
)
{
var
tmpPobj
=
{
actionBody
:
{
uapp_key
:
element
.
appkey
,
pushUrl
:
element
.
pushUrl
,
pushContent
:
contentData
,
pushNumber
:
element
.
pushNumber
+
1
}
}
self
.
pushlogSve
.
addPublicServiceLog
(
tmpPobj
,
{
clientIp
:
element
.
clientIp
});
}
else
{
self
.
logCtl
.
info
({
appid
:
""
,
appkey
:
element
.
appkey
,
requestId
:
req
.
requestId
||
""
,
op
:
req
.
classname
,
content
:
contentData
,
clientIp
:
element
.
clientIp
,
agent
:
req
.
uagent
,
optitle
:
"推送公共服务:PushPublicService Success"
,
});
}
self
.
pushlogSve
.
delPublicServiceLog
(
element
.
id
);
}
}
return
system
.
getResultSuccess
();
}
...
...
center-channel/app/base/db/dao.base.js
View file @
4a85a274
...
...
@@ -184,7 +184,38 @@ class Dao {
var
result
=
this
.
db
.
query
(
sql
,
tmpParas
);
return
result
;
}
async
customInsert
(
sql
,
paras
,
t
)
{
var
tmpParas
=
null
;
if
(
t
&&
t
!=
'undefined'
)
{
if
(
paras
==
null
||
paras
==
'undefined'
)
{
tmpParas
=
{
type
:
this
.
db
.
QueryTypes
.
INSERT
};
tmpParas
.
transaction
=
t
;
}
else
{
tmpParas
=
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
INSERT
};
tmpParas
.
transaction
=
t
;
}
}
else
{
tmpParas
=
paras
==
null
||
paras
==
'undefined'
||
paras
.
keys
==
0
?
{
type
:
this
.
db
.
QueryTypes
.
INSERT
}
:
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
INSERT
};
}
var
result
=
this
.
db
.
query
(
sql
,
tmpParas
);
return
result
;
}
async
customDelete
(
sql
,
paras
,
t
)
{
var
tmpParas
=
null
;
if
(
t
&&
t
!=
'undefined'
)
{
if
(
paras
==
null
||
paras
==
'undefined'
)
{
tmpParas
=
{
type
:
this
.
db
.
QueryTypes
.
DELETE
};
tmpParas
.
transaction
=
t
;
}
else
{
tmpParas
=
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
DELETE
};
tmpParas
.
transaction
=
t
;
}
}
else
{
tmpParas
=
paras
==
null
||
paras
==
'undefined'
||
paras
.
keys
==
0
?
{
type
:
this
.
db
.
QueryTypes
.
DELETE
}
:
{
replacements
:
paras
,
type
:
this
.
db
.
QueryTypes
.
DELETE
};
}
var
result
=
this
.
db
.
query
(
sql
,
tmpParas
);
return
result
;
}
async
customUpdate
(
sql
,
paras
,
t
)
{
var
tmpParas
=
null
;
if
(
t
&&
t
!=
'undefined'
)
{
...
...
center-channel/app/base/service/impl/common/pushlogSve.js
View file @
4a85a274
...
...
@@ -50,5 +50,34 @@ class PushlogService extends ServiceBase {
var
result
=
system
.
getResultSuccess
(
list
);
return
result
;
}
async
addPublicServiceLog
(
pobj
,
req
)
{
var
sql
=
"INSERT INTO `igirl_api`.`center_channel_public_servicelog` (`appkey`,`pushUrl`,`pushContent`,`pushNumber`,`clientIp`,created_at)"
+
"VALUES(:appkey,:pushUrl,:pushContent,:pushNumber,:clientIp,:created_at)"
;
var
params
=
{
appkey
:
pobj
.
appInfo
?
pobj
.
appInfo
.
uapp_key
||
""
:
""
,
pushUrl
:
pobj
.
actionBody
.
pushUrl
,
pushContent
:
JSON
.
stringify
(
pobj
.
actionBody
.
pushContent
),
pushNumber
:
pobj
.
actionBody
.
pushNumber
||
0
,
clientIp
:
req
.
clientIp
||
""
,
created_at
:
new
Date
()
}
await
this
.
pushfaillogDao
.
customInsert
(
sql
,
params
);
return
system
.
getResultSuccess
();
}
async
delPublicServiceLog
(
id
)
{
var
sql
=
"DELETE FROM `center_channel_public_servicelog` WHERE id=:id"
;
var
params
=
{
id
:
id
}
await
this
.
pushfaillogDao
.
customDelete
(
sql
,
params
);
return
system
.
getResultSuccess
();
}
async
getPublicServiceLogList
()
{
var
sql
=
"SELECT id,appkey,`pushUrl`,pushContent,pushNumber,clientIp FROM `center_channel_public_servicelog` WHERE pushNumber<10 LIMIT 200"
;
var
list
=
await
this
.
pushfaillogDao
.
customQuery
(
sql
);
var
result
=
system
.
getResultSuccess
(
list
);
return
result
;
}
}
module
.
exports
=
PushlogService
;
center-channel/app/config/localsettings.js
View file @
4a85a274
...
...
@@ -23,6 +23,7 @@ var settings = {
debug
:
false
,
dialectOptions
:
{
requestTimeout
:
999999
,
// timezone: '+8:00'
// instanceName:'DEV'
}
//设置MSSQL超时时间
}
...
...
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