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
028a42f7
Commit
028a42f7
authored
Aug 21, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template
parent
facc8784
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
4 deletions
+25
-4
gsb-marketplat/app/base/api/api.base.js
+15
-1
gsb-marketplat/app/base/db/models/template/templateinfo.js
+1
-1
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
+9
-2
No files found.
gsb-marketplat/app/base/api/api.base.js
View file @
028a42f7
const
system
=
require
(
"../system"
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
settings
=
require
(
"../../config/settings"
);
const
sha256
=
require
(
'sha256'
);
class
APIBase
{
constructor
()
{
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
this
.
logClient
=
system
.
getObject
(
"util.logClient"
);
this
.
queryAction
=
[
"getTemplateAndLinkInfo"
];
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
async
setContextParams
(
pobj
,
qobj
,
req
)
{
let
custtags
=
req
.
headers
[
"x-consumetag"
]
?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
)
:
null
;
...
...
@@ -36,12 +39,23 @@ class APIBase {
}
async
doexec
(
gname
,
methodname
,
pobj
,
query
,
req
)
{
try
{
var
shaStr
=
await
sha256
(
JSON
.
stringify
(
pobj
));
//查询缓存
if
(
pobj
&&
pobj
.
actionType
&&
this
.
queryAction
.
indexOf
(
pobj
.
actionType
)
>=
0
)
{
var
cacheRes
=
await
this
.
redisClient
.
get
(
shaStr
);
if
(
cacheRes
)
{
// return JSON.parse(cacheRes);
}
}
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
if
(
xarg
&&
xarg
[
0
]
<
0
)
{
return
system
.
getResultFail
(...
xarg
);
}
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
this
.
logClient
.
log
(
pobj
,
req
,
rtn
)
this
.
logClient
.
log
(
pobj
,
req
,
rtn
);
if
(
rtn
&&
rtn
.
status
==
0
){
await
this
.
redisClient
.
setWithEx
(
shaStr
,
JSON
.
stringify
(
rtn
),
300
);
}
return
rtn
;
}
catch
(
e
)
{
this
.
logClient
.
log
(
pobj
,
req
,
null
,
e
.
stack
);
...
...
gsb-marketplat/app/base/db/models/template/templateinfo.js
View file @
028a42f7
...
...
@@ -14,7 +14,7 @@ module.exports = (db, DataTypes) => {
describe
:
DataTypes
.
STRING
,
pic_url
:
DataTypes
.
STRING
,
is_enabled
:
DataTypes
.
INTEGER
,
template_content
:
DataTypes
.
JSON
,
template_content
:
DataTypes
.
TEXT
,
form_id
:
DataTypes
.
INTEGER
,
business_code
:
DataTypes
.
STRING
,
notes
:
DataTypes
.
STRING
,
...
...
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
View file @
028a42f7
...
...
@@ -112,7 +112,7 @@ class TemplateinfoService extends ServiceBase {
if
(
!
ab
.
code
){
return
system
.
getResultFail
(
-
101
,
"模板编码不能为空"
);
}
if
(
!
ab
.
hasOwnProperty
(
"template_content"
)
){
if
(
!
ab
.
template_content
){
return
system
.
getResultFail
(
-
102
,
"模板内容不能为空"
);
}
//根据模板编码获取模板信息
...
...
@@ -205,6 +205,13 @@ class TemplateinfoService extends ServiceBase {
return
system
.
getResultSuccess
();
}
async
update
(
qobj
,
tm
=
null
)
{
// 获取模板对应模板链接,并删除其redis缓存
if
(
qobj
&&
qobj
.
id
){
this
.
delRedisInfoByLinkByTempId
(
qobj
.
id
);
}
return
this
.
dao
.
update
(
qobj
,
tm
);
}
/**
...
...
@@ -221,7 +228,7 @@ class TemplateinfoService extends ServiceBase {
if
(
!
ab
.
code
){
return
system
.
getResultFail
(
-
101
,
"模板编码不能为空"
);
}
if
(
!
ab
.
hasOwnProperty
(
"template_content"
)
){
if
(
!
ab
.
template_content
){
return
system
.
getResultFail
(
-
102
,
"模板内容不能为空"
);
}
// 获取对应模板
...
...
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