Commit b329c2a8 by 孙亚楠

dd

parent 7393032f
...@@ -710,6 +710,9 @@ class OrderCtl extends CtlBase { ...@@ -710,6 +710,9 @@ class OrderCtl extends CtlBase {
"8":"2080",//客户交付 "8":"2080",//客户交付
"9":"2090"//订单完成 "9":"2090"//订单完成
}; };
if(!pobj.saas_id){
return system.getResult(null, `登录失效,请重新登录`);
}
var condition = { var condition = {
currentPage: Number(pobj.currentPage || 1), currentPage: Number(pobj.currentPage || 1),
pageSize: Number(pobj.pageSize || 10), pageSize: Number(pobj.pageSize || 10),
...@@ -727,6 +730,9 @@ class OrderCtl extends CtlBase { ...@@ -727,6 +730,9 @@ class OrderCtl extends CtlBase {
if(pobj.order_id){ if(pobj.order_id){
condition.id = this.trim(pobj.order_id); condition.id = this.trim(pobj.order_id);
} }
if(pobj.saas_id){
condition.saas_id = this.trim(pobj.saas_id);
}
this.doTimeCondition(condition, ["createdBegin", "createdEnd"]); this.doTimeCondition(condition, ["createdBegin", "createdEnd"]);
return await this.orderSve.aliOrderPageAll(condition); return await this.orderSve.aliOrderPageAll(condition);
} }
......
const system = require("../../../system"); const system = require("../../../system");
const ServiceBase = require("../../svems.base") const ServiceBase = require("../../svems.base")
const settings = require("../../../../config/settings") const settings = require("../../../../config/settings")
const axios = require("axios");
class OrderService extends ServiceBase { class OrderService extends ServiceBase {
constructor() { constructor() {
super(); super();
...@@ -25,8 +26,67 @@ class OrderService extends ServiceBase { ...@@ -25,8 +26,67 @@ class OrderService extends ServiceBase {
return rs; return rs;
} }
/**
* fn:订单处理流程 (ps:如果有推送状态 这需要 完善puhsOrderInfo)
* @param params
* @returns {Promise<{msg: string, data, bizmsg: *|string, status: number}|*|undefined>}
*/
async handleStatus(params) { async handleStatus(params) {
return await this.callms("order", "handleStatus", params); let rs= await this.callms("order", "handleStatus", params);
if(rs && rs.status === 0) {
this.pushOrderInfo(params);
}
return rs;
}
/**
* fn:推送到业务系统(paltforme)
* @param params
* @returns {Promise<void>}
*
* ps:所有状态
*
*/
async pushOrderInfo(params) {
let order = await this.callms("order", "orderInfo", params) || {};
order = order.data;
if (!order) {
return;
}
if(!order.saas_deliver_api) {
return;
}
if(params.status == 1190) {
let data = {
source_no: order.source_no,
status: order.status,
guest_mail_no: params.guest_mail_no,
guest_mail_img: params.guest_mail_img
}
axios({
method: 'post',
url: order.saas_deliver_api,
data: data
});
}else if(params.status == 1200 || params.status==2090){ //推送saas平台个体工商户信息
let obusinessmen = await this.callms("order", "queryObusinessmenInfo", params) || {};
obusinessmen = obusinessmen.data;
if (!obusinessmen) {
return;
}
if(!obusinessmen.saas_deliver_api) {
return;
}
obusinessmen.status = "2000000";
let a = await axios({
method: 'post',
url: obusinessmen.saas_deliver_api,
data: obusinessmen
});
console.log(a)
}
} }
async orderInfo(params) { async orderInfo(params) {
......
...@@ -30,6 +30,7 @@ module.exports = function (app) { ...@@ -30,6 +30,7 @@ module.exports = function (app) {
res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild, xggadminsid'); res.header('Access-Control-Allow-Headers', 'Content-Type, Content-Length, Authorization, Accept, X-Requested-With , yourHeaderFeild, xggadminsid');
res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS'); res.header('Access-Control-Allow-Methods', 'PUT, POST, GET, DELETE, OPTIONS');
// res.header('Access-Control-Allow-Credentials', 'true'); // res.header('Access-Control-Allow-Credentials', 'true');
res.header('content-type', 'text/html;charset=UTF-8');
if (req.method == 'OPTIONS') { if (req.method == 'OPTIONS') {
res.send(200); //让options请求快速返回/ res.send(200); //让options请求快速返回/
} }
......
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