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
cced2960
Commit
cced2960
authored
Aug 17, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
template
parent
79298d8e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
14 deletions
+54
-14
gsb-marketplat/app/base/controller/impl/template/templateinfoCtl.js
+1
-1
gsb-marketplat/app/base/controller/impl/template/templatelinkCtl.js
+3
-12
gsb-marketplat/app/base/service/impl/template/templatelinkSve.js
+50
-1
No files found.
gsb-marketplat/app/base/controller/impl/template
mag
/templateinfoCtl.js
→
gsb-marketplat/app/base/controller/impl/template/templateinfoCtl.js
View file @
cced2960
...
...
@@ -5,7 +5,7 @@ var cacheBaseComp = null;
class
TemplateinfoCtl
extends
CtlBase
{
constructor
()
{
super
(
"template
infomag
"
,
CtlBase
.
getServiceName
(
TemplateinfoCtl
));
super
(
"template"
,
CtlBase
.
getServiceName
(
TemplateinfoCtl
));
this
.
templateinfoSve
=
system
.
getObject
(
'service.template.templateinfoSve'
);
}
/**
...
...
gsb-marketplat/app/base/controller/impl/template
mag
/templatelinkCtl.js
→
gsb-marketplat/app/base/controller/impl/template/templatelinkCtl.js
View file @
cced2960
...
...
@@ -5,21 +5,11 @@ var cacheBaseComp = null;
class
TemplatelinkCtl
extends
CtlBase
{
constructor
()
{
super
(
"template
infomag
"
,
CtlBase
.
getServiceName
(
TemplatelinkCtl
));
super
(
"template"
,
CtlBase
.
getServiceName
(
TemplatelinkCtl
));
this
.
templatelinkSve
=
system
.
getObject
(
'service.template.templatelinkSve'
);
}
/**
* 重写查询方法
* @param pobj
* @returns {Promise<{msg: string, data: *, bizmsg: string, status: number}>}
*/
async
findAndCountAll
(
pobj
)
{
let
result
=
await
this
.
templatelinkSve
.
findAndCountAll
(
pobj
);
return
result
;
}
/**
* 重写保存方法
* @param pobj
* @returns {Promise<void>}
...
...
@@ -34,7 +24,8 @@ class TemplatelinkCtl extends CtlBase {
* @param {*} pobj
*/
async
updateLaunchStatus
(
pobj
){
let
result
=
await
this
.
templatelinkSve
.
updateLaunchStatus
(
pobj
);
var
a
=
9
;
var
result
=
await
this
.
service
.
updateLaunchStatus
(
pobj
);
return
result
;
}
...
...
gsb-marketplat/app/base/service/impl/template/templatelinkSve.js
View file @
cced2960
...
...
@@ -48,7 +48,7 @@ class TemplatelinkService extends ServiceBase {
return
system
.
getResultFail
(
-
101
,
"模板id不能为空"
);
}
var
res
=
await
this
.
dao
.
findAndCountAll
(
obj
);
return
system
.
getResultSuccess
(
res
)
;
return
res
;
}
/**
* 校验封装参数
...
...
@@ -56,18 +56,23 @@ class TemplatelinkService extends ServiceBase {
* @param {*} xctx
*/
async
checkAndPackageParams
(
ab
,
xctx
){
var
codeParams
=
{};
if
(
!
ab
.
channel_code
){
return
system
.
getResultFail
(
-
101
,
"渠道主体编码不能为空"
);
}
codeParams
.
channel_code
=
ab
.
channel_code
;
if
(
!
ab
.
business_type_code
){
return
system
.
getResultFail
(
-
102
,
"业务类型编码不能为空"
);
}
codeParams
.
business_type_code
=
ab
.
business_type_code
;
if
(
!
ab
.
lauch_type_code
){
return
system
.
getResultFail
(
-
103
,
"投放方式编码不能为空"
);
}
codeParams
.
lauch_type_code
=
ab
.
lauch_type_code
;
if
(
!
ab
.
marketing_subject_code
){
return
system
.
getResultFail
(
-
104
,
"营销主体编码不能为空"
);
}
codeParams
.
marketing_subject_code
=
ab
.
marketing_subject_code
;
if
(
!
ab
.
channel_name
){
return
system
.
getResultFail
(
-
105
,
"渠道主体名称不能为空"
);
}
...
...
@@ -92,6 +97,10 @@ class TemplatelinkService extends ServiceBase {
if
(
!
ab
.
name
){
return
system
.
getResultFail
(
-
112
,
"任务名称不能为空"
);
}
var
checkCodeRes
=
await
this
.
checkLinkCodeParams
(
codeParams
);
if
(
checkCodeRes
&&
checkCodeRes
.
status
&&
checkCodeRes
.
status
<
0
){
return
checkCodeRes
;
}
if
(
!
ab
.
code
){
//新增
ab
.
code
=
await
this
.
getBusUid
(
"tl"
);
ab
.
user_id
=
ab
.
userid
;
...
...
@@ -218,12 +227,24 @@ class TemplatelinkService extends ServiceBase {
if
(
ab
.
is_enabled
!==
0
&&
ab
.
is_enabled
!==
1
){
return
system
.
getResultFail
(
-
103
,
"投放状态参数错误"
);
}
var
linkinfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
code
:
ab
.
code
},
raw
:
true
});
if
(
!
linkinfo
||
!
linkinfo
.
id
){
return
system
.
getResultFail
(
-
300
,
"未知链接"
);
}
if
(
ab
.
is_enabled
===
1
){
var
checkLinkCodeParamsObj
=
{
channel_code
:
linkinfo
.
channel_code
,
lauch_type_code
:
linkinfo
.
lauch_type_code
,
marketing_subject_code
:
linkinfo
.
marketing_subject_code
};
var
checkLinkCodeParamsRes
=
await
this
.
checkLinkCodeParams
(
checkLinkCodeParamsObj
);
if
(
checkLinkCodeParamsRes
&&
checkLinkCodeParamsRes
.
status
&&
checkLinkCodeParamsRes
.
status
<
0
){
return
checkLinkCodeParamsRes
;
}
}
await
this
.
dao
.
update
({
id
:
linkinfo
.
id
,
is_enabled
:
ab
.
is_enabled
});
return
system
.
getResultSuccess
();
}
...
...
@@ -324,5 +345,32 @@ class TemplatelinkService extends ServiceBase {
return
system
.
getResultSuccess
(
resultObj
);
}
//校验链接编码参数
async
checkLinkCodeParams
(
obj
){
var
channelinfo
=
await
this
.
launchchannelDao
.
model
.
findOne
({
attributes
:[
"id"
],
where
:{
code
:
obj
.
channel_code
},
raw
:
true
});
if
(
!
channelinfo
||
!
channelinfo
.
id
){
return
system
.
getResultFail
(
-
120
,
"操作失败,渠道不存在或已被修改"
);
}
var
lauchtype
=
await
this
.
launchtypeDao
.
model
.
findOne
({
attributes
:[
"id"
],
where
:{
code
:
obj
.
lauch_type_code
},
raw
:
true
});
if
(
!
lauchtype
||
!
lauchtype
.
id
){
return
system
.
getResultFail
(
-
121
,
"操作失败,投放类型不存在或已被修改"
);
}
var
marketingsubject
=
await
this
.
marketingsubjectDao
.
model
.
findOne
({
attributes
:[
"id"
],
where
:{
code
:
obj
.
marketing_subject_code
},
raw
:
true
});
if
(
!
marketingsubject
||
!
marketingsubject
.
id
){
return
system
.
getResultFail
(
-
121
,
"操作失败,投放主体不存在或已被修改"
);
}
return
system
.
getResultSuccess
();
}
}
module
.
exports
=
TemplatelinkService
;
\ No newline at end of file
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