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
a4792026
Commit
a4792026
authored
Feb 21, 2020
by
庄冰
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
policysubscribe
parent
50f173e9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
154 additions
and
3 deletions
+154
-3
center-order/app/base/api/impl/action/policy.js
+10
-0
center-order/app/base/db/impl/dbpolicy/policysubscribeDao.js
+8
-0
center-order/app/base/db/models/dbpolicy/policysubscribe.js
+29
-0
center-order/app/base/service/impl/dbpolicy/policysubscribeSve.js
+87
-0
center-order/表的更新
+20
-3
No files found.
center-order/app/base/api/impl/action/policy.js
View file @
a4792026
...
...
@@ -7,6 +7,7 @@ class PolicyAPI extends APIBase {
// this.utilsProductSve = system.getObject("service.utilsSve.utilsProductSve");
this
.
policyinfoSve
=
system
.
getObject
(
"service.dbpolicy.policyinfoSve"
);
this
.
policyneedSve
=
system
.
getObject
(
"service.dbpolicy.policyneedSve"
);
this
.
policysubscribeSve
=
system
.
getObject
(
"service.dbpolicy.policysubscribeSve"
);
}
/**
* 接口跳转-POST请求
...
...
@@ -49,6 +50,15 @@ class PolicyAPI extends APIBase {
case
"submitPolicyNeedNotes"
:
//申请信息备注提交
opResult
=
this
.
policyneedSve
.
submitPolicyNeedNotes
(
pobj
);
break
;
case
"submitPolicysubscribe"
:
//提交政策订阅
opResult
=
this
.
policysubscribeSve
.
submitPolicysubscribe
(
pobj
);
break
;
case
"delPolicysubscribe"
:
//取消政策订阅
opResult
=
this
.
policysubscribeSve
.
delPolicysubscribe
(
pobj
);
break
;
case
"getPolicysubscribeList"
:
//获取政策订阅列表
opResult
=
this
.
policysubscribeSve
.
getPolicysubscribeList
(
pobj
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
center-order/app/base/db/impl/dbpolicy/policysubscribeDao.js
0 → 100644
View file @
a4792026
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
PolicysubscribeDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
PolicysubscribeDao
));
}
}
module
.
exports
=
PolicysubscribeDao
;
center-order/app/base/db/models/dbpolicy/policysubscribe.js
0 → 100644
View file @
a4792026
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"policysubscribe"
,
{
uapp_id
:
DataTypes
.
INTEGER
,
//
openid
:
DataTypes
.
STRING
(
64
),
// 微信openid
email
:
DataTypes
.
STRING
(
255
),
// 邮箱
policyProvince
:
DataTypes
.
STRING
(
100
),
// 所属省份
releaseDate
:
DataTypes
.
DATE
,
// 发布日期
policyTypes
:
DataTypes
.
STRING
(
255
),
//
opNotes
:
DataTypes
.
STRING
,
// 备注
},
{
paranoid
:
false
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
timestamps
:
true
,
updatedAt
:
false
,
//freezeTableName: true,
// define the table's name
tableName
:
'b_policy_subscribe'
,
validate
:
{
},
indexes
:
[
]
});
}
center-order/app/base/service/impl/dbpolicy/policysubscribeSve.js
0 → 100644
View file @
a4792026
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
class
PolicysubscribeService
extends
ServiceBase
{
constructor
()
{
super
(
"dbpolicy"
,
ServiceBase
.
getDaoName
(
PolicysubscribeService
));
}
//提交政策订阅
async
submitPolicysubscribe
(
pobj
){
var
app
=
pobj
.
appInfo
;
var
obj
=
pobj
.
actionBody
;
var
paramObj
=
{
uapp_id
:
app
.
uapp_id
};
if
(
!
obj
.
openid
){
return
system
.
getResult
(
null
,
"openid不能为空"
);
}
if
(
!
obj
.
policyProvince
){
return
system
.
getResult
(
null
,
"policyProvince不能为空"
);
}
if
(
!
obj
.
policyTypes
||
obj
.
policyTypes
.
length
<
1
){
return
system
.
getResult
(
null
,
"policyTypes不能为空"
);
}
paramObj
[
"openid"
]
=
obj
.
openid
;
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
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
);
}
return
system
.
getResultSuccess
();
}
//取消政策订阅
async
delPolicysubscribe
(
pobj
){
var
app
=
pobj
.
appInfo
;
var
obj
=
pobj
.
actionBody
;
var
paramObj
=
{
uapp_id
:
app
.
uapp_id
};
if
(
!
obj
.
openid
){
return
system
.
getResult
(
null
,
"openid不能为空"
);
}
if
(
!
obj
.
policyId
){
return
system
.
getResult
(
null
,
"policyId不能为空"
);
}
await
this
.
dao
.
delete
({
id
:
obj
.
policyId
,
openid
:
obj
.
openid
,
uapp_id
:
app
.
uapp_id
});
return
system
.
getResultSuccess
();
}
//获取政策订阅列表
async
getPolicysubscribeList
(
pobj
){
var
app
=
pobj
.
appInfo
;
var
obj
=
pobj
.
actionBody
;
var
paramObj
=
{
uapp_id
:
app
.
uapp_id
};
if
(
!
obj
.
openid
){
return
system
.
getResult
(
null
,
"openid不能为空"
);
}
paramObj
[
"openid"
]
=
obj
.
openid
;
var
resList
=
await
this
.
dao
.
model
.
findAll
({
attributes
:[
"id"
,
"policyProvince"
,
"policyTypes"
,
"created_at"
],
where
:
paramObj
,
raw
:
true
});
return
system
.
getResultSuccess
(
resList
);
}
}
module
.
exports
=
PolicysubscribeService
;
\ No newline at end of file
center-order/表的更新
View file @
a4792026
示例:--
--------------------------------开始--------------------------------------------------------------------
示例:--
--------------------------------开始--------------------------------------------------------------------
...
...
@@ -55,4 +55,22 @@ CREATE TABLE `b_policy_need` (
`popularizeUserId` int(11) NULL DEFAULT NULL COMMENT '推广人id,即业务员id',
`popularizeUserCode` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '推广人帐号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
\ No newline at end of file
) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
DROP TABLE IF EXISTS `b_policy_subscribe`;
CREATE TABLE `b_policy_subscribe` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uapp_id` int(11) DEFAULT NULL,
`openid` varchar(64) DEFAULT NULL COMMENT '用户微信唯一码',
`email` varchar(255) DEFAULT NULL COMMENT '邮箱',
`policyProvince` varchar(100) DEFAULT NULL COMMENT '省份',
`policyTypes` varchar(255) DEFAULT NULL COMMENT '政策类型,多个以,隔开',
`releaseDate` datetime DEFAULT NULL COMMENT '发布日期',
`opNotes` longtext COMMENT '操作备注',
`created_at` datetime NOT NULL,
`updated_at` datetime DEFAULT NULL,
`deleted_at` datetime DEFAULT NULL,
`version` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
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