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
7c1b5ba6
Commit
7c1b5ba6
authored
Jul 02, 2020
by
zhaoxiqing
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'esign-admin' of
http://gitlab.gongsibao.com/jiangyong/zhichan
into esign-admin
parents
e943ef20
e83f3308
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
430 additions
and
62 deletions
+430
-62
esign-admin/app/base/controller/impl/order/orderCtl.js
+89
-15
esign-admin/app/base/controller/impl/order/orderauthlogCtl.js
+26
-7
esign-admin/app/base/controller/impl/order/orderproductCtl.js
+6
-9
esign-admin/app/base/controller/impl/order/ordersignlogCtl.js
+38
-13
esign-admin/app/base/controller/impl/product/productCtl.js
+19
-1
esign-admin/app/base/service/impl/fee/feeSve.js
+19
-0
esign-admin/app/base/service/impl/order/orderSve.js
+27
-0
esign-admin/app/base/service/impl/product/productSve.js
+17
-0
esign-admin/app/base/system.js
+2
-2
esign-admin/app/front/entry/public/apidoc/product/product.md
+187
-15
No files found.
esign-admin/app/base/controller/impl/order/orderCtl.js
View file @
7c1b5ba6
...
...
@@ -7,7 +7,13 @@ class OrderCtl extends CtlBase {
super
();
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
this
.
orderSve
=
system
.
getObject
(
"service.order.orderSve"
);
this
.
merchantaccountSve
=
system
.
getObject
(
"service.merchant.merchantaccountSve"
);
this
.
merchanttradeSve
=
system
.
getObject
(
"service.merchant.merchanttradeSve"
);
// this.redisClient = system.getObject("util.redisClient");
this
.
productSve
=
system
.
getObject
(
"service.product.productSve"
);
this
.
ordersignlogSve
=
system
.
getObject
(
"service.order.ordersignlogSve"
);
this
.
orderauthlogSve
=
system
.
getObject
(
"service.order.orderauthlogSve"
);
this
.
feeSve
=
system
.
getObject
(
"service.order.feeSve"
);
}
/**
...
...
@@ -23,13 +29,14 @@ class OrderCtl extends CtlBase {
*/
async
saveEorder
(
pobj
,
pobj2
,
req
,
res
)
{
try
{
//TODO:首先拿到商户的账号信息 (拿到合同ID 合同名称 )
// TODO:需要去调用商户钱包 扣钱
if
(
!
pobj
.
merchant_id
){
return
system
.
getResult
(
null
,
`参数错误 商户ID不能为空`
)
}
if
(
!
pobj
.
merchant_name
){
return
system
.
getResult
(
null
,
`参数错误 商户名称不能为空`
)
}
//TODO:可能需要商户的合同ID和合同名称
if
(
!
pobj
.
contract_url
){
return
system
.
getResult
(
null
,
`参数错误 业务合同不能为空`
);
}
...
...
@@ -49,6 +56,13 @@ class OrderCtl extends CtlBase {
if
(
pobj
.
product_type
==
'1'
){
//如果是单个产品 需要转化单价
pobj
.
product_unit_price
=
system
.
y2f
(
pobj
.
product_unit_price
);
}
// 需要去调用商户钱包 扣钱
if
(
pobj
.
id
){
let
reduceAccountBalanceRes
=
await
this
.
merchantaccountSve
.
addordelavailable
({
merchant_id
:
this
.
trim
(
pobj
.
merchant_id
),
amount
:
pobj
.
price
*
(
-
1
)});
if
(
reduceAccountBalanceRes
.
status
!=
0
){
return
system
.
getResult
(
null
,
`扣款失败`
);
}
}
//保存
let
res
=
await
this
.
orderSve
.
saveEorder
(
pobj
);
if
(
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
price
&&
res
.
data
.
product_type
){
...
...
@@ -82,11 +96,11 @@ class OrderCtl extends CtlBase {
}
pobj
.
audit_user_id
=
req
.
loginUser
.
id
;
//获取审核人
let
res
=
await
this
.
orderSve
.
auditEorder
(
pobj
);
//
TODO:
审核订单成功之后
//
审核订单成功之后
if
(
res
.
status
==
0
){
this
.
pushMerchantTrade
(
pobj
);
}
return
system
.
getResult
(
res
)
;
return
res
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -98,15 +112,28 @@ class OrderCtl extends CtlBase {
* @param params
*/
async
pushMerchantTrade
(
params
){
let
orderBean
=
await
this
.
orderSve
.
getEorderById
({
id
:
this
.
trim
(
id
)});
if
(
!
orderBean
){
console
.
log
(
`推送流水失败 订单信息获取异常
`
);
let
orderBean
=
await
this
.
orderSve
.
getEorderById
({
id
:
this
.
trim
(
params
.
id
)});
if
(
orderBean
.
status
!=
0
){
console
.
log
(
`推送流水失败 订单信息获取异常
订单信息:`
+
JSON
.
stringify
(
orderBean
)
);
}
orderBean
=
orderBean
.
data
;
if
(
params
.
audit_status
==
'20'
){
//订单审核成功
//TODO:推送给赵大哥
let
res
=
await
this
.
merchantaccountSve
.
reduceAccountBalance
({
merchant_id
:
orderBean
.
merchant_id
,
amount
:
orderBean
.
price
});
if
(
res
.
status
==
0
){
console
.
log
(
"扣除余额成功 返回结果:"
+
JSON
.
stringify
(
res
));
let
res
=
await
this
.
merchanttradeSve
.
valetorder
({
merchant_id
:
orderBean
.
merchant_id
,
amount
:
orderBean
.
price
,
trade_data_id
:
orderBean
.
id
});
if
(
res
.
status
==
0
&&
res
.
data
&&
res
.
data
.
id
){
console
.
log
(
'交易流水创建完成 结果:'
+
JSON
.
stringify
(
res
));
let
r
=
await
this
.
orderSve
.
updOrderSimple
({
id
:
orderBean
.
id
,
trade_id
:
res
.
data
.
id
});
console
.
log
(
"更新交易流水ID完成 结果:"
+
JSON
.
stringify
(
r
));
}
}
}
if
(
params
.
audit_status
==
'30'
){
//订单审核失败
//TODO:推送给赵大哥
// 推送给赵大哥
let
reduceAccountBalanceRes
=
await
this
.
merchantaccountSve
.
addordelavailable
({
merchant_id
:
this
.
trim
(
orderBean
.
merchant_id
),
amount
:
orderBean
.
price
});
console
.
log
(
"订单审核失败 余额退回 "
+
JSON
.
stringify
(
reduceAccountBalanceRes
));
}
}
...
...
@@ -125,7 +152,9 @@ class OrderCtl extends CtlBase {
return
system
.
getResult
(
null
,
`订单【
${
pobj
.
id
}
】不存在`
);
}
let
res
=
await
this
.
orderSve
.
getEorderById
(
pobj
);
return
system
.
getResult
(
res
);
// 计费
await
this
.
feeSve
.
setRowsFee
([
res
.
data
],
"engine_account_id"
);
return
res
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -143,7 +172,35 @@ class OrderCtl extends CtlBase {
async
pageEorder
(
pobj
,
pobj2
,
req
,
res
)
{
try
{
let
res
=
await
this
.
orderSve
.
pageEorder
(
pobj
);
return
system
.
getResult
(
res
);
if
(
res
.
status
!=
0
||
res
.
data
.
count
==
0
){
return
res
;
}
//格式化产品信息
let
ids
=
[],
productMap
=
{};
for
(
let
item
of
res
.
data
.
rows
)
{
item
.
price
=
system
.
f2y
(
item
.
price
);
if
(
item
.
product_type
==
'1'
){
item
.
product_unit_price
=
system
.
f2y
(
item
.
product_unit_price
);
}
if
(
item
.
product_type
==
'2'
){
item
.
product_specifications
=
system
.
f2y
(
item
.
product_specifications
);
}
ids
.
push
(
item
.
product_id
);
}
let
p_listRes
=
await
this
.
productSve
.
getByIds
({
ids
:
ids
});
if
(
p_listRes
.
status
!=
0
){
return
system
.
getResul
(
`获取订单产品失败`
);
}
//将产品列表映射成Map结构
for
(
let
ele
of
p_listRes
.
data
)
{
productMap
[
ele
.
id
]
=
ele
;
}
for
(
let
item
of
res
.
data
.
rows
)
{
item
.
product_info
=
productMap
[
item
.
product_id
];
}
// 设置计费内容
await
this
.
feeSve
.
setRowsFee
(
res
.
data
.
rows
,
"engine_account_id"
);
return
res
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -166,14 +223,30 @@ class OrderCtl extends CtlBase {
return
system
.
getResult
(
null
,
`参数错误 订单ID不能为空`
);
}
try
{
//TODO:需要添加商户信息 (merchant_id)
return
await
this
.
orderSve
.
updEorderStatus
(
pobj
);
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
}
}
/**
* fn:查看日志
* @param pobj
* @param pobj2
* @param req
* @param res
* @returns {Promise<void>}
*/
async
pageEorderLog
(
pobj
,
pobj2
,
req
,
res
){
if
(
pobj
.
product_property
==
'1'
){
return
await
this
.
orderauthlogCtl
.
pageEorderAuthLog
(
pobj
);
}
else
if
(
pobj
.
product_property
==
'2'
){
return
await
this
.
ordersignlogSve
.
pageEorderSignLog
(
pobj
);
}
else
{
return
system
.
getResult
(
null
,
`参数错误 产品类型属性不存在`
);
}
}
}
module
.
exports
=
OrderCtl
;
\ No newline at end of file
esign-admin/app/base/controller/impl/order/orderauthlogCtl.js
View file @
7c1b5ba6
...
...
@@ -2,11 +2,12 @@ var system = require("../../../system")
const
settings
=
require
(
"../../../../config/settings"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
const
moment
=
require
(
'moment'
);
class
OrderCtl
extends
CtlBase
{
class
Order
authlog
Ctl
extends
CtlBase
{
constructor
()
{
super
();
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
this
.
orderauthlogSve
=
system
.
getObject
(
"service.order.orderauthlogSve"
);
this
.
productSve
=
system
.
getObject
(
"service.product.productSve"
);
}
...
...
@@ -58,15 +59,33 @@ class OrderCtl extends CtlBase {
async
pageEorderAuthLog
(
pobj
,
pobj2
,
req
,
res
){
//如果存在时间筛选 时间格式 2020-05
if
(
pobj
.
spendedDate
){
let
dateRes
=
formatDate
(
pobj
.
spendedDate
);
let
dateRes
=
this
.
formatDate
(
pobj
.
spendedDate
);
pobj
.
spendedBegin
=
dateRes
.
spendedBegin
;
pobj
.
spendedEnd
=
dateRes
.
spendedEnd
;
}
try
{
//TODO:需要获取当前商户信息 (商户ID)
pobj
.
merchant_id
=
"xxx"
;
let
res
=
await
this
.
orderauthlogSve
.
pageEorderAuthLog
(
pobj
);
return
await
this
.
orderauthlogSve
.
pageEorderAuthLog
(
pobj
);
if
(
res
.
status
!=
0
||
res
.
data
.
count
==
0
){
return
res
;
}
//格式化产品信息
let
ids
=
[],
productMap
=
{};
for
(
let
item
of
res
.
data
.
rows
)
{
ids
.
push
(
item
.
product_id
);
}
let
p_listRes
=
await
this
.
productSve
.
getByIds
({
ids
:
ids
});
if
(
p_listRes
.
status
!=
0
){
return
res
;
}
//将产品列表映射成Map结构
for
(
let
ele
of
p_listRes
.
data
)
{
productMap
[
ele
.
id
]
=
ele
;
}
for
(
let
item
of
res
.
data
.
rows
)
{
item
.
product_info
=
productMap
[
item
.
product_id
];
}
return
res
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -90,4 +109,4 @@ class OrderCtl extends CtlBase {
}
}
module
.
exports
=
ProductCtl
;
\ No newline at end of file
module
.
exports
=
OrderauthlogCtl
;
\ No newline at end of file
esign-admin/app/base/controller/impl/order/orderproductCtl.js
View file @
7c1b5ba6
...
...
@@ -2,7 +2,7 @@ var system = require("../../../system")
const
settings
=
require
(
"../../../../config/settings"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
class
OrderCtl
extends
CtlBase
{
class
Order
product
Ctl
extends
CtlBase
{
constructor
()
{
super
();
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
...
...
@@ -23,10 +23,10 @@ class OrderCtl extends CtlBase {
if
(
!
pobj
.
product_id
){
return
system
.
getResult
(
null
,
`参数错误 产品ID不能为空`
);
}
if
(
!
pobj
.
merchant_id
){
return
system
.
getResult
(
null
,
`获取数据错误`
);
}
try
{
//TODO:需要获取当前商户信息 (商户ID)
pobj
.
merchant_id
=
"xxx"
;
return
await
this
.
orderproductSve
.
listEorderProduct
(
pobj
);
}
catch
(
e
)
{
console
.
log
(
e
);
...
...
@@ -43,9 +43,6 @@ class OrderCtl extends CtlBase {
* @returns {Promise<{msg: string, data: (*|null), bizmsg: string, status: number}|void|*>}
*/
async
listEorderProductByMerchantId
(
pobj
,
pobj2
,
req
,
res
){
if
(
!
pobj
.
product_id
){
return
system
.
getResult
(
null
,
`参数错误 产品ID不能为空`
);
}
try
{
if
(
!
pobj
.
merchant_id
){
return
system
.
getResult
(
null
,
`获取数据错误`
);
...
...
@@ -58,4 +55,4 @@ class OrderCtl extends CtlBase {
}
}
module
.
exports
=
ProductCtl
;
\ No newline at end of file
module
.
exports
=
OrderproductCtl
;
\ No newline at end of file
esign-admin/app/base/controller/impl/order/ordersignlogCtl.js
View file @
7c1b5ba6
...
...
@@ -2,11 +2,12 @@ var system = require("../../../system")
const
settings
=
require
(
"../../../../config/settings"
)
const
CtlBase
=
require
(
"../../ctlms.base"
);
const
moment
=
require
(
'moment'
);
class
OrderCtl
extends
CtlBase
{
class
Order
signlog
Ctl
extends
CtlBase
{
constructor
()
{
super
();
this
.
userSve
=
system
.
getObject
(
"service.uc.userSve"
);
this
.
ordersignlogSve
=
system
.
getObject
(
"service.order.ordersignlogSve"
);
this
.
productSve
=
system
.
getObject
(
"service.product.productSve"
);
}
/**
...
...
@@ -19,24 +20,28 @@ class OrderCtl extends CtlBase {
* @returns {Promise<void>}
*/
async
saveEorderSignLog
(
pobj
,
pobj2
,
req
,
res
){
if
(
!
p
arams
.
order_id
){
if
(
!
p
obj
.
order_id
){
return
system
.
getResult
(
null
,
`参数错误 订单ID不能为空`
);
}
if
(
!
p
arams
.
product_id
){
if
(
!
p
obj
.
product_id
){
return
system
.
getResult
(
null
,
`参数错误 产品ID不能为空`
);
}
if
(
!
p
arams
.
engine_contract_name
){
if
(
!
p
obj
.
engine_contract_name
){
return
system
.
getResult
(
null
,
`参数错误 签署任务名称不能为空`
);
}
if
(
!
p
arams
.
engine_contract_id
){
if
(
!
p
obj
.
engine_contract_id
){
return
system
.
getResult
(
null
,
`参数错误 签署ID不能为空`
);
}
if
(
!
p
arams
.
actual_spend_name
){
if
(
!
p
obj
.
actual_spend_name
){
return
system
.
getResult
(
null
,
`参数错误 实际使用方不能为空`
);
}
params
.
spended_num
=
Number
(
params
.
spended_num
||
0
);
params
.
spended_at
=
params
.
spended_at
?
params
.
spended_at
:
new
Date
();
params
.
platform_id
=
params
.
platform_id
?
params
.
platform_id
:
''
;
if
(
!
pobj
.
platform_name
){
return
system
.
getResult
(
null
,
`参数错误 平台名称不能为空`
);
}
pobj
.
merchant_id
=
pobj
.
merchant_id
?
this
.
trim
(
pobj
.
merchant_id
)
:
''
;
pobj
.
spended_num
=
Number
(
pobj
.
spended_num
||
0
);
pobj
.
spended_at
=
pobj
.
spended_at
?
pobj
.
spended_at
:
new
Date
();
pobj
.
platform_id
=
pobj
.
platform_id
?
pobj
.
platform_id
:
''
;
try
{
return
await
this
.
ordersignlogSve
.
saveEorderSignLog
(
pobj
);
}
catch
(
e
)
{
...
...
@@ -56,12 +61,32 @@ class OrderCtl extends CtlBase {
async
pageEorderSignLog
(
pobj
,
pobj2
,
req
,
res
){
//如果存在时间筛选 时间格式 2020-05
if
(
pobj
.
spendedDate
){
let
dateRes
=
formatDate
(
pobj
.
spendedDate
);
let
dateRes
=
this
.
formatDate
(
pobj
.
spendedDate
);
pobj
.
spendedBegin
=
dateRes
.
spendedBegin
;
pobj
.
spendedEnd
=
dateRes
.
spendedEnd
;
}
try
{
return
await
this
.
ordersignlogSve
.
pageEorderSignLog
(
pobj
);
let
res
=
await
this
.
ordersignlogSve
.
pageEorderSignLog
(
pobj
);
if
(
res
.
status
!=
0
||
res
.
data
.
count
==
0
){
return
res
;
}
//格式化产品信息
let
ids
=
[],
productMap
=
{};
for
(
let
item
of
res
.
data
.
rows
)
{
ids
.
push
(
item
.
product_id
);
}
let
p_listRes
=
await
this
.
productSve
.
getByIds
({
ids
:
ids
});
if
(
p_listRes
.
status
!=
0
){
return
res
;
}
//将产品列表映射成Map结构
for
(
let
ele
of
p_listRes
.
data
)
{
productMap
[
ele
.
id
]
=
ele
;
}
for
(
let
item
of
res
.
data
.
rows
)
{
item
.
product_info
=
productMap
[
item
.
product_id
];
}
return
res
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
system
.
getResult
(
null
,
`系统错误`
);
...
...
@@ -85,4 +110,4 @@ class OrderCtl extends CtlBase {
}
}
module
.
exports
=
ProductCtl
;
\ No newline at end of file
module
.
exports
=
OrdersignlogCtl
;
\ No newline at end of file
esign-admin/app/base/controller/impl/product/productCtl.js
View file @
7c1b5ba6
...
...
@@ -5,7 +5,6 @@ class ProductCtl extends CtlBase {
constructor
()
{
super
();
this
.
prodSve
=
system
.
getObject
(
"service.product.productSve"
);
this
.
redisClient
=
system
.
getObject
(
"util.redisClient"
);
}
async
getPage
(
pobj
,
pobj2
,
req
)
{
...
...
@@ -52,6 +51,24 @@ class ProductCtl extends CtlBase {
return
system
.
getResultFail
(
500
,
err
.
message
)
}
}
async
apiList
(
pobj
)
{
try
{
let
res
=
await
this
.
prodSve
.
apiList
(
pobj
)
return
res
}
catch
(
error
)
{
return
system
.
getResultFail
(
500
,
err
.
message
)
}
}
async
apiMap
(
pobj
)
{
try
{
let
res
=
await
this
.
prodSve
.
apiMap
(
pobj
)
return
res
}
catch
(
error
)
{
return
system
.
getResultFail
(
500
,
err
.
message
)
}
}
}
module
.
exports
=
ProductCtl
;
\ No newline at end of file
esign-admin/app/base/service/impl/fee/feeSve.js
View file @
7c1b5ba6
...
...
@@ -111,6 +111,24 @@ class FeeService extends ServiceBase {
}
}
async
setRowsFee
(
rows
,
field
)
{
if
(
!
rows
||
rows
.
length
==
0
||
!
field
)
{
return
;
}
let
ids
=
[];
for
(
let
item
of
rows
)
{
let
id
=
Number
(
item
[
field
]
||
0
);
if
(
!
id
)
{
continue
;
}
ids
.
push
(
id
);
}
let
map
=
await
this
.
accountBulk
({
ids
:
ids
}).
data
||
{};
for
(
let
item
of
rows
)
{
item
.
fee
=
map
[
Number
(
item
[
field
]
||
0
)]
||
{};
}
}
}
module
.
exports
=
FeeService
;
\ No newline at end of file
esign-admin/app/base/service/impl/order/orderSve.js
View file @
7c1b5ba6
...
...
@@ -33,6 +33,33 @@ class UserService extends ServiceBase {
return
await
this
.
callms
(
"sve_order"
,
"getEorderById"
,
params
);
}
/**
* fn:查看订单列表(分页)
* @param params
* @returns {Promise<{msg: *, data, bizmsg: *|string, status: number}|any|undefined>}
*/
async
pageEorder
(
params
)
{
return
await
this
.
callms
(
"sve_order"
,
"pageEorder"
,
params
);
}
/**
* fn:更爱订单状态
* @param params
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|any|undefined>}
*/
async
updEorderStatus
(
params
)
{
return
await
this
.
callms
(
"sve_order"
,
"updEorderStatus"
,
params
);
}
/**
* fn:更新订单(单表更新)
* @param params
* @returns {Promise<void>}
*/
async
updOrderSimple
(
params
){
return
await
this
.
callms
(
"sve_order"
,
"updOrderSimple"
,
params
);
}
...
...
esign-admin/app/base/service/impl/product/productSve.js
View file @
7c1b5ba6
...
...
@@ -45,6 +45,22 @@ class ProductService extends ServiceBase {
throw
error
}
}
async
apiList
(
params
)
{
try
{
return
await
this
.
callms
(
"engine_product"
,
"apiList"
,
params
)
}
catch
(
error
)
{
throw
error
}
}
async
apiMap
(
params
)
{
try
{
return
await
this
.
callms
(
"engine_product"
,
"apiMap"
,
params
)
}
catch
(
error
)
{
throw
error
}
}
}
module
.
exports
=
ProductService
;
\ No newline at end of file
esign-admin/app/base/system.js
View file @
7c1b5ba6
...
...
@@ -187,7 +187,7 @@ class System {
let
dev
=
"http://39.107.234.14"
;
return
{
// 产品引擎
engine_product
:
local
+
":3571"
+
path
,
engine_product
:
dev
+
":3571"
+
path
,
// 计费引擎
engine_fee
:
local
+
":3572"
+
path
,
// 认证引擎
...
...
@@ -198,7 +198,7 @@ class System {
// 用户服务
sve_uc
:
dev
+
":3651"
+
path
,
// 商户服务
sve_merchant
:
local
+
":3652"
+
path
,
sve_merchant
:
dev
+
":3652"
+
path
,
// 订单服务
sve_order
:
local
+
":3653"
+
path
,
}
...
...
esign-admin/app/front/entry/public/apidoc/product/product.md
View file @
7c1b5ba6
...
...
@@ -7,6 +7,8 @@
3.
[
根据 id 数组查询
](
#getByIds
)
4.
[
获取组合产品子产品列表
](
#getItems
)
5.
[
添加/更新产品
](
#createOrUpdate
)
6.
[
获取 api (list 格式)
](
#apiList
)
7.
[
获取 api (object 格式)
](
#apiMap
)
## **<a name="getPage"> 产品分页查询 </a>**
...
...
@@ -24,14 +26,14 @@
| -------- | -------- | ------ | -------------------- |
| page | number | 可选 | 页数 默认 1 |
| limit | number | 可选 | 每页条数 默认 10 |
| types | list | 可选 | 所选类别 默认
[
0, 1
]
|
| types | list | 可选 | 所选类别 默认
[
1, 2
]
|
| keywords | string | 可选 | 关键字 |
#### 参数示例
```
javascript
{
"types"
:
[
0
],
"types"
:
[
1
],
"keywords"
:
"s"
,
"page"
:
1
,
"limit"
:
1
...
...
@@ -51,8 +53,9 @@
"id"
:
7
,
"source_id"
:
10001
,
// 产品来源 id
"product_name"
:
"ssda"
,
// 产品名称
"product_type"
:
0
,
// 产品类型
"product_type"
:
1
,
// 产品类型
"product_desc"
:
"0"
,
// 产品描述
"product_property"
:
0
,
"price"
:
0
,
// 产品价格
"cost"
:
0
,
"created_at"
:
"2020-06-29T11:31:35.000Z"
,
...
...
@@ -79,13 +82,13 @@
| 参数名 | 参数类型 | 必选项 | 备注 |
| ------ | -------- | ------ | -------------------- |
| types | list | 可选 | 所选类别 默认
[
0, 1
]
|
| types | list | 可选 | 所选类别 默认
[
1, 2
]
|
#### 参数示例
```
javascript
{
"types"
:
[
0
]
"types"
:
[
1
,
2
]
}
```
...
...
@@ -97,13 +100,97 @@
"msg"
:
"success"
,
"data"
:[
{
"id"
:
6
,
"product_type"
:
2
,
"product_name"
:
"asdf"
,
"product_property"
:
0
,
"price"
:
0
,
"ids"
:[
1
,
7
]
},
{
"id"
:
11
,
"product_type"
:
2
,
"product_name"
:
"testa"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
8
,
9
,
10
]
},
{
"id"
:
13
,
"product_type"
:
2
,
"product_name"
:
"testb"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
8
,
9
,
10
]
},
{
"id"
:
1
,
"product_type"
:
1
,
"product_name"
:
"ss"
,
"product_property"
:
0
,
"price"
:
0
,
"productitems"
:[
],
"ids"
:[
]
},
{
"id"
:
7
,
"product_type"
:
0
,
// 产品类型
"product_name"
:
"ssda"
// 产品名称
"product_type"
:
1
,
"product_name"
:
"ssda"
,
"product_property"
:
0
,
"price"
:
0
,
"ids"
:[
]
},
{
"id"
:
8
,
"product_type"
:
1
,
"product_name"
:
"test"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
]
},
{
"id"
:
9
,
"product_type"
:
1
,
"product_name"
:
"test"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
]
},
{
"id"
:
10
,
"product_type"
:
1
,
"product_name"
:
"test"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
]
},
{
"id"
:
12
,
"product_type"
:
1
,
"product_name"
:
"testa"
,
"product_property"
:
0
,
"price"
:
1
,
"ids"
:[
]
}],
"requestid"
:
"
7451247abe9546d88a93c274d5d9c90a
"
"requestid"
:
"
3416a203177940c1b58354132f778f00
"
}
```
## **<a name="getByIds"> 根据 id 数组查询 </a>**
...
...
@@ -141,7 +228,8 @@
"id"
:
6
,
"source_id"
:
10001
,
"product_name"
:
"asdf"
,
// 产品名称
"product_type"
:
1
,
// 产品类型
"product_type"
:
2
,
// 产品类型
"product_property"
:
0
,
"product_desc"
:
"0"
,
// 产品描述
"price"
:
0
,
// 产品价格
"cost"
:
0
,
...
...
@@ -154,7 +242,8 @@
"id"
:
7
,
"source_id"
:
10001
,
"product_name"
:
"ssda"
,
"product_type"
:
0
,
"product_type"
:
1
,
"product_property"
:
0
,
"product_desc"
:
"0"
,
"price"
:
0
,
"cost"
:
0
,
...
...
@@ -203,8 +292,9 @@
"id"
:
1
,
"source_id"
:
10001
,
"product_name"
:
"ss"
,
// 产品名称
"product_type"
:
0
,
// 产品类型
"product_type"
:
1
,
// 产品类型
"product_desc"
:
"0"
,
// 产品描述
"product_property"
:
0
,
"price"
:
0
,
// 产品价格
"cost"
:
0
,
"created_at"
:
"2020-06-28T17:37:28.000Z"
,
...
...
@@ -216,7 +306,8 @@
"id"
:
7
,
"source_id"
:
10001
,
"product_name"
:
"ssda"
,
"product_type"
:
0
,
"product_type"
:
1
,
"product_property"
:
0
,
"product_desc"
:
"0"
,
"price"
:
0
,
"cost"
:
0
,
...
...
@@ -247,11 +338,12 @@
| id | number | 可选 | 更新产品的主键 如果没有则为创建 |
| source_id | number | 可选 | 产品来源 id 默认 10001 |
| product_name | string | 必选 | 产品名称 |
| product_type | number | 必选 | 产品类型 0: 单产品 1: 组合产品 |
| product_type | number | 必选 | 产品类型 1: 单产品 2: 组合产品 |
| product_desc | string | 可选 | 产品描述 |
| price | number | 可选 | 默认 0 |
| cost | number | 可选 | 默认 0 |
| api | string | 可选 | |
| items | list | 限定必选 | 子产品 id 列表
<br>
如果 product_type 为
1 则必有此项
<br>
如果为 0
则必没有此项 |
| items | list | 限定必选 | 子产品 id 列表
<br>
如果 product_type 为
2 则必有此项
<br>
如果为 1
则必没有此项 |
#### 参数示例
...
...
@@ -259,7 +351,8 @@
{
"source_id"
:
10001
,
"product_name"
:
"testa"
,
"product_type"
:
1
,
"product_type"
:
2
,
"product_property"
:
0
,
"product_desc"
:
"testa"
,
"price"
:
1
,
"cost"
:
0
,
...
...
@@ -279,3 +372,82 @@
"requestid"
:
"e6f7a5e50e404296ad47c92f43a54de4"
}
```
## **<a name="apiList"> 获取 api </a>**
[
返回到目录
](
#menu
)
#### HTTP 请求方式 `POST`
#### 接口地址 `/web/product/productCtl/apiList`
#### 返回结果
```
javascript
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:[
{
"key"
:
"nameTwo_1"
,
"name"
:
"姓名二要素-e签宝"
},
{
"key"
:
"sign_1"
,
"name"
:
"手动签-e签宝"
},
{
"key"
:
"autoSign_1"
,
"name"
:
"静默签-e签宝"
},
{
"key"
:
"bankThree_2"
,
"name"
:
"银行卡三要素-兰铂旺"
},
{
"key"
:
"bankFour_2"
,
"name"
:
"银行卡四要素-兰铂旺"
}],
"requestid"
:
"d8dbbd33f0294f9e8b3fbfac51165f57"
}
```
## **<a name="apiMap"> 获取 api </a>**
[
返回到目录
](
#menu
)
#### HTTP 请求方式 `POST`
#### 接口地址 `/web/product/productCtl/apiMap`
#### 返回结果
```
javascript
{
"status"
:
0
,
"msg"
:
"success"
,
"data"
:{
"nameTwo_1"
:{
"key"
:
"nameTwo_1"
,
"name"
:
"姓名二要素-e签宝"
},
"sign_1"
:{
"key"
:
"sign_1"
,
"name"
:
"手动签-e签宝"
},
"autoSign_1"
:{
"key"
:
"autoSign_1"
,
"name"
:
"静默签-e签宝"
},
"bankThree_2"
:{
"key"
:
"bankThree_2"
,
"name"
:
"银行卡三要素-兰铂旺"
},
"bankFour_2"
:{
"key"
:
"bankFour_2"
,
"name"
:
"银行卡四要素-兰铂旺"
}
},
"requestid"
:
"08483f755eeb48928e7eb201252b8476"
}
```
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