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
11d23aab
Commit
11d23aab
authored
Aug 18, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/gsb-marketplat' into gsb-marketplat
parents
93a60318
215c7e00
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
81 additions
and
16 deletions
+81
-16
gsb-marketplat/app/base/controller/impl/template/templateinfoCtl.js
+13
-0
gsb-marketplat/app/base/db/models/configmag/formsubmitrecord.js
+3
-1
gsb-marketplat/app/base/db/models/template/templateinfo.js
+1
-0
gsb-marketplat/app/base/service/impl/configmag/formsubmitrecordSve.js
+12
-2
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
+35
-1
gsb-marketplat/app/base/system.js
+1
-1
gsb-marketplat/app/base/utils/logClient.js
+16
-11
No files found.
gsb-marketplat/app/base/controller/impl/template/templateinfoCtl.js
View file @
11d23aab
...
@@ -33,6 +33,19 @@ class TemplateinfoCtl extends CtlBase {
...
@@ -33,6 +33,19 @@ class TemplateinfoCtl extends CtlBase {
return
result
;
return
result
;
}
}
/**
/**
* 根据id获取模板信息
* @param {*} pobj
*/
async
getTemplateInfoById
(
pobj
){
let
result
=
await
this
.
templateinfoSve
.
getTemplateInfoById
(
pobj
);
return
result
;
}
async
setTemplateBusinessId
(
pobj
){
let
result
=
await
this
.
templateinfoSve
.
setTemplateBusinessId
(
pobj
);
return
result
;
}
/**
* 重写保存方法
* 重写保存方法
* @param pobj
* @param pobj
* @returns {Promise<void>}
* @returns {Promise<void>}
...
...
gsb-marketplat/app/base/db/models/configmag/formsubmitrecord.js
View file @
11d23aab
...
@@ -6,13 +6,15 @@
...
@@ -6,13 +6,15 @@
*/
*/
module
.
exports
=
(
db
,
DataTypes
)
=>
{
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"formsubmitrecord"
,
{
return
db
.
define
(
"formsubmitrecord"
,
{
template_id
:
DataTypes
.
INTEGER
(
11
),
///模板id
business_code
:
DataTypes
.
STRING
(
100
),
template_id
:
DataTypes
.
INTEGER
(
11
),
//模板id
templatelink_id
:
DataTypes
.
INTEGER
(
11
),
//模板链接id
templatelink_id
:
DataTypes
.
INTEGER
(
11
),
//模板链接id
form_id
:
DataTypes
.
INTEGER
(
11
),
//表单id
form_id
:
DataTypes
.
INTEGER
(
11
),
//表单id
record_status
:
DataTypes
.
STRING
(
60
),
//记录状态 1未读 2已读 3无效
record_status
:
DataTypes
.
STRING
(
60
),
//记录状态 1未读 2已读 3无效
record_status_name
:
DataTypes
.
STRING
(
60
),
//记录状态名称
record_status_name
:
DataTypes
.
STRING
(
60
),
//记录状态名称
templatelink_snapshot
:
DataTypes
.
JSON
,
//模板链接快照
templatelink_snapshot
:
DataTypes
.
JSON
,
//模板链接快照
record_content
:
DataTypes
.
JSON
,
//记录内容
record_content
:
DataTypes
.
JSON
,
//记录内容
push_status
:
DataTypes
.
INTEGER
,
//推送状态 0:未推送,1:已推送 2:异常
},
{
},
{
paranoid
:
true
,
//假的删除
paranoid
:
true
,
//假的删除
underscored
:
true
,
underscored
:
true
,
...
...
gsb-marketplat/app/base/db/models/template/templateinfo.js
View file @
11d23aab
...
@@ -16,6 +16,7 @@ module.exports = (db, DataTypes) => {
...
@@ -16,6 +16,7 @@ module.exports = (db, DataTypes) => {
is_enabled
:
DataTypes
.
INTEGER
,
is_enabled
:
DataTypes
.
INTEGER
,
template_content
:
DataTypes
.
JSON
,
template_content
:
DataTypes
.
JSON
,
form_id
:
DataTypes
.
INTEGER
,
form_id
:
DataTypes
.
INTEGER
,
business_code
:
DataTypes
.
STRING
,
notes
:
DataTypes
.
STRING
,
notes
:
DataTypes
.
STRING
,
user_id
:
DataTypes
.
STRING
(
100
),
user_id
:
DataTypes
.
STRING
(
100
),
user_name
:
DataTypes
.
STRING
(
100
),
//user_name 用户名称
user_name
:
DataTypes
.
STRING
(
100
),
//user_name 用户名称
...
...
gsb-marketplat/app/base/service/impl/configmag/formsubmitrecordSve.js
View file @
11d23aab
...
@@ -32,7 +32,17 @@ class FormsubmitrecordService extends ServiceBase {
...
@@ -32,7 +32,17 @@ class FormsubmitrecordService extends ServiceBase {
where
:{
code
:
ab
.
link_code
},
raw
:
true
where
:{
code
:
ab
.
link_code
},
raw
:
true
});
});
if
(
!
linkInfo
||
!
linkInfo
.
id
){
if
(
!
linkInfo
||
!
linkInfo
.
id
){
return
system
.
getResultFail
(
-
300
,
"未知模板链接"
)
return
system
.
getResultFail
(
-
300
,
"未知模板链接"
);
}
if
(
!
linkInfo
.
template_id
){
return
system
.
getResultFail
(
-
301
,
"链接模板信息错误"
)
}
var
templateinfo
=
await
this
.
templateinfoDao
.
model
.
findOne
{
where
:{
id
:
linkInfo
.
template_id
},
raw
:
true
,
attributes
:[
"id"
,
"business_code"
]
};
if
(
!
templateinfo
||
!
templateinfo
.
id
){
return
system
.
getResultFail
(
-
500
,
"未知模板信息"
);
}
}
//获取表单信息
//获取表单信息
var
forminfo
=
await
this
.
forminfoDao
.
model
.
findOne
({
var
forminfo
=
await
this
.
forminfoDao
.
model
.
findOne
({
...
@@ -55,7 +65,7 @@ class FormsubmitrecordService extends ServiceBase {
...
@@ -55,7 +65,7 @@ class FormsubmitrecordService extends ServiceBase {
template_id
:
linkInfo
.
template_id
,
templatelink_id
:
linkInfo
.
id
,
template_id
:
linkInfo
.
template_id
,
templatelink_id
:
linkInfo
.
id
,
form_id
:
forminfo
.
id
,
record_status
:
1
,
templatelink_snapshot
:
linkInfo
,
form_id
:
forminfo
.
id
,
record_status
:
1
,
templatelink_snapshot
:
linkInfo
,
form_snapshot
:{
forminfo
:
forminfo
,
formitems
:
formitems
},
form_snapshot
:{
forminfo
:
forminfo
,
formitems
:
formitems
},
record_content
:
params
record_content
:
params
,
business_code
:
templateinfo
.
business_code
}
}
await
this
.
dao
.
create
(
addObj
);
//创建记录
await
this
.
dao
.
create
(
addObj
);
//创建记录
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
...
...
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
View file @
11d23aab
...
@@ -48,6 +48,36 @@ class TemplateinfoService extends ServiceBase {
...
@@ -48,6 +48,36 @@ class TemplateinfoService extends ServiceBase {
});
});
return
system
.
getResultSuccess
(
templateInfo
);
return
system
.
getResultSuccess
(
templateInfo
);
}
}
async
getTemplateInfoById
(
pobj
){
var
ab
=
pobj
;
if
(
!
ab
){
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
if
(
!
ab
.
id
){
return
system
.
getResultFail
(
-
101
,
"模板ID不能为空"
);
}
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
id
:
ab
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
(
templateInfo
);
}
async
setTemplateBusinessId
(
pobj
){
var
ab
=
pobj
;
if
(
!
ab
){
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
if
(
!
ab
.
id
){
return
system
.
getResultFail
(
-
101
,
"模板ID不能为空"
);
}
if
(
!
ab
.
business_code
){
return
system
.
getResultFail
(
-
102
,
"商品ID不能为空"
);
}
await
this
.
dao
.
update
({
id
:
ab
.
id
,
business_code
:
ab
.
business_code
});
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
id
:
ab
.
id
},
raw
:
true
});
return
system
.
getResultSuccess
(
templateInfo
);
}
/**
/**
* 根据模板编码获取模板信息(模板调用)
* 根据模板编码获取模板信息(模板调用)
* 编辑模板时使用此接口
* 编辑模板时使用此接口
...
@@ -92,7 +122,11 @@ class TemplateinfoService extends ServiceBase {
...
@@ -92,7 +122,11 @@ class TemplateinfoService extends ServiceBase {
// if(templateInfo.is_enabled===1){
// if(templateInfo.is_enabled===1){
// return system.getResultFail(-301,"该模板正在使用中,不能执行此操作");
// return system.getResultFail(-301,"该模板正在使用中,不能执行此操作");
// }
// }
await
this
.
dao
.
update
({
id
:
templateInfo
.
id
,
template_content
:
ab
.
template_content
});
var
updateObj
=
{
id
:
templateInfo
.
id
,
template_content
:
ab
.
template_content
};
if
(
ab
.
form_id
){
updateObj
[
"form_id"
]
=
ab
.
form_id
;
}
await
this
.
dao
.
update
(
updateObj
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
/**
/**
...
...
gsb-marketplat/app/base/system.js
View file @
11d23aab
...
@@ -75,7 +75,7 @@ class System {
...
@@ -75,7 +75,7 @@ class System {
},
},
body
:
data
body
:
data
},
function
(
error
,
response
,
body
)
{
},
function
(
error
,
response
,
body
)
{
rtn
.
statusCode
=
response
.
statusCode
rtn
.
statusCode
=
response
&&
response
.
statusCode
?
response
.
statusCode
:
""
;
if
(
!
error
)
{
if
(
!
error
)
{
if
(
body
)
{
if
(
body
)
{
rtn
.
data
=
body
rtn
.
data
=
body
...
...
gsb-marketplat/app/base/utils/logClient.js
View file @
11d23aab
...
@@ -11,18 +11,23 @@ class LogClient {
...
@@ -11,18 +11,23 @@ class LogClient {
return
u
;
return
u
;
}
}
async
log
(
pobj
,
req
,
rtninfo
,
errinfo
)
{
async
log
(
pobj
,
req
,
rtninfo
,
errinfo
)
{
rtninfo
.
requestId
=
this
.
getUUID
()
try
{
req
.
params
.
param
=
pobj
rtninfo
.
requestId
=
this
.
getUUID
()
//第三个字段应该存公司id
req
.
params
.
param
=
pobj
system
.
execLogs
(
settings
.
appname
+
"_"
+
req
.
xctx
.
codetitle
,
req
.
params
,
"_"
+
pobj
.
company_id
+
"_"
,
rtninfo
,
errinfo
).
then
(
res
=>
{
//第三个字段应该存公司id
if
(
res
&&
res
.
status
==
1
)
{
system
.
execLogs
(
settings
.
appname
+
"_"
+
req
.
xctx
.
codetitle
,
req
.
params
,
"_"
+
pobj
.
company_id
+
"_"
,
rtninfo
,
errinfo
).
then
(
res
=>
{
console
.
log
(
"log.....success"
)
if
(
res
&&
res
.
status
==
1
)
{
}
else
{
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
console
.
log
(
"log.....fail"
)
}
})
}).
catch
(
e
=>
{
}
catch
(
error
)
{
console
.
log
(
"log.....fail"
)
console
.
log
(
error
);
})
}
}
}
}
}
module
.
exports
=
LogClient
;
module
.
exports
=
LogClient
;
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