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
b1b548a4
Commit
b1b548a4
authored
Jun 13, 2020
by
linboxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
定义优客actiontype
parent
f2f5206c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
10 deletions
+60
-10
center-channel/app/base/api/impl/action/newName.js
+40
-0
center-channel/app/base/api/impl/action/ucommune.js
+2
-0
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
+18
-10
No files found.
center-channel/app/base/api/impl/action/newName.js
0 → 100644
View file @
b1b548a4
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.utilsSve.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
"getIndustryInfo"
:
// 获取行业信息
opResult
=
await
this
.
utilsUcommuneSve
.
getUserInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"placeOrder"
:
// 提交订单
opResult
=
await
this
.
utilsUcommuneSve
.
getOrderList
(
pobj
,
pobj
.
actionBody
);
break
;
default
:
opResult
=
system
.
getResult
(
null
,
"action_type参数错误"
);
break
;
}
return
opResult
;
}
}
module
.
exports
=
ProductAPI
;
\ No newline at end of file
center-channel/app/base/api/impl/action/ucommune.js
View file @
b1b548a4
...
...
@@ -25,6 +25,8 @@ class ProductAPI extends WEBBase {
case
"getUserInfo"
:
// 根据优客token获取用户信息,生成userPin返回前端
opResult
=
await
this
.
utilsUcommuneSve
.
getUserInfo
(
pobj
,
pobj
.
actionBody
);
break
;
case
"orderConfirm"
:
// addOrder后调取支付
opResult
=
await
this
.
utilsUcommuneSve
.
orderConfirm
(
pobj
,
pobj
.
actionBody
);
case
"getOrderList"
:
// 优客调取订单列表用
opResult
=
await
this
.
utilsUcommuneSve
.
getOrderList
(
pobj
,
pobj
.
actionBody
);
break
;
...
...
center-channel/app/base/service/impl/utilsSve/utilsUcommuneSve.js
View file @
b1b548a4
...
...
@@ -12,13 +12,13 @@ class UtilsUcommuneService extends AppServiceBase {
/**
*
通过产品类别编码路径获取产品列表
*
根据优客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"
);
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作为发生错误时记录日志用
...
...
@@ -33,20 +33,28 @@ class UtilsUcommuneService extends AppServiceBase {
}
return
system
.
getResultSuccess
({
userpin
:
tmpOpResult
.
data
.
userpin
})
}
else
{
// 获取用户信息失败
return
system
.
getResult
(
null
,
"Failed to get user information, 100420"
);
}
}
/**
*
获取产品详情
* @param {*} pobj
* @param {*} actionBody
channelItemCode 渠道产品编码
*
优客调取订单列表用
* @param {*} pobj
* @param {*} actionBody
*/
async
getOrderList
(
pobj
,
actionBody
)
{
if
(
!
actionBody
.
channelItemCode
)
{
return
system
.
getResult
(
null
,
"actionBody.channelItemCode can not be empty,100340"
);
}
var
url
=
settings
.
centerAppUrl
()
+
"action/opProduct/springBoard"
;
return
await
this
.
restPostUrl
(
pobj
,
url
);
var
reqUrl
=
this
.
centerOrderUrl
+
"action/order/springBoard"
;
var
result
=
await
this
.
restPostUrl
(
pobj
,
reqUrl
);
return
result
;
}
/**
* addOrder后前端调取支付用
* @param {*} pobj
* @param {*} actionBody channelItemCode 渠道产品编码
*/
async
orderConfirm
(
pobj
,
actionBody
)
{
}
//--------------------------------优客工厂相关接口--end----------------------------------------------------
...
...
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