Commit 71f2341a by linboxuan

优客拉取订单

parent 0bc607a6
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/main.js"
}
]
}
\ No newline at end of file
var APIBase = require("../../api.base");
var system = require("../../../system");
var settings = require("../../../../config/settings");
class ucommuneOrder extends APIBase {
constructor() {
super();
this.orderinfoSve = system.getObject("service.dbcorder.orderinfoSve");
this.ucommuneOrderSve = system.getObject("service.dbcorder.ucommuneOrderSve");
}
/**
* 接口跳转-POST请求
* action_process 执行的流程
* action_type 执行的类型
* action_body 执行的参数
*/
async springBoard(pobj, qobj, req) {
if (!pobj.appInfo) {
return system.getResult(null, "请检查token,100460");
}
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 "ucommuneGetOrderList":
opResult = await this.ucommuneOrderSve.getOrderInfo(pobj,pobj.actionBody);
break;
default:
opResult = system.getResult(null, "action_type参数错误");
break;
}
return opResult;
}
}
module.exports = ucommuneOrder;
\ No newline at end of file
const system = require("../../../system");
const ServiceBase = require("../../sve.base");
class OrderInfoService extends ServiceBase {
constructor() {
super("dbcorder", ServiceBase.getDaoName(OrderInfoService));
}
async getOrderInfo(pobj, actionBody) {//获取订单列表信息
var pageSize = Number(actionBody.pageSize || 20);
if (pageSize > 50) {
pageSize = 50;
}
var pageIndex = Number(actionBody.pageIndex || 1);
var from = pageIndex == 1 ? 0 : Number((pageIndex - 1) * pageSize);
var paramWhere = {};
// var sql = "select `isSolution`,`orderNo`,`channelServiceNo`,`channelOrderNo`,`channelUserId`,`ownerUserId`,`payTime`,`quantity`,`serviceQuantity`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`,"
// + " `invoiceApplyStatus`,`opNotes`,`channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,channelItemAppendName,`serviceItemCode`,`picUrl`,created_at from v_order where uapp_id=:uapp_id";
// var sqlCount = "select count(1) as dataCount from v_order where uapp_id=:uapp_id";
var sql = "select `orderNo`,`channelUserId`,`payTime`,`orderStatusName`,`orderStatus`,`totalSum`,`payTotalSum`,`refundSum`,"
+ " `channelItemCode`,`channelItemName`,`price`,priceDesc,priceTypeName,`serviceItemCode`,`picUrl`,created_at from v_order where uapp_id=:uapp_id";
var sqlCount = "select count(1) as dataCount from v_order where uapp_id=:uapp_id";
paramWhere.uapp_id = pobj.appInfo.uapp_id;
if (actionBody.orderStatus) {
sql += " and orderStatus=:orderStatus";
sqlCount += " and orderStatus=:orderStatus";
paramWhere.orderStatus = actionBody.orderStatus;
}
if (actionBody.startTime && actionBody.entTime) {
var startTime = actionBody.startTime.trim() + " 00:00:00";
var entTime = actionBody.entTime + " 23:59:59";
sql += " and created_at >=:startTime and created_at<=:entTime";
sqlCount += " and created_at >=:startTime and created_at<=:entTime";
paramWhere.startTime = startTime;
paramWhere.entTime = entTime;
}
sql += " order by id desc LIMIT " + pageSize + " OFFSET " + from;
var list = await this.customQuery(sql, paramWhere);
var result = system.getResultSuccess(list);
var tmpResultCount = await this.customQuery(sqlCount, paramWhere);
result.dataCount = tmpResultCount && tmpResultCount.length > 0 ? tmpResultCount[0].dataCount : 0;
return result;
}
}
module.exports = OrderInfoService;
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