Commit c8e114d8 by 宋毅

tj

parent b2e93039
......@@ -22,7 +22,7 @@ class ProductAPI extends APIBase {
var result = await this.opActionProcess(pobj, pobj.actionType, req);
return result;
}
async opActionProcess(pobj, action_type, req) {
async opActionProcess(pobj, action_type, req) {//-------操作为启服通数据
var opResult = null;
switch (action_type) {
case "getProductList"://通过产品类别编码路径获取产品列表
......
......@@ -54,8 +54,8 @@ class TmOrderAPI extends APIBase {
// action_body.app = { id:2,uappKey:"201911131657",uAppId:9,appSecret:"eeb18393aade40149287b024d8ba0850"};
// action_body.user = { id: 6, app_id: 2, nickname: "测试用户",channelUserId:"testUserId01" };
var opResult = null;
if (["subOtherOrder", "subTmOrder", "offlinePaymentOrder", "getTmOrderList", "getTmOrderInfo", "getTmApplyInfo", "getTmNclList", "getNeedInfo",
"tmConfirm", "updateTmInfo", "updateNclInfo", "updateContacts",
if (["getOrderInfo", "subOtherOrder", "subTmOrder", "offlinePaymentOrder", "getTmOrderList", "getTmOrderInfo", "getTmApplyInfo", "getTmNclList", "getNeedInfo",
"tmConfirm", "updateTmInfo", "updateNclInfo", "updateContacts", "addQifuOrder",
"updateCustomerInfo", "addOrderAndDelivery", "updateOrderPayStatus"].indexOf(action_type) >= 0) {
if (!action_body.channelUserId) {
return system.getResultFail(-99, "verify channelUserId is empty");
......@@ -63,7 +63,19 @@ class TmOrderAPI extends APIBase {
}
switch (action_type) {
// sy
case "getIcbcOrderDetails"://
case "jdAddQifuOrder":
pobj.actionBody.quantity = 1;
pobj.actionBody.channelOrder.channelServiceNo = pobj.actionBody.needNo;
pobj.actionBody.channelOrder.channelOrderNo = pobj.actionBody.needNoOrderNo;
pobj.actionBody.channelOrder.payTime = new Date();
pobj.actionBody.channelOrder.orderStatus = 2;//订单状态dfk: 1: 待付款, 2: 已付款, 4: 待服务, 8: 已完成
pobj.actionBody.channelOrder.buyerMoblie = pobj.actionBody.buyerMoblie;
opResult = await this.orderSve.addQifuOrder(pobj, pobj.actionBody, req);
break;
case "getOrderInfo":
opResult = await this.orderSve.getOrderInfo(pobj, action_body, req);
break;
case "getIcbcOrderDetails":
opResult = await this.orderSve.getIcbcOrderDetails(pobj, req);
break;
case "againPushFqBusiness"://再次推送商机
......
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class AccessAuthAPI extends APIBase {
constructor() {
super();
......@@ -116,7 +117,7 @@ class AccessAuthAPI extends APIBase {
if (!pobj.secret) {
return system.getResult(null, "pobj.secret参数不能为空");
}
var cacheKey = "getToken:appkey_" + pobj.appkey;
var cacheKey = settings.cacheprefix + "_getToken:appkey_" + pobj.appkey;
var jsonToken = await this.redisClient.get(cacheKey);
if (jsonToken) {
return JSON.parse(jsonToken);
......
......@@ -854,6 +854,80 @@ class OrderService extends ServiceBase {
}
//------------新的产品查询----start---------
/**
* 获取启服务通订单列表信息
* @param {*} pobj
* @param {*} actionBody
*/
async getOrderInfo(pobj, actionBody, req) {
if (!actionBody.channelUserId) {
return system.getResult(null, "actionBody.channelUserId must not empty");
}
var token = "";
var tokenRes = await this.getCenterChannelToken(req.app);
if (tokenRes && tokenRes.status == 0 && tokenRes.data) {
token = tokenRes.data.token;
}
if (!token) {
return system.getResultFail(-88, "获取token失败");
}
//获取用户userpin
var userpin = "";
pobj.actionType = "getLoginByUserName";
pobj.actionBody.userName = actionBody.channelUserId;
pobj.actionBody.mobile = req.user.userMoblie;
var url = settings.centerChannelUrl() + "web/auth/accessAuth/springBoard";
var userpinResult = await this.execClient.execPushDataPost(pobj, url, token);
if (!userpinResult || !userpinResult.stdout) {
return system.getResult(null, userpinResult.msg);
}
var userpinResultTmp = JSON.parse(userpinResult.stdout);
if (userpinResultTmp.status != 0 && userpinResultTmp.status != 2060) {
return system.getResultFail(-99, "获取userpin失败");
}
userpin = userpinResultTmp.data.userpin;
if (!userpin) {
return system.getResultFail(-88, "获取userpin失败!!");
}
url = settings.centerChannelUrl() + "web/opaction/order/springBoard";
pobj.actionType = "getOrderInfo";
var rtn = await this.execClient.execDataPostByTokenUserPin(pobj, url, token, userpin);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
/**
* 添加启服务通订单信息
* @param {*} pobj
* @param {*} actionBody
*/
async addQifuOrder(pobj, actionBody, app) {
if (!actionBody.channelItemCode) {
return system.getResult(null, "actionBody.channelItemCode can not be empty");
}
if (!actionBody.quantity) {
return system.getResult(null, "actionBody.quantity can not be empty");
}
var token = "";
var tokenRes = await this.getCenterChannelToken(app);
if (tokenRes && tokenRes.status == 0 && tokenRes.data) {
token = tokenRes.data.token;
}
if (!token) {
return system.getResultFail(-88, "获取token失败");
}
pobj.actionType = "addOrder";
var url = settings.centerChannelUrl() + "web/opaction/order/springBoard";
var rtn = await this.execClient.execPushDataPost(pobj, url, token);
if (!rtn || !rtn.stdout) {
return system.getResult(null, "execPost is empty");
}
var result = JSON.parse(rtn.stdout);
return result;
}
/**
......
......@@ -7,6 +7,7 @@ class ExecClient {
this.cmdPostPattern = "curl --user admines:adminGSBes. -k -H 'Content-type: application/json' -d '{data}' {url}";
this.cmdGetPattern = "curl -G -X GET '{url}'";
this.cmdPushDataPostPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'request-id:{requestId}' -d '{data}' {url}";
this.cmdDataPostByTokenUserPinPattern = "curl -k -H 'Content-type: application/json' -H 'token:{tk}' -H 'userpin:{UPIN}' -d '{data}' {url}";
}
getUUID() {
......@@ -41,6 +42,13 @@ class ExecClient {
console.log(cmd);
return cmd;
}
execDataPostByTokenUserPinCmd(subData, url, token, userPin) {
var data = JSON.stringify(subData);
var cmd = this.cmdDataPostByTokenUserPinPattern.replace(/\{data\}/g,
data).replace(/\{url\}/g, url).replace(/\{tk\}/g, token).replace(/\{UPIN\}/g, userPin);
console.log(cmd);
return cmd;
}
async execPost(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec(cmd);
......@@ -51,6 +59,11 @@ class ExecClient {
var result = await this.exec(cmd);
return result;
}
async execDataPostByTokenUserPin(subData, url, token, userPin) {
let cmd = this.execDataPostByTokenUserPinCmd(subData, url, token, userPin);
var result = await this.exec(cmd);
return result;
}
async execPost2(subData, url) {
let cmd = this.FetchPostCmd(subData, url);
var result = await this.exec2(cmd);
......
......@@ -3,7 +3,7 @@ var settings={
host: "43.247.184.32",
port: 8967,
password: "Gongsibao2018",
db:8,
db:6,
},
database:{
dbname : "igirl_channel",
......
......@@ -3,6 +3,7 @@
1. [产品列表-根据产品大类获取](#getProductListByOneCode)
1. [产品列表-根据产品二类获取](#getProductListByTwoCode)
1. [产品详情](#getProductDetail)
1. [获取订单列表信息](#getOrderList)
## **<a name="getIcbcOrderDetails"> 获取公司注册详情信息</a>**
[返回到目录](#menu)
......@@ -346,3 +347,82 @@
}
```
## **<a name="getOrderList"> 获取订单列表信息</a>**
[返回到目录](#menu)
##### URL
[/action/tmOrder/springBoard]
#### 参数格式 `JSON`
#### HTTP请求方式 `POST`
#### 请求头中需要增加userpin(用户登录后的凭证)的值
#### 渠道执行的类型 actionType:getOrderList
``` javascript
{
"channelUserId":"15010929366",// Y 渠道用户Id
"pageIndex":1,// Y 当前页
"pageSize":20,// Y 每页大小,最大为50
"channelItemName":"",// N 产品名称
"channelServiceNo":"",// N 渠道订单号
"orderStatus":""// N 订单状态
}
```
#### 返回结果
```javascript
{
"status": 0,// 0为成功,否则失败
"msg": "success",
"data": [
{
"orderNo": "OT31202002191443AVlJ",// 订单号
"channelServiceNo": "",//渠道服务号
"channelOrderNo": "",//渠道订单号列表,格式:XX1,XX2
"channelUserId": "15010929366",//渠道用户Id
"ownerUserId": "15010929366",//拥有者Id
"payTime": null,//支付时间
"quantity": 1,//订单数量
"serviceQuantity": 0,//订单服务数量
"orderStatusName": "待付款",//订单状态名称
"orderStatus": 1,//订单状态编码: 1: 待付款, 2: 已付款, 4: 待服务, 8: 已完成
"totalSum": "10.00",//订单金额
"payTotalSum": "10.00",//订单支付金额
"refundSum": "0.00",//退款金额
"invoiceApplyStatus": "00",//发票申请状态
"opNotes": "",//操作备注
"channelItemCode": "FW_GOODS-582221-1",//渠道产品编码
"channelItemName": "京东云PLUS公司注册(北京市)",//渠道产品名称
"serviceItemCode": null,//服务产品编码
"picUrl": null//产品图片地址
},
{
"orderNo": "OT31202002191456tDU7",
"channelServiceNo": "0001",
"channelOrderNo": "",{
"status": 0,// 0为成功,否则失败
"payUrl": "https://syb.allinpay.com/apiweb/h5unionpay/unionorder?appid=00172286&body=%E5%95%86%E6%A0%87%E6%B3%A8%E5%86%8C%E3%80%90%E4%B8%93%E5%AE%B6%E8%BE%85%E5%8A%A9%E7%94%B3%E8%AF%B7%E3%80%91&charset=UTF-8&cusid=560595073992Z6G&notify_url=http%3A%2F%2Fgsb.qifu.gongsibao.com%3A4012%2Ftlpay%2Fnotify&randomstr=1581758584924&remark=h5paypagesywdy&reqsn=OT26202002151649kPgs&returl=http%3A%2F%2Fgsb.qifu.gongsibao.com%3A4012%2Ftlpay%2Fnotify&sign=439FA9F49D365DC32FE1CA712F5AD848&trxamt=69900&version=12", // H5支付链接
"requestId": "ac22e84d8ebc4df09629c0aff2bb1fe9"
}
"channelUserId": "15010929366",
"ownerUserId": "15010929366",
"payTime": "2020",
"quantity": 1,
"serviceQuantity": 0,
"orderStatusName": "已付款",
"orderStatus": 2,
"totalSum": "10.00",
"payTotalSum": "10.00",
"refundSum": "0.00",
"invoiceApplyStatus": "00",
"opNotes": "",
"channelItemCode": "FW_GOODS-582221-1",
"channelItemName": "京东云PLUS公司注册(北京市)",
"serviceItemCode": null,
"picUrl": null
}
],
"requestId": "92ced0cb4d地址cb4125a4b515227f3eabe1"
}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment