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
511e38d3
Commit
511e38d3
authored
Mar 01, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
policysubscribe
parent
7db505e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
27 deletions
+34
-27
center-order/app/base/service/impl/dbpolicy/policysubscribeSve.js
+34
-27
No files found.
center-order/app/base/service/impl/dbpolicy/policysubscribeSve.js
View file @
511e38d3
...
...
@@ -23,35 +23,42 @@ class PolicysubscribeService extends ServiceBase {
paramObj
[
"policyProvince"
]
=
obj
.
policyProvince
;
paramObj
[
"releaseDate"
]
=
new
Date
();
// ,policyTypes:{ [this.db.Op.like]: "%" + obj.policyName + "%" }
var
oldsubscribe
=
await
this
.
dao
.
model
.
findOne
({
where
:{
openid
:
obj
.
openid
,
policyProvince
:
obj
.
policyProvince
},
raw
:
true
});
//
var oldsubscribe = await this.dao.model.findOne({
//
where:{openid:obj.openid,policyProvince:obj.policyProvince},raw:true
//
});
var
policyTypes
=
""
;
if
(
oldsubscribe
&&
oldsubscribe
.
id
){
//存在某省份的订阅数据
policyTypes
=
oldsubscribe
.
policyTypes
;
for
(
var
i
=
0
;
i
<
obj
.
policyTypes
.
length
;
i
++
){
var
pt
=
obj
.
policyTypes
[
i
];
if
(
policyTypes
.
indexOf
(
pt
)
<
0
){
policyTypes
=
policyTypes
+
","
+
pt
;
}
}
if
(
oldsubscribe
.
releaseDate
){
paramObj
[
"releaseDate"
]
=
oldsubscribe
.
releaseDate
;
}
paramObj
[
"policyTypes"
]
=
policyTypes
;
paramObj
[
"id"
]
=
oldsubscribe
.
id
;
await
this
.
dao
.
update
(
paramObj
);
}
else
{
//新的订阅数据
policyTypes
=
obj
.
policyTypes
[
0
];
for
(
var
i
=
1
;
i
<
obj
.
policyTypes
.
length
;
i
++
){
var
pt
=
obj
.
policyTypes
[
i
];
if
(
policyTypes
.
indexOf
(
pt
)
<
0
){
policyTypes
=
policyTypes
+
","
+
pt
;
}
}
paramObj
[
"policyTypes"
]
=
policyTypes
;
var
policysubscribe
=
await
this
.
dao
.
create
(
paramObj
);
policyTypes
=
obj
.
policyTypes
[
0
];
for
(
var
i
=
1
;
i
<
obj
.
policyTypes
.
length
;
i
++
){
var
pt
=
obj
.
policyTypes
[
i
];
policyTypes
=
policyTypes
+
","
+
pt
;
}
paramObj
[
"policyTypes"
]
=
policyTypes
;
var
policysubscribe
=
await
this
.
dao
.
create
(
paramObj
);
// if(oldsubscribe && oldsubscribe.id){//存在某省份的订阅数据
// policyTypes = oldsubscribe.policyTypes;
// for(var i=0;i<obj.policyTypes.length;i++){
// var pt = obj.policyTypes[i];
// if(policyTypes.indexOf(pt)<0){
// policyTypes = policyTypes+","+pt;
// }
// }
// if(oldsubscribe.releaseDate){
// paramObj["releaseDate"]=oldsubscribe.releaseDate;
// }
// paramObj["policyTypes"] = policyTypes;
// paramObj["id"] = oldsubscribe.id;
// await this.dao.update(paramObj);
// }else{//新的订阅数据
// policyTypes = obj.policyTypes[0];
// for(var i=1;i<obj.policyTypes.length;i++){
// var pt = obj.policyTypes[i];
// if(policyTypes.indexOf(pt)<0){
// policyTypes = policyTypes+","+pt;
// }
// }
// paramObj["policyTypes"] = policyTypes;
// var policysubscribe = await this.dao.create(paramObj);
// }
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