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
ab6a9800
Commit
ab6a9800
authored
Aug 08, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
模板接口
parent
d466837c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
5 deletions
+21
-5
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
+21
-5
No files found.
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
View file @
ab6a9800
...
@@ -15,10 +15,10 @@ class TemplateinfoService extends ServiceBase {
...
@@ -15,10 +15,10 @@ class TemplateinfoService extends ServiceBase {
* @param {*} pobj
* @param {*} pobj
*/
*/
async
createTemplate
(
pobj
){
async
createTemplate
(
pobj
){
var
ab
=
pobj
.
actionBody
;
var
ab
=
{}
;
var
xctx
=
pobj
.
xctx
;
var
xctx
=
pobj
.
xctx
;
var
code
=
await
this
.
getBusUid
(
"mt"
);
var
code
=
await
this
.
getBusUid
(
"mt"
);
//自动生成模板编码
var
name
=
"营销模板"
;
var
name
=
"营销模板"
;
//模板名称
ab
.
code
=
code
;
ab
.
code
=
code
;
ab
.
name
=
name
;
ab
.
name
=
name
;
ab
.
user_id
=
xctx
.
credid
;
ab
.
user_id
=
xctx
.
credid
;
...
@@ -28,6 +28,11 @@ class TemplateinfoService extends ServiceBase {
...
@@ -28,6 +28,11 @@ class TemplateinfoService extends ServiceBase {
var
res
=
await
this
.
create
(
ab
);
var
res
=
await
this
.
create
(
ab
);
return
system
.
getResultSuccess
(
res
);
return
system
.
getResultSuccess
(
res
);
}
}
/**
* 根据模板编码获取模板信息
* 编辑模板时使用此接口
* @param {*} pobj
*/
async
findOneByCode
(
pobj
){
async
findOneByCode
(
pobj
){
var
ab
=
pobj
.
actionBody
;
var
ab
=
pobj
.
actionBody
;
var
xctx
=
pobj
.
xctx
;
var
xctx
=
pobj
.
xctx
;
...
@@ -58,6 +63,7 @@ class TemplateinfoService extends ServiceBase {
...
@@ -58,6 +63,7 @@ class TemplateinfoService extends ServiceBase {
if
(
!
ab
.
hasOwnProperty
(
"template_content"
)){
if
(
!
ab
.
hasOwnProperty
(
"template_content"
)){
return
system
.
getResultFail
(
-
102
,
"模板内容不能为空"
);
return
system
.
getResultFail
(
-
102
,
"模板内容不能为空"
);
}
}
//根据模板编码获取模板信息
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
code
:
ab
.
code
},
raw
:
true
where
:{
code
:
ab
.
code
},
raw
:
true
});
});
...
@@ -98,8 +104,13 @@ class TemplateinfoService extends ServiceBase {
...
@@ -98,8 +104,13 @@ class TemplateinfoService extends ServiceBase {
await
this
.
dao
.
update
({
id
:
templateInfo
.
id
,
is_enabled
:
ab
.
is_enabled
});
await
this
.
dao
.
update
({
id
:
templateInfo
.
id
,
is_enabled
:
ab
.
is_enabled
});
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
/**
* 编辑模板tdk信息
* @param {*} pobj
*/
async
editTemplateTdk
(
pobj
){
async
editTemplateTdk
(
pobj
){
var
ab
=
pobj
.
actionBody
;
var
ab
=
pobj
.
actionBody
;
var
updateObj
=
{};
var
xctx
=
pobj
.
xctx
;
var
xctx
=
pobj
.
xctx
;
if
(
!
ab
){
if
(
!
ab
){
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
...
@@ -110,23 +121,28 @@ class TemplateinfoService extends ServiceBase {
...
@@ -110,23 +121,28 @@ class TemplateinfoService extends ServiceBase {
if
(
!
ab
.
title
){
if
(
!
ab
.
title
){
return
system
.
getResultFail
(
-
102
,
"网页标题不能为空"
);
return
system
.
getResultFail
(
-
102
,
"网页标题不能为空"
);
}
}
updateObj
.
title
=
ab
.
title
;
if
(
!
ab
.
keyword
){
if
(
!
ab
.
keyword
){
return
system
.
getResultFail
(
-
103
,
"关键词不能为空"
);
return
system
.
getResultFail
(
-
103
,
"关键词不能为空"
);
}
}
updateObj
.
keyword
=
ab
.
keyword
;
if
(
!
ab
.
pic_url
){
if
(
!
ab
.
pic_url
){
return
system
.
getResultFail
(
-
104
,
"网页图标不能为空"
);
return
system
.
getResultFail
(
-
104
,
"网页图标不能为空"
);
}
}
updateObj
.
pic_url
=
ab
.
pic_url
;
if
(
!
ab
.
describe
){
if
(
!
ab
.
describe
){
return
system
.
getResultFail
(
-
105
,
"描述不能为空"
);
return
system
.
getResultFail
(
-
105
,
"描述不能为空"
);
}
}
updateObj
.
describe
=
ab
.
describe
;
//根据模板编码获取模板信息
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
code
:
ab
.
code
},
raw
:
true
where
:{
code
:
ab
.
code
},
raw
:
true
});
});
if
(
!
templateInfo
||
!
templateInfo
.
id
){
if
(
!
templateInfo
||
!
templateInfo
.
id
){
return
system
.
getResultFail
(
-
300
,
"未知模板"
);
return
system
.
getResultFail
(
-
300
,
"未知模板"
);
}
}
ab
.
id
=
templateInfo
.
id
;
updateObj
.
id
=
templateInfo
.
id
;
await
this
.
dao
.
update
(
ab
);
await
this
.
dao
.
update
(
updateObj
);
return
system
.
getResultSuccess
();
return
system
.
getResultSuccess
();
}
}
...
...
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