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
6701fd59
Commit
6701fd59
authored
Jul 16, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ucommunt-back
parent
7817f1e0
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
271 additions
and
0 deletions
+271
-0
ucommune-back/app/base/api/impl/backAction/ucommune.js
+52
-0
ucommune-back/app/base/service/impl/backUtilsSve/utilsUcommuneSve.js
+219
-0
ucommune-back/app/config/routes/api.js
+0
-0
No files found.
ucommune-back/app/base/api/impl/backAction/ucommune.js
0 → 100644
View file @
6701fd59
var
WEBBase
=
require
(
"../../web.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
class
ProductAPI
extends
WEBBase
{
constructor
()
{
super
();
this
.
utilsUcommuneSve
=
system
.
getObject
(
"service.backUtilsSve.utilsUcommuneSve"
);
}
/**
* 优客工厂
* 接口跳转-POST请求
* action_type 执行的类型
* action_body 执行的参数
*/
async
springBoard
(
pobj
,
qobj
,
req
)
{
if
(
!
pobj
.
actionType
)
{
return
system
.
getResult
(
null
,
"actionType参数不能为空"
);
}
var
result
=
await
this
.
opActionProcess
(
pobj
,
pobj
.
actionType
,
req
);
return
result
;
}
async
opActionProcess
(
pobj
,
action_type
,
req
)
{
var
opResult
=
null
;
switch
(
action_type
)
{
case
"getStatistics"
:
// 概览-业务统计
opResult
=
await
this
.
utilsUcommuneSve
.
getStatistics
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getTrend"
:
// 概览-业务统计
opResult
=
await
this
.
utilsUcommuneSve
.
getTrend
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getProductTypesales"
:
// 概览-产品销售分布
opResult
=
await
this
.
utilsUcommuneSve
.
getProductTypesales
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getCustomerArea"
:
// 概览-客户地域分布
opResult
=
await
this
.
utilsUcommuneSve
.
getCustomerArea
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderInfo"
:
// 订单列表
opResult
=
await
this
.
utilsUcommuneSve
.
getOrderInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"getOrderDelivery"
:
// 订单详情
opResult
=
await
this
.
utilsUcommuneSve
.
getOrderDelivery
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
ProductAPI
;
\ No newline at end of file
ucommune-back/app/base/service/impl/backUtilsSve/utilsUcommuneSve.js
0 → 100644
View file @
6701fd59
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
AppServiceBase
=
require
(
"../../app.base"
);
const
axios
=
require
(
'axios'
)
const
md5
=
require
(
'md5'
)
var
AlipaySdk
=
require
(
'alipay-sdk'
).
default
;
var
WXPay
=
require
(
'wx-pay'
);
var
xml2js
=
require
(
'xml2js'
);
//产品操作类
class
UtilsUcommuneService
extends
AppServiceBase
{
constructor
()
{
super
();
this
.
centerOrderUrl
=
settings
.
centerOrderUrl
();
}
//--------------------------------优客工厂相关接口-start-----------------------------------------------------
/**
* 业务统计
* @param {*} pobj
* @param {*} actionBody
*/
async
getStatistics
(
pobj
,
actionBody
)
{
var
reqUrl
=
this
.
centerOrderUrl
+
"action/ucommuneOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* 趋势分析
* @param {*} pobj
* @param {*} actionBody
*/
async
getTrend
(
pobj
,
actionBody
)
{
var
obj
=
{
date
:
[
"1"
],
pay
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
0
,
1
,
2
],
need
:
[
0
,
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
0
,
1
,
2
]
}
return
system
.
getResultSuccess
(
obj
);
}
/**
* 产品销售分布
* @param {*} pobj
* @param {*} actionBody
*/
async
getProductTypesales
(
pobj
,
actionBody
)
{
var
obj
=
{
productType
:
[
"sbzc"
],
sum
:
[
666
]
}
return
system
.
getResultSuccess
(
obj
);
}
/**
* 客户地域分布
* @param {*} pobj
* @param {*} actionBody
*/
async
getCustomerArea
(
pobj
,
actionBody
)
{
var
obj
=
[
{
name
:
"北京"
,
value
:
1
},
{
name
:
"西藏"
,
value
:
1
},
{
name
:
"天津"
,
value
:
1
},
{
name
:
"新疆"
,
value
:
1
},
{
name
:
"青海"
,
value
:
1
},
{
name
:
"甘肃"
,
value
:
1
},
{
name
:
"宁夏"
,
value
:
1
},
{
name
:
"台湾"
,
value
:
1
}
]
return
system
.
getResultSuccess
(
obj
);
}
/**
* 订单列表
* @param {*} pobj
* @param {*} actionBody
*/
async
getOrderInfo
(
pobj
,
actionBody
)
{
var
obj
=
[{
orderNo
:
"OT37202007041210tTCU"
,
produuctName
:
"产品名字"
,
tmName
:
"商标名字"
,
quantity
:
1
,
contactName
:
"lin"
,
totalSum
:
"300"
,
deliveryStatusName
:
"待审核"
,
updateAt
:
"2020-07-14 11:00:00"
}]
return
system
.
getResultSuccess
(
obj
);
}
/**
* 订单详情
* @param {*} pobj
* @param {*} actionBody
*/
async
getOrderDelivery
(
pobj
,
actionBody
)
{
return
system
.
getResultSuccess
({});
}
//--------------------------------优客工厂相关接口--end----------------------------------------------------
/**
* 优客调取订单列表用
* @param {*} pobj
* @param {*} actionBody
*/
async
ucommuneGetOrderList
(
pobj
,
actionBody
)
{
// ucommuneGetOrderList
var
reqUrl
=
this
.
centerOrderUrl
+
"action/ucommuneOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
"-------------ucommuneGetOrderList result start---------------"
)
console
.
log
(
result
)
console
.
log
(
"-------------ucommuneGetOrderList result end---------------"
)
return
result
;
}
/**
* 根据优客token获取用户信息,生成userPin返回前端
* @param {*} pobj
* @param {*} actionBody userToken 为优客工厂的userToken
*/
async
getUserInfo
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
userToken
)
{
return
system
.
getResult
(
null
,
"actionBody.token can not be empty,100410"
);
}
var
url
=
settings
.
ucommuneUrl
()
+
"third/getUserInfo"
;
// 调用优客工场接口 获取用户信息
// 拼接规则curl -k -H 'Content-type: application/json' -H 'authorization:{token}' -X POST {url} pobj作为发生错误时记录日志用
let
result
=
await
this
.
restPostWithHAuthorizationUrl
(
pobj
,
actionBody
.
userToken
,
url
);
if
(
result
.
retCode
==
0
)
{
// 0成功 1失败
pobj
.
actionType
=
"getLoginByUserName"
;
pobj
.
actionBody
.
channelUserId
=
result
.
data
.
nationalCode
+
"-"
+
result
.
data
.
mobile
;
// 即:86_18512345678
pobj
.
actionBody
.
userName
=
result
.
data
.
mobile
;
pobj
.
actionBody
.
nickName
=
result
.
data
.
name
;
pobj
.
actionBody
.
mobile
=
result
.
data
.
mobile
;
pobj
.
actionBody
.
headUrl
=
result
.
data
.
headImg
;
pobj
.
actionBody
.
userpin
=
pobj
.
actionBody
.
userpin
||
this
.
getUUID
();
var
tmpOpResult
=
await
this
.
utilsAuthSve
.
getLoginByUserName
(
pobj
,
pobj
.
actionBody
);
if
(
tmpOpResult
.
status
!=
0
&&
tmpOpResult
.
status
!=
2060
)
{
return
tmpOpResult
;
}
return
system
.
getResultSuccess
({
userpin
:
tmpOpResult
.
data
.
userpin
?
tmpOpResult
.
data
.
userpin
:
pobj
.
actionBody
.
userpin
})
}
else
{
// 获取用户信息失败
return
system
.
getResult
(
null
,
result
);
}
}
/**
* 优客调取订单列表用
* @param {*} pobj
* @param {*} actionBody
*/
async
ucommuneGetOrderList
(
pobj
,
actionBody
)
{
// ucommuneGetOrderList
var
reqUrl
=
this
.
centerOrderUrl
+
"action/ucommuneOrder/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
console
.
log
(
"-------------ucommuneGetOrderList result start---------------"
)
console
.
log
(
result
)
console
.
log
(
"-------------ucommuneGetOrderList result end---------------"
)
return
result
;
}
/**
* addOrder后进入支付页面获取支付金额 addorder返回totalsum 此接口可以不调用
* @param {*} pobj
* @param {*} actionBody orderNo orderIndo订单号
*/
async
orderTotalSum
(
pobj
,
actionBody
)
{
pobj
.
actionType
=
"getOrderDetails"
// 获取订单详细信息 totalsum为总金额,返回给前端
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* 点击确认支付后返回拼接字符串 orderConfirm 的验证数据方法
* @param {*} pobj
* @param {*} actionBody orderNo orderIndo订单号
*/
async
orderCheck
(
pobj
,
actionBody
)
{
pobj
.
actionType
=
"getOrderDetails"
// 获取订单详细信息 totalsum为总金额,返回给前端
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* 点击确认支付后返回拼接字符串 orderConfirm 的验证数据方法
* @param {*} pobj
* @param {*} actionBody orderNo orderIndo订单号
*/
async
orderConfirmValidate
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
orderNo
)
{
// 订单号
return
system
.
getResult
(
null
,
"actionBody.orderNo can not be empty,100430"
);
}
if
(
!
actionBody
.
payWay
)
{
// 支付方式 1 支付宝 3微信
return
system
.
getResult
(
null
,
"actionBody.payWay can not be empty,100440"
);
}
if
(
actionBody
.
payWay
!=
1
||
actionBody
.
payWay
!=
3
)
{
// payway 非1非3
return
system
.
getResult
(
null
,
"actionBody.payWay is eoor values,100450"
);
}
}
/**
* 订单详情
* @param {*} pobj
* @param {*} actionBody orderNo orderIndo订单号
*/
async
ucommuneGetOrderDetail
(
pobj
,
actionBody
)
{
return
system
.
getResultSuccess
()
}
}
module
.
exports
=
UtilsUcommuneService
;
\ No newline at end of file
ucommune-back/app/config/routes/api.js
View file @
6701fd59
This diff is collapsed.
Click to expand it.
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