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
3a9ffb59
Commit
3a9ffb59
authored
Aug 07, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
temp
parent
ee4040ef
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
4 deletions
+57
-4
gsb-marketplat/app/base/api/impl/action/template.js
+7
-0
gsb-marketplat/app/base/db/dao.base.js
+4
-1
gsb-marketplat/app/base/db/models/template/templateinfo.js
+2
-1
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
+44
-2
No files found.
gsb-marketplat/app/base/api/impl/action/template.js
View file @
3a9ffb59
...
...
@@ -25,6 +25,7 @@ class Template extends APIBase {
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
var
self
=
this
;
pobj
.
xctx
=
req
.
xctx
;
switch
(
action_type
)
{
case
"test"
:
//测试
opResult
=
system
.
getResultSuccess
(
"测试接口"
);
...
...
@@ -32,6 +33,12 @@ class Template extends APIBase {
case
"createTemplate"
:
//创建模板
opResult
=
await
this
.
templateinfoSve
.
createTemplate
(
pobj
);
break
;
case
"findAndCountAll"
:
//模板列表查询
opResult
=
await
this
.
templateinfoSve
.
findAndCountAll
(
pobj
.
actionBody
);
break
;
case
"editTemplateTdk"
:
//编辑模板TDK
opResult
=
await
this
.
templateinfoSve
.
editTemplateTdk
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
gsb-marketplat/app/base/db/dao.base.js
View file @
3a9ffb59
...
...
@@ -102,7 +102,7 @@ class Dao {
if
(
search
)
{
Object
.
keys
(
search
).
forEach
(
k
=>
{
// console.log(search[k], ":search[k]search[k]search[k]");
if
(
search
[
k
]
&&
search
[
k
]
!=
'undefined'
&&
search
[
k
]
!=
""
)
{
if
(
(
search
[
k
]
&&
search
[
k
]
!=
'undefined'
&&
search
[
k
]
!=
""
)
||
search
[
k
]
===
0
)
{
if
((
k
.
indexOf
(
"Date"
)
>=
0
||
k
.
indexOf
(
"_at"
)
>=
0
))
{
if
(
search
[
k
]
!=
""
&&
search
[
k
])
{
var
stdate
=
new
Date
(
search
[
k
][
0
]);
...
...
@@ -110,6 +110,9 @@ class Dao {
qc
.
where
[
k
]
=
{
[
this
.
db
.
Op
.
between
]:
[
stdate
,
enddate
]
};
}
}
else
if
(
k
.
indexOf
(
"is_enabled"
)
>=
0
)
{
qc
.
where
[
k
]
=
search
[
k
];
}
else
if
(
k
.
indexOf
(
"id"
)
>=
0
)
{
qc
.
where
[
k
]
=
search
[
k
];
}
...
...
gsb-marketplat/app/base/db/models/template/templateinfo.js
View file @
3a9ffb59
...
...
@@ -12,13 +12,14 @@ module.exports = (db, DataTypes) => {
title
:
DataTypes
.
STRING
,
keyword
:
DataTypes
.
STRING
,
describe
:
DataTypes
.
STRING
,
link
_url
:
DataTypes
.
STRING
,
pic
_url
:
DataTypes
.
STRING
,
is_enabled
:
DataTypes
.
INTEGER
,
template_content
:
DataTypes
.
STRING
,
form_id
:
DataTypes
.
INTEGER
,
notes
:
DataTypes
.
STRING
,
user_id
:
DataTypes
.
STRING
(
100
),
user_name
:
DataTypes
.
STRING
(
100
),
//user_name 用户名称
company_id
:
DataTypes
.
INTEGER
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
gsb-marketplat/app/base/service/impl/template/templateinfoSve.js
View file @
3a9ffb59
...
...
@@ -5,14 +5,55 @@ class TemplateinfoService extends ServiceBase {
constructor
()
{
super
(
"common"
,
ServiceBase
.
getDaoName
(
TemplateinfoService
));
}
/**
* 创建模板
* @param {*} pobj
*/
async
createTemplate
(
pobj
){
var
ab
=
pobj
.
actionBody
;
var
code
=
await
this
.
getBusUid
(
"tp"
);
var
xctx
=
pobj
.
xctx
;
var
code
=
await
this
.
getBusUid
(
"mt"
);
var
name
=
"营销模板"
;
ab
.
code
=
code
;
ab
.
name
=
name
;
ab
.
user_id
=
xctx
.
credid
;
ab
.
user_name
=
xctx
.
username
;
ab
.
company_id
=
xctx
.
companyid
;
ab
.
is_enabled
=
0
;
return
this
.
create
(
ab
);
}
async
editTemplateTdk
(
pobj
){
var
ab
=
pobj
.
actionBody
;
var
xctx
=
pobj
.
xctx
;
if
(
!
ab
){
return
system
.
getResultFail
(
-
100
,
"参数错误"
);
}
if
(
!
ab
.
code
){
return
system
.
getResultFail
(
-
101
,
"模板编码不能为空"
);
}
if
(
!
ab
.
title
){
return
system
.
getResultFail
(
-
102
,
"网页标题不能为空"
);
}
if
(
!
ab
.
keyword
){
return
system
.
getResultFail
(
-
103
,
"关键词不能为空"
);
}
if
(
!
ab
.
pic_url
){
return
system
.
getResultFail
(
-
104
,
"网页图标不能为空"
);
}
if
(
!
ab
.
describe
){
return
system
.
getResultFail
(
-
105
,
"描述不能为空"
);
}
var
templateInfo
=
await
this
.
dao
.
model
.
findOne
({
where
:{
code
:
ab
.
code
},
raw
:
true
});
if
(
!
templateInfo
||
!
templateInfo
.
id
){
return
system
.
getResultFail
(
-
300
,
"未知模板"
);
}
ab
.
id
=
templateInfo
.
id
;
await
this
.
dao
.
update
(
ab
);
return
system
.
getResultSuccess
();
}
}
module
.
exports
=
TemplateinfoService
;
\ 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