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
35b4bdf5
Commit
35b4bdf5
authored
Oct 13, 2020
by
任晓松
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
常用联系人、申请人
parent
11977b6a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
153 additions
and
0 deletions
+153
-0
center-order/app/base/api/impl/action/tmOrder.js
+13
-0
center-order/app/base/db/impl/dbcorder/usuallycontactsDao.js
+23
-0
center-order/app/base/db/models/dbcorder/usuallycontacts.js
+25
-0
center-order/app/base/service/impl/dbcorder/usuallycontactsSve.js
+92
-0
No files found.
center-order/app/base/api/impl/action/tmOrder.js
View file @
35b4bdf5
...
@@ -5,6 +5,7 @@ class OrderAPI extends APIBase {
...
@@ -5,6 +5,7 @@ class OrderAPI extends APIBase {
constructor
()
{
constructor
()
{
super
();
super
();
this
.
orderinfoSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
this
.
orderinfoSve
=
system
.
getObject
(
"service.dbcorder.orderinfoSve"
);
this
.
usuallycontactsSve
=
system
.
getObject
(
"service.dbcorder.usuallycontactsSve"
);
}
}
/**
/**
* 接口跳转-POST请求
* 接口跳转-POST请求
...
@@ -33,6 +34,18 @@ class OrderAPI extends APIBase {
...
@@ -33,6 +34,18 @@ class OrderAPI extends APIBase {
case
"getAllNcl"
:
case
"getAllNcl"
:
opResult
=
await
this
.
orderinfoSve
.
getAllNcl
(
pobj
);
opResult
=
await
this
.
orderinfoSve
.
getAllNcl
(
pobj
);
break
;
break
;
case
"addUsuallyContacts"
:
//增加常用联系人,申请人
opResult
=
await
this
.
usuallycontactsSve
.
addContacts
(
pobj
,
pobj
.
actionBody
);
break
;
case
"delUsuallyContacts"
:
//删除常用联系人,申请人
opResult
=
await
this
.
usuallycontactsSve
.
delContacts
(
pobj
,
pobj
.
actionBody
);
break
;
case
"updateUsuallyContacts"
:
//修改常用联系人,申请人
opResult
=
await
this
.
usuallycontactsSve
.
updateContacts
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getUsuallyContacts"
:
//查询常用联系人,申请人
opResult
=
await
this
.
usuallycontactsSve
.
getContacts
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
break
;
...
...
center-order/app/base/db/impl/dbcorder/usuallycontactsDao.js
0 → 100644
View file @
35b4bdf5
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
UsuallyContactsDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
UsuallyContactsDao
));
}
async
getItemByOrderNo
(
orderNo
,
uapp_id
)
{
return
await
this
.
model
.
findOne
({
where
:
{
sourceOrderNo
:
orderNo
},
attributes
:
[
"id"
,
"contactName"
,
"mobile"
,
"tel"
,
"email"
,
"fax"
],
raw
:
true
});
}
}
module
.
exports
=
UsuallyContactsDao
;
center-order/app/base/db/models/dbcorder/usuallycontacts.js
0 → 100644
View file @
35b4bdf5
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"usuallycontacts"
,
{
uapp_id
:
DataTypes
.
INTEGER
,
//
channel_user_id
:
DataTypes
.
STRING
,
contact_name
:
DataTypes
.
STRING
,
contacts_content
:
DataTypes
.
JSON
,
type
:
DataTypes
.
STRING
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
timestamps
:
true
,
updatedAt
:
false
,
//freezeTableName: true,
// define the table's name
tableName
:
'c_usually_contacts'
,
validate
:
{
},
indexes
:
[
]
});
}
center-order/app/base/service/impl/dbcorder/usuallycontactsSve.js
0 → 100644
View file @
35b4bdf5
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
class
UsuallyContactsService
extends
ServiceBase
{
constructor
()
{
super
(
"dbcorder"
,
ServiceBase
.
getDaoName
(
UsuallyContactsService
));
}
//添加常用联系人、申请人
async
addContacts
(
pobj
,
actionBody
){
if
(
!
actionBody
.
channel_user_id
)
{
return
system
.
getResultFail
(
-
1
,
"渠道用户id不能为空"
);
}
if
(
!
actionBody
.
contacts
){
return
system
.
getResultFail
(
-
1
,
'用户信息不能为空'
);
}
if
(
!
actionBody
.
type
){
return
system
.
getResultFail
(
-
1
,
'类型不能为空'
);
}
let
params
=
{
channel_user_id
:
actionBody
.
channel_user_id
,
uapp_id
:
pobj
.
appInfo
.
uapp_id
,
type
:
actionBody
.
type
,
contact_name
:
actionBody
.
contacts
.
contacts
||
actionBody
.
name
}
let
item
=
await
this
.
findOne
(
params
);
if
(
item
){
return
system
.
getResultFail
(
-
1
,
'联系人已存在,请勿重复添加'
)
}
let
contactsInfo
=
{
uapp_id
:
pobj
.
appInfo
.
uapp_id
,
channel_user_id
:
actionBody
.
channel_user_id
,
contact_name
:
actionBody
.
contacts
.
name
||
actionBody
.
contacts
.
contacts
,
contacts_content
:
actionBody
.
contacts
,
type
:
actionBody
.
type
}
let
result
=
await
this
.
create
(
contactsInfo
);
return
system
.
getResultSuccess
();
}
//删除常用联系人、申请人
async
delContacts
(
pobj
,
actionBody
){
let
params
=
{
id
:
actionBody
.
id
,
uapp_id
:
pobj
.
appInfo
.
uapp_id
}
await
this
.
delete
(
params
);
return
system
.
getResultSuccess
();
}
//修改常用联系人、申请人
async
updateContacts
(
pobj
,
actionBody
){
if
(
!
actionBody
.
id
){
return
system
.
getResultFail
(
-
1
,
'id 不能为空'
);
}
if
(
!
actionBody
.
channel_user_id
){
return
system
.
getResultFail
(
-
1
,
'id 不能为空'
);
}
if
(
Object
.
keys
(
actionBody
.
contacts
).
length
<
0
){
return
system
.
getResultFail
(
-
1
,
'信息不能为空'
);
}
let
obj
=
{
id
:
actionBody
.
id
,
uapp_id
:
pobj
.
appInfo
.
uapp_id
,
channel_user_id
:
actionBody
.
channel_user_id
}
let
setParams
=
{
contact_name
:
actionBody
.
contacts
.
contacts
||
actionBody
.
contacts
.
name
,
contacts
:
actionBody
.
contacts
}
let
result
=
await
this
.
updateByWhere
(
setParams
,
{
where
:
obj
});
return
system
.
getResultSuccess
();
}
//查询常用联系人、申请人
async
getContacts
(
pobj
,
actionBody
){
let
sql
=
`select id,channel_user_id,contact_name,contacts_content,type from c_usually_contacts where uapp_id = :uapp_id and channel_user_id = :channel_user_id and type = :type and deleted_at is null`
;
if
(
!
actionBody
.
type
){
return
system
.
getResultFail
(
-
1
,
'type 不能为空'
)
}
if
(
!
actionBody
.
channel_user_id
){
return
system
.
getResultFail
(
-
1
,
'type 不能为空'
)
}
let
paramsWhere
=
{
uapp_id
:
pobj
.
appInfo
.
uapp_id
,
channel_user_id
:
actionBody
.
channel_user_id
,
type
:
actionBody
.
type
}
let
result
=
await
this
.
customQuery
(
sql
,
paramsWhere
);
return
system
.
getResult
(
result
);
}
}
module
.
exports
=
UsuallyContactsService
;
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