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
ea1283b4
Commit
ea1283b4
authored
Mar 06, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
785afa8b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
602 additions
and
188 deletions
+602
-188
bpo-channel/app/base/api/api.base.js
+1
-0
bpo-channel/app/base/api/impl/op/action.js
+28
-131
bpo-channel/app/base/db/dao.base.js
+1
-1
bpo-channel/app/base/db/impl/channel/channelDao.js
+77
-0
bpo-channel/app/base/db/impl/channel/channelmerchantDao.js
+6
-24
bpo-channel/app/base/db/impl/channel/originDao.js
+66
-0
bpo-channel/app/base/db/models/channel/channel.js
+64
-0
bpo-channel/app/base/db/models/channel/channelmerchant.js
+57
-0
bpo-channel/app/base/db/models/channel/origin.js
+7
-9
bpo-channel/app/base/service/impl/channel/channelSve.js
+83
-0
bpo-channel/app/base/service/impl/channel/channelmerchantSve.js
+105
-0
bpo-channel/app/base/service/impl/channel/deliverSve.js
+0
-0
bpo-channel/app/base/service/impl/channel/originSve.js
+46
-0
bpo-channel/app/base/service/sve.base.js
+2
-0
bpo-channel/app/base/system.js
+28
-10
bpo-channel/app/config/localsettings.js
+1
-1
bpo-channel/app/config/settings.js
+1
-1
bpo-channel/package-lock.json
+28
-11
bpo-channel/package.json
+1
-0
No files found.
bpo-channel/app/base/api/api.base.js
View file @
ea1283b4
...
...
@@ -100,6 +100,7 @@ class APIBase extends DocBase {
rtn
.
requestid
=
requestid
;
this
.
oplogSve
.
createDb
({
longId
:
true
,
appid
:
req
.
headers
[
"app_id"
]
||
""
,
appkey
:
""
,
requestId
:
requestid
,
...
...
bpo-channel/app/base/api/impl/op/action.js
View file @
ea1283b4
...
...
@@ -4,14 +4,9 @@ var settings = require("../../../../config/settings");
class
ActionAPI
extends
APIBase
{
constructor
()
{
super
();
this
.
domicileSve
=
system
.
getObject
(
"service.common.domicileSve"
);
this
.
businessscopeSve
=
system
.
getObject
(
"service.common.businessscopeSve"
);
this
.
captchaSve
=
system
.
getObject
(
"service.common.captchaSve"
);
this
.
deliverSve
=
system
.
getObject
(
"service.deliver.deliverSve"
);
this
.
invoicecontentSve
=
system
.
getObject
(
"service.common.invoicecontentSve"
);
this
.
smsinfoSve
=
system
.
getObject
(
"service.common.smsinfoSve"
);
this
.
originSve
=
system
.
getObject
(
"service.channel.originSve"
);
this
.
channelSve
=
system
.
getObject
(
"service.channel.channelSve"
);
this
.
channelmerchantSve
=
system
.
getObject
(
"service.channel.channelmerchantSve"
);
}
/**
* 接口跳转
...
...
@@ -40,142 +35,44 @@ class ActionAPI extends APIBase {
var
opResult
=
null
;
switch
(
action_type
)
{
// 图片验证码
case
"getCaptha"
:
opResult
=
await
this
.
captchaSve
.
apiGenerate
(
action_body
);
break
;
case
"validCaptha"
:
opResult
=
await
this
.
captchaSve
.
apiValidator
(
action_body
);
break
;
// 注册地
case
"domicileNameList"
:
opResult
=
await
this
.
domicileSve
.
apiNameList
(
action_body
);
// 来源api
case
"originDics"
:
opResult
=
await
this
.
originSve
.
dics
(
action_body
);
break
;
case
"
domicileTree
"
:
opResult
=
await
this
.
domicileSve
.
apiTree
(
action_body
);
case
"
originInfo
"
:
opResult
=
await
this
.
originSve
.
info
(
action_body
);
break
;
case
"domicilePage"
:
opResult
=
await
this
.
domicileSve
.
apiPage
(
action_body
);
break
;
case
"domicileSave"
:
opResult
=
await
this
.
domicileSve
.
apiSave
(
action_body
);
break
;
case
"domicileInfo"
:
opResult
=
await
this
.
domicileSve
.
apiInfo
(
action_body
);
break
;
case
"domicileDelete"
:
opResult
=
await
this
.
domicileSve
.
apiDeleteByIds
(
action_body
);
case
"originMerchants"
:
opResult
=
await
this
.
originSve
.
merchants
(
action_body
);
break
;
//
经营范围
case
"
businessscopeByDomicileId
"
:
opResult
=
await
this
.
businessscopeSve
.
apiDomicileLi
st
(
action_body
);
//
渠道api
case
"
channelSuggest
"
:
opResult
=
await
this
.
channelSve
.
sugge
st
(
action_body
);
break
;
case
"
businessscopePage
"
:
opResult
=
await
this
.
businessscopeSve
.
apiPage
(
action_body
);
case
"
channelDicts
"
:
opResult
=
await
this
.
channelSve
.
dics
(
action_body
);
break
;
case
"
businessscopeSave
"
:
opResult
=
await
this
.
businessscopeSve
.
apiSave
(
action_body
);
case
"
channelInfo
"
:
opResult
=
await
this
.
channelSve
.
info
(
action_body
);
break
;
case
"
businessscopeInfo
"
:
opResult
=
await
this
.
businessscopeSve
.
apiInfo
(
action_body
);
case
"
channelSave
"
:
opResult
=
await
this
.
channelSve
.
save
(
action_body
);
break
;
case
"
businessscopeDelet
e"
:
opResult
=
await
this
.
businessscopeSve
.
apiDeleteByIds
(
action_body
);
case
"
channelPag
e"
:
opResult
=
await
this
.
channelSve
.
page
(
action_body
);
break
;
// 交付商
case
"deliverAll"
:
opResult
=
await
this
.
deliverSve
.
apiAll
(
action_body
);
break
;
case
"deliverPage"
:
opResult
=
await
this
.
deliverSve
.
apiPage
(
action_body
);
break
;
case
"deliverSave"
:
opResult
=
await
this
.
deliverSve
.
apiSave
(
action_body
);
break
;
case
"deliverInfo"
:
opResult
=
await
this
.
deliverSve
.
apiInfo
(
action_body
);
break
;
case
"deliverDelete"
:
opResult
=
await
this
.
deliverSve
.
apiDeleteByIds
(
action_body
);
break
;
case
"deliverResetPassword"
:
opResult
=
await
this
.
deliverSve
.
updPassword
(
action_body
);
break
;
case
"deliverEnable"
:
opResult
=
await
this
.
deliverSve
.
enable
(
action_body
);
break
;
case
"deliverLogin"
:
opResult
=
await
this
.
deliverSve
.
login
(
action_body
);
break
;
case
"deliverUsers"
:
opResult
=
await
this
.
deliverSve
.
deliverUsers
(
action_body
);
break
;
case
"deliverUserMap"
:
opResult
=
await
this
.
deliverSve
.
deliverUserMap
(
action_body
);
break
;
case
"deliverUserPage"
:
opResult
=
await
this
.
deliverSve
.
deliverUserPage
(
action_body
);
break
;
case
"deliverUserById"
:
opResult
=
await
this
.
deliverSve
.
deliverUserById
(
action_body
);
break
;
case
"deliverUserSave"
:
opResult
=
await
this
.
deliverSve
.
deliverUserSave
(
action_body
);
break
;
case
"deliverUserInfo"
:
opResult
=
await
this
.
deliverSve
.
deliverUserInfo
(
action_body
);
break
;
case
"deliverSynUpdate"
:
opResult
=
await
this
.
deliverSve
.
deliverSynUpdate
(
action_body
);
break
;
case
"orgTree"
:
opResult
=
await
this
.
deliverSve
.
orgTree
(
action_body
);
break
;
case
"allOrg"
:
opResult
=
await
this
.
deliverSve
.
allOrg
(
action_body
);
break
;
case
"orgById"
:
opResult
=
await
this
.
deliverSve
.
orgById
(
action_body
);
break
;
case
"orgSave"
:
opResult
=
await
this
.
deliverSve
.
orgSave
(
action_body
);
break
;
// 发票内容
case
"invoicecontentSave"
:
opResult
=
await
this
.
invoicecontentSve
.
apiSave
(
action_body
);
break
;
case
"invoicecontentDelete"
:
opResult
=
await
this
.
invoicecontentSve
.
apiDelete
(
action_body
);
break
;
case
"invoiceList"
:
opResult
=
await
this
.
invoicecontentSve
.
apiList
(
action_body
);
break
;
case
"invoicecontent"
:
opResult
=
await
this
.
invoicecontentSve
.
apiGetById
(
action_body
);
// 商户api
case
"merchantInfo"
:
opResult
=
await
this
.
channelmerchantSve
.
info
(
action_body
);
break
;
case
"
invoicecontentAll
"
:
opResult
=
await
this
.
invoicecontentSve
.
getAll
(
action_body
);
case
"
merchantSave
"
:
opResult
=
await
this
.
channelmerchantSve
.
save
(
action_body
);
break
;
// 阿里短信服务
case
"sendSms"
:
//发送短信
opResult
=
await
this
.
smsinfoSve
.
sendSms
(
action_body
);
case
"merchantPage"
:
opResult
=
await
this
.
channelmerchantSve
.
page
(
action_body
);
break
;
case
"querySendDetails"
:
//查询发送记录
opResult
=
await
this
.
smsinfoSve
.
querySendDetails
(
action_body
);
break
;
case
"querySmsInfos"
:
//条件查询
opResult
=
await
this
.
smsinfoSve
.
querySmsInfos
(
action_body
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
...
...
bpo-channel/app/base/db/dao.base.js
View file @
ea1283b4
...
...
@@ -10,7 +10,7 @@ class Dao {
}
async
preCreate
(
u
)
{
if
(
!
u
.
id
)
{
if
(
!
u
.
id
&&
u
.
longId
)
{
u
.
id
=
await
this
.
redisClient
.
genrateId
(
this
.
modelName
);
}
return
u
;
...
...
bpo-channel/app/base/db/impl/channel/channelDao.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
ChannelDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
ChannelDao
));
}
async
suggest
(
name
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"`id`, `name`"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE `name` LIKE :nameLike "
);
sql
.
push
(
"LIMIT 10"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
nameLike
:
"%"
+
name
+
"%"
})
||
[];
}
async
dicList
(
isEnabled
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"`id`, `name`"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE 1 = 1 "
);
let
params
=
{};
if
(
isEnabled
===
0
||
isEnabled
===
1
)
{
params
.
isEnabled
=
isEnabled
;
sql
.
push
(
"AND isEnabled = :isEnabled"
);
}
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
)
||
[];
}
async
findListByIds
(
ids
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
})
||
[];
}
async
findMapByIds
(
ids
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
var
list
=
await
this
.
findListByIds
(
ids
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
ChannelDao
;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
bpo-channel/app/base/db/impl/channel/
deliver
Dao.js
→
bpo-channel/app/base/db/impl/channel/
channelmerchant
Dao.js
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
Deliver
Dao
extends
Dao
{
class
Channelmerchant
Dao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
DeliverDao
));
}
async
getList
(
isEnabled
,
attrs
)
{
attrs
=
attrs
||
"*"
var
sql
=
[];
sql
.
push
(
"SELECT "
);
sql
.
push
(
attrs
);
sql
.
push
(
"FROM d_deliver"
);
if
(
isEnabled
==
1
)
{
sql
.
push
(
"WHERE isEnabled = 1"
);
}
return
await
this
.
customQuery
(
sql
.
join
(
" "
))
||
[];
}
async
delById
(
id
,
t
)
{
var
sql
=
"DELETE FROM d_deliver WHERE id = :id"
;
return
await
this
.
customUpdate
(
sql
,
{
id
:
id
},
t
);
super
(
Dao
.
getModelName
(
ChannelmerchantDao
));
}
async
findListByIds
(
ids
)
{
...
...
@@ -30,8 +11,9 @@ class DeliverDao extends Dao {
}
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"id, name, businessmenDivide, invoiceDivide, isEnabled, created_at "
);
sql
.
push
(
"FROM d_deliver"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
...
...
@@ -53,7 +35,7 @@ class DeliverDao extends Dao {
return
result
;
}
}
module
.
exports
=
Deliver
Dao
;
module
.
exports
=
Channelmerchant
Dao
;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
...
...
bpo-channel/app/base/db/impl/channel/originDao.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
Dao
=
require
(
"../../dao.base"
);
class
OriginDao
extends
Dao
{
constructor
()
{
super
(
Dao
.
getModelName
(
OriginDao
));
}
async
dicList
(
isEnabled
)
{
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"`id`, `name`, `is_api`"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE 1 = 1 "
);
let
params
=
{};
if
(
isEnabled
===
0
||
isEnabled
===
1
)
{
params
.
isEnabled
=
isEnabled
;
sql
.
push
(
"AND isEnabled = :isEnabled"
);
}
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
params
)
||
[];
}
async
findListByIds
(
ids
)
{
if
(
!
ids
||
ids
.
length
==
0
)
{
return
[];
}
var
sql
=
[];
sql
.
push
(
"SELECT"
);
sql
.
push
(
"*"
);
sql
.
push
(
"FROM"
);
sql
.
push
(
this
.
model
.
tableName
);
sql
.
push
(
"WHERE id IN (:ids)"
);
return
await
this
.
customQuery
(
sql
.
join
(
" "
),
{
ids
:
ids
})
||
[];
}
async
findMapByIds
(
ids
)
{
var
result
=
{};
if
(
!
ids
||
ids
.
length
==
0
)
{
return
result
;
}
var
list
=
await
this
.
findListByIds
(
ids
);
if
(
!
list
||
list
.
length
==
0
)
{
return
result
;
}
for
(
var
item
of
list
)
{
result
[
item
.
id
]
=
item
;
}
return
result
;
}
}
module
.
exports
=
OriginDao
;
// var u=new UserDao();
// var roledao=system.getObject("db.roleDao");
// (async ()=>{
// var users=await u.model.findAll({where:{app_id:1}});
// var role=await roledao.model.findOne({where:{code:"guest"}});
// console.log(role);
// for(var i=0;i<users.length;i++){
// await users[i].setRoles([role]);
// console.log(i);
// }
//
// })();
\ No newline at end of file
bpo-channel/app/base/db/models/channel/channel.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"channel"
,
{
ctype
:
DataTypes
.
INTEGER
,
name
:
DataTypes
.
INTEGER
,
code
:
DataTypes
.
STRING
,
idcode
:
DataTypes
.
STRING
,
business_license
:
DataTypes
.
STRING
,
idcard_front
:
DataTypes
.
STRING
,
idcard_back
:
DataTypes
.
STRING
,
contact_man
:
DataTypes
.
STRING
,
contact_mobile
:
DataTypes
.
STRING
,
contact_email
:
DataTypes
.
STRING
,
contact_addr
:
DataTypes
.
STRING
,
isEnabled
:
{
type
:
DataTypes
.
BOOLEAN
,
allowNull
:
true
,
},
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'ch_channel'
,
validate
:
{},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
bpo-channel/app/base/db/models/channel/channelmerchant.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"channelmerchant"
,
{
channel_id
:
DataTypes
.
INTEGER
,
origin_id
:
DataTypes
.
INTEGER
,
origin_merchant_id
:
DataTypes
.
INTEGER
,
merchant_name
:
DataTypes
.
STRING
,
contact_man
:
DataTypes
.
STRING
,
contact_mobile
:
DataTypes
.
STRING
,
contact_email
:
DataTypes
.
STRING
,
contact_addr
:
DataTypes
.
STRING
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
version
:
true
,
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'ch_channel_merchant'
,
validate
:
{},
indexes
:
[
// Create a unique index on email
// {
// unique: true,
// fields: ['email']
// },
//
// // Creates a gin index on data with the jsonb_path_ops operator
// {
// fields: ['data'],
// using: 'gin',
// operator: 'jsonb_path_ops'
// },
//
// // By default index name will be [table]_[fields]
// // Creates a multi column partial index
// {
// name: 'public_by_author',
// fields: ['author', 'status'],
// where: {
// status: 'public'
// }
// },
//
// // A BTREE index with a ordered field
// {
// name: 'title_index',
// method: 'BTREE',
// fields: ['author', {attribute: 'title', collate: 'en_US', order: 'DESC', length: 5}]
// }
]
});
}
\ No newline at end of file
bpo-channel/app/base/db/models/channel/
deliver
.js
→
bpo-channel/app/base/db/models/channel/
origin
.js
View file @
ea1283b4
...
...
@@ -2,19 +2,17 @@ const system = require("../../../system");
const
settings
=
require
(
"../../../../config/settings"
);
const
uiconfig
=
system
.
getUiConfig2
(
settings
.
appKey
);
module
.
exports
=
(
db
,
DataTypes
)
=>
{
return
db
.
define
(
"
deliver
"
,
{
return
db
.
define
(
"
origin
"
,
{
name
:
DataTypes
.
STRING
,
businessmenDivide
:
DataTypes
.
INTEGER
,
invoiceDivide
:
DataTypes
.
INTEGER
,
admin_id
:
DataTypes
.
STRING
,
remark
:
DataTypes
.
STRING
,
is_api
:
{
type
:
DataTypes
.
BOOLEAN
,
allowNull
:
true
,
},
isEnabled
:
{
type
:
DataTypes
.
BOOLEAN
,
allowNull
:
true
,
},
nt_company_id
:
DataTypes
.
STRING
,
saas_id
:
DataTypes
.
STRING
,
api_url
:
DataTypes
.
STRING
,
},
{
paranoid
:
true
,
//假的删除
underscored
:
true
,
...
...
@@ -22,7 +20,7 @@ module.exports = (db, DataTypes) => {
freezeTableName
:
true
,
//freezeTableName: true,
// define the table's name
tableName
:
'
d_deliver
'
,
tableName
:
'
ch_origin
'
,
validate
:
{},
indexes
:
[
// Create a unique index on email
...
...
bpo-channel/app/base/service/impl/channel/channelSve.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
class
ChannelService
extends
ServiceBase
{
constructor
()
{
super
(
"channel"
,
ServiceBase
.
getDaoName
(
ChannelService
));
this
.
originDao
=
system
.
getObject
(
"db.channel.originDao"
);
this
.
channelmerchantDao
=
system
.
getObject
(
"db.channel.channelmerchantDao"
);
}
async
suggest
(
params
)
{
let
name
=
this
.
trim
(
params
.
name
);
if
(
!
name
)
{
return
system
.
getResultSuccess
([]);
}
let
list
=
await
this
.
dao
.
suggest
(
name
);
return
system
.
getResultSuccess
(
list
);
}
async
dics
()
{
var
list
=
await
this
.
dao
.
dicList
(
1
);
return
system
.
getResultSuccess
(
list
);
}
async
info
(
params
)
{
let
channel
=
await
this
.
dao
.
getById
(
params
.
id
);
return
system
.
getResultSuccess
(
channel
);
}
async
save
(
params
)
{
let
channel
;
if
(
params
.
id
)
{
channel
=
await
this
.
findById
(
params
.
id
);
}
else
{
channel
=
{
isEnabled
:
1
};
}
channel
.
name
=
this
.
trim
(
params
.
name
);
channel
.
idcode
=
this
.
trim
(
params
.
idcode
);
channel
.
business_license
=
this
.
trim
(
params
.
business_license
);
channel
.
idcard_front
=
this
.
trim
(
params
.
idcard_front
);
channel
.
idcard_back
=
this
.
trim
(
params
.
idcard_back
);
channel
.
contact_man
=
this
.
trim
(
params
.
contact_man
);
channel
.
contact_mobile
=
this
.
trim
(
params
.
contact_mobile
);
channel
.
contact_email
=
this
.
trim
(
params
.
contact_email
);
channel
.
contact_addr
=
this
.
trim
(
params
.
contact_addr
);
if
(
channel
.
id
)
{
channel
.
save
();
}
else
{
channel
.
ctype
=
Number
(
params
.
ctype
);
channel
=
await
this
.
dao
.
create
(
channel
);
}
return
system
.
getResultSuccess
(
channel
);
}
async
page
(
params
)
{
let
currentPage
=
Number
(
params
.
currentPage
||
1
);
let
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
where
=
{};
if
(
params
.
name
)
{
where
.
name
=
{
[
this
.
db
.
Op
.
like
]:
"%"
+
params
.
name
+
"%"
};
}
let
orderby
=
[
[
"id"
,
'desc'
]
];
let
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
,
null
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
}
return
system
.
getResultSuccess
(
page
);
}
}
module
.
exports
=
ChannelService
;
bpo-channel/app/base/service/impl/channel/channelmerchantSve.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
);
const
settings
=
require
(
"../../../../config/settings"
);
const
axios
=
require
(
"axios"
);
class
ChannelmerchantService
extends
ServiceBase
{
constructor
()
{
super
(
"channel"
,
ServiceBase
.
getDaoName
(
ChannelmerchantService
));
this
.
originDao
=
system
.
getObject
(
"db.channel.originDao"
);
this
.
channelDao
=
system
.
getObject
(
"db.channel.channelDao"
);
}
async
info
(
params
)
{
let
channel
=
await
this
.
dao
.
getById
(
params
.
id
);
await
this
.
setChannelInfo
([
channel
]);
return
system
.
getResultSuccess
(
channel
);
}
async
save
(
params
)
{
let
mcht
;
if
(
params
.
id
)
{
mcht
=
await
this
.
dao
.
findById
(
params
.
id
);
}
else
{
mcht
=
{};
}
let
origin
=
await
this
.
originDao
.
findById
(
params
.
origin_id
);
if
(
!
origin
)
{
return
system
.
getResult
(
null
,
"商户来源不存在"
);
}
mcht
.
merchant_name
=
this
.
trim
(
params
.
merchant_name
);
mcht
.
contact_man
=
this
.
trim
(
params
.
contact_man
);
mcht
.
contact_mobile
=
this
.
trim
(
params
.
contact_mobile
);
mcht
.
contact_email
=
this
.
trim
(
params
.
contact_email
);
mcht
.
contact_addr
=
this
.
trim
(
params
.
contact_addr
);
if
(
mcht
.
id
)
{
await
mcht
.
save
();
}
else
{
mcht
.
channel_id
=
Number
(
params
.
channel_id
);
mcht
.
origin_id
=
Number
(
params
.
origin_id
);
if
(
origin
.
is_api
&&
!
params
.
origin_merchant_id
)
{
return
system
.
getResult
(
null
,
`来源
${
origin
.
name
}
下, 请选择商户`
);
}
mcht
.
origin_merchant_id
=
params
.
origin_merchant_id
;
mcht
=
await
this
.
dao
.
create
(
mcht
);
}
return
system
.
getResultSuccess
(
mcht
);
}
async
page
(
params
)
{
let
currentPage
=
Number
(
params
.
currentPage
||
1
);
let
pageSize
=
Number
(
params
.
pageSize
||
10
);
let
where
=
{};
if
(
params
.
channel_id
)
{
where
.
channel_id
=
Number
(
params
.
channel_id
);
}
if
(
params
.
origin_id
)
{
where
.
origin_id
=
Number
(
params
.
origin_id
);
}
if
(
params
.
merchant_name
)
{
where
.
merchant_name
=
{
[
this
.
db
.
Op
.
like
]:
"%"
+
params
.
merchant_name
+
"%"
};
}
let
orderby
=
[
[
"id"
,
'desc'
]
];
let
page
=
await
this
.
getPageList
(
currentPage
,
pageSize
,
where
,
orderby
,
null
);
if
(
page
&&
page
.
rows
)
{
for
(
var
row
of
page
.
rows
)
{
this
.
handleDate
(
row
,
[
"created_at"
],
null
,
-
8
);
}
await
this
.
setChannelInfo
(
page
.
rows
);
}
return
system
.
getResultSuccess
(
page
);
}
async
setChannelInfo
(
rows
)
{
if
(
!
rows
||
rows
.
length
==
0
)
{
return
;
}
var
ids
=
[];
for
(
var
row
of
rows
)
{
ids
.
push
(
row
.
channel_id
);
}
var
map
=
await
this
.
channelDao
.
findMapByIds
(
ids
);
for
(
var
row
of
rows
)
{
let
obj
=
map
[
row
.
channel_id
]
||
{};
row
.
channel_name
=
obj
.
name
||
""
;
row
.
channel_idcode
=
obj
.
idcode
||
""
;
}
}
}
module
.
exports
=
ChannelmerchantService
;
bpo-channel/app/base/service/impl/channel/deliverSve.js
deleted
100644 → 0
View file @
785afa8b
This diff is collapsed.
Click to expand it.
bpo-channel/app/base/service/impl/channel/originSve.js
0 → 100644
View file @
ea1283b4
const
system
=
require
(
"../../../system"
);
const
ServiceBase
=
require
(
"../../sve.base"
)
const
settings
=
require
(
"../../../../config/settings"
)
const
axios
=
require
(
"axios"
);
class
OriginService
extends
ServiceBase
{
constructor
()
{
super
(
"channel"
,
ServiceBase
.
getDaoName
(
OriginService
));
}
async
dics
()
{
var
list
=
await
this
.
dao
.
dicList
(
1
);
return
system
.
getResultSuccess
(
list
);
}
async
info
(
params
)
{
let
origin
=
await
this
.
dao
.
getById
(
params
.
id
);
return
system
.
getResultSuccess
(
origin
);
}
async
merchants
(
params
)
{
let
id
=
Number
(
params
.
id
||
0
);
let
name
=
this
.
trim
(
params
.
name
);
if
(
!
id
||
!
name
)
{
return
system
.
getResultSuccess
([]);
}
let
origin
=
await
this
.
dao
.
findById
(
id
);
if
(
!
origin
)
{
return
system
.
getResultSuccess
([]);
}
if
(
!
origin
)
{
return
system
.
getResultSuccess
([]);
}
if
(
!
origin
.
is_api
||
!
origin
.
api_url
)
{
return
system
.
getResultSuccess
([]);
}
let
rs
=
await
axios
({
method
:
'post'
,
url
:
origin
.
api_url
,
data
:
{
name
:
name
}
});
return
rs
.
data
;
}
}
module
.
exports
=
OriginService
;
bpo-channel/app/base/service/sve.base.js
View file @
ea1283b4
...
...
@@ -10,6 +10,7 @@ class ServiceBase {
this
.
daoName
=
daoName
;
this
.
dao
=
system
.
getObject
(
"db."
+
gname
+
"."
+
daoName
);
this
.
restS
=
system
.
getObject
(
"util.restClient"
);
}
/**
* 验证签名
...
...
@@ -182,6 +183,7 @@ class ServiceBase {
async
findById
(
oid
)
{
return
this
.
dao
.
findById
(
oid
);
}
/*
返回20位业务订单号
prefix:业务前缀
...
...
bpo-channel/app/base/system.js
View file @
ea1283b4
...
...
@@ -165,23 +165,41 @@ class System {
return
uuid
.
join
(
''
);
}
static
microsetting
()
{
console
.
log
(
settings
.
env
,
"-------------- microsetting env ------------------"
);
var
path
=
"/api/op/action/springboard"
;
if
(
settings
.
env
==
"dev"
)
{
var
domain
=
"http://192.168.18.237"
;
// var domain = "http://192.168.18.237";
var
domain2
=
"http://127.0.0.1"
;
var
domain
=
"http://39.107.234.14"
;
return
{
common
:
domain
+
":3102"
+
path
,
// 公共服务
common
:
domain2
+
":3102"
+
path
,
// common: "http://127.0.0.1:3102" + path,
// 商户服务
merchant
:
domain
+
":3101"
+
path
,
order
:
""
+
path
,
invoice
:
""
+
path
,
payment
:
""
+
path
,
// merchant: "http://127.0.0.1:3101" + path,
// 订单服务
order
:
domain2
+
":3103"
+
path
,
// order: "http://127.0.0.1:3103" + path,
// 发票服务
invoice
:
domain
+
":3105"
+
path
,
// invoice: "http://127.0.0.1:3105" + path,
// 用户中心
uc
:
domain
+
":3106"
+
path
,
// uc: "http://127.0.0.1:3106" + path,
}
}
else
{
var
odomain
=
"http://123.57.217.203"
return
{
common
:
"
http://xggsvecommon.gongsibao.com
"
+
path
,
merchant
:
"
http://xggsvemerchant.gongsibao.com
"
+
path
,
order
:
"
http://xggsveorder.gongsibao.com
"
+
path
,
invoice
:
"
http://xggsveinvoice.gongsibao.com
"
+
path
,
payment
:
"http://xggsvepayment.gongsibao.com
"
+
path
,
common
:
"
xggsvecommon-service
"
+
path
,
merchant
:
"
xggsvemerchant-service
"
+
path
,
order
:
"
xggsveorder-service
"
+
path
,
invoice
:
"
xggsveinvoice-service
"
+
path
,
uc
:
"xggsveuc-service
"
+
path
,
}
}
}
...
...
bpo-channel/app/config/localsettings.js
View file @
ea1283b4
...
...
@@ -6,7 +6,7 @@ var settings={
db
:
10
,
},
database
:{
dbname
:
"
xgg-common
"
,
dbname
:
"
bpo_channel
"
,
user
:
"write"
,
password
:
"write"
,
config
:
{
...
...
bpo-channel/app/config/settings.js
View file @
ea1283b4
...
...
@@ -21,7 +21,7 @@ var settings = {
cacheprefix
:
"sjb"
,
usertimeout
:
3600
,
//单位秒
basepath
:
path
.
normalize
(
path
.
join
(
__dirname
,
'../..'
)),
port
:
process
.
env
.
NODE_PORT
||
3
102
,
port
:
process
.
env
.
NODE_PORT
||
3
003
,
defaultPassWord
:
"987456"
,
paasUrl
:
function
()
{
if
(
this
.
env
==
"dev"
)
{
...
...
bpo-channel/package-lock.json
View file @
ea1283b4
...
...
@@ -381,6 +381,14 @@
"integrity"
:
"sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w=="
,
"dev"
:
true
},
"axios"
:
{
"version"
:
"0.19.2"
,
"resolved"
:
"https://registry.npmjs.org/axios/-/axios-0.19.2.tgz"
,
"integrity"
:
"sha512-fjgm5MvRHLhx+osE2xoekY70AhARk3a6hkN+3Io1jc00jtquGvxYlKlsFUhmUET0V5te6CcZI7lcv2Ym61mjHA=="
,
"requires"
:
{
"follow-redirects"
:
"1.5.10"
}
},
"babel-helper-vue-jsx-merge-props"
:
{
"version"
:
"2.0.3"
,
"resolved"
:
"https://registry.npmjs.org/babel-helper-vue-jsx-merge-props/-/babel-helper-vue-jsx-merge-props-2.0.3.tgz"
,
...
...
@@ -2147,6 +2155,24 @@
"integrity"
:
"sha1-Tnmumy6zi/hrO7Vr8+ClaqX8q9c="
,
"dev"
:
true
},
"follow-redirects"
:
{
"version"
:
"1.5.10"
,
"resolved"
:
"https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz"
,
"integrity"
:
"sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ=="
,
"requires"
:
{
"debug"
:
"=3.1.0"
},
"dependencies"
:
{
"debug"
:
{
"version"
:
"3.1.0"
,
"resolved"
:
"https://registry.npmjs.org/debug/-/debug-3.1.0.tgz"
,
"integrity"
:
"sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g=="
,
"requires"
:
{
"ms"
:
"2.0.0"
}
}
}
},
"for-in"
:
{
"version"
:
"1.0.2"
,
"resolved"
:
"https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz"
,
...
...
@@ -3444,7 +3470,8 @@
"is-buffer"
:
{
"version"
:
"1.1.6"
,
"resolved"
:
"https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz"
,
"integrity"
:
"sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
"integrity"
:
"sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
,
"dev"
:
true
},
"is-builtin-module"
:
{
"version"
:
"1.0.0"
,
...
...
@@ -4239,16 +4266,6 @@
"resolved"
:
"https://registry.npmjs.org/marked/-/marked-0.7.0.tgz"
,
"integrity"
:
"sha512-c+yYdCZJQrsRjTPhUx7VKkApw9bwDkNbHUKo1ovgcfDjb2kc8rLuRbIFyXL5WOEUwzSSKo3IXpph2K6DqB/KZg=="
},
"md5"
:
{
"version"
:
"2.2.1"
,
"resolved"
:
"https://registry.npmjs.org/md5/-/md5-2.2.1.tgz"
,
"integrity"
:
"sha1-U6s41f48iJG6RlMp6iP6wFQBJvk="
,
"requires"
:
{
"charenc"
:
"~0.0.1"
,
"crypt"
:
"~0.0.1"
,
"is-buffer"
:
"~1.1.1"
}
},
"media-typer"
:
{
"version"
:
"0.3.0"
,
"resolved"
:
"https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz"
,
...
...
bpo-channel/package.json
View file @
ea1283b4
...
...
@@ -13,6 +13,7 @@
"
MD5
"
:
"^1.3.0"
,
"
after
"
:
"^0.8.2"
,
"
ali-oss
"
:
"^4.12.2"
,
"
axios
"
:
"^0.19.2"
,
"
babel-polyfill
"
:
"^6.26.0"
,
"
base64id
"
:
"^1.0.0"
,
"
bluebird
"
:
"^3.5.1"
,
...
...
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