Commit 8e4a39ea by 孙亚楠

d

parent e52c8cf9
......@@ -59,13 +59,13 @@ class ActionAPI extends APIBase {
case "saveEorderAuthLog":// 保存身份认证日志
opResult = await this.eorderauthlogSve.saveEorderAuthLog(action_body);
break;
case "pageEorderAuthLog":// 保存身份认证日志
case "pageEorderAuthLog":// 身份认证日志列表
opResult = await this.eorderauthlogSve.pageEorderAuthLog(action_body);
break;
case "saveEorderSignLog":// 保存签约日志
opResult = await this.eordersignlogSve.saveEorderSignLog(action_body);
break;
case "pageEorderSignLog":// 保存签约日志
case "pageEorderSignLog":// 签约日志列表
opResult = await this.eordersignlogSve.pageEorderSignLog(action_body);
break;
default:
......
......@@ -25,6 +25,9 @@ class EorderauthlogDao extends Dao{
if(params.id){
sql.push('and id=:id');
}
if(params.merchant_id){
sql.push('and merchant_id=:merchant_id');
}
if(params.order_id){
sql.push('and order_id=:order_id');
}
......
......@@ -50,8 +50,8 @@ class EorderproductDao extends Dao{
*/
async findAllByOrderIdCreatedAsc(params){
let sql = [];
sql.push(`SELECT t1.order_id FROM e_order_product t1 INNER JOIN e_order t2 ON t1.order_id = t2.id where 1=1 and t2.live_status ='20'`);
sql.push(`t1.id =:id`);
sql.push(`SELECT t1.order_id,t1.product_id FROM e_order_product t1 INNER JOIN e_order t2 ON t1.order_id = t2.id where 1=1 and t2.live_status ='20'`);
sql.push(`t1.product_id =:product_id`);
sql.push(`ORDER BY t2.created_at ASC`);
let list = await this.customQuery(sql.join(" "), params);
return list;
......
......@@ -5,6 +5,7 @@
module.exports = function (db, DataTypes) {
return db.define('eorderauthlog', {
order_id: {type: DataTypes.STRING, field: 'order_id', allowNull: true, defaultValue:'',comment:'订单号' },
merchant_id: {type: DataTypes.STRING, field: 'merchant_id', allowNull: true, defaultValue:'',comment:'商户id' },
product_id: {type: DataTypes.STRING, field: 'product_id', allowNull: true,defaultValue:'', comment:'产品id'},
spended_at: {type: DataTypes.DATE, field: 'spended_at', allowNull: true, defaultValue:null, comment:'生效时间' },
platform_id: {type: DataTypes.STRING, field: 'platform_id', allowNull: true, defaultValue:'',comment:'平台ID' },
......
......@@ -6,6 +6,7 @@ module.exports = function (db, DataTypes) {
return db.define('eordersignlog', {
order_id: {type: DataTypes.STRING, field: 'order_id', allowNull: true, defaultValue:'',comment:'订单号' },
product_id: {type: DataTypes.STRING, field: 'product_id', allowNull: true,defaultValue:'', comment:'产品id'},
merchant_id: {type: DataTypes.STRING, field: 'merchant_id', allowNull: true, defaultValue:'',comment:'商户id' },
spended_at: {type: DataTypes.DATE, field: 'spended_at', allowNull: true, defaultValue:null, comment:'生效时间' },
platform_id: {type: DataTypes.STRING, field: 'platform_id', allowNull: true, defaultValue:'',comment:'平台ID' },
platform_name: {type: DataTypes.STRING, field: 'platform_name', allowNull: true,defaultValue:'', comment:'平台名称' },
......
......@@ -146,11 +146,14 @@ class EorderSve extends ServiceBase {
if(!params.id){
return system.getResult(null,`参数错误 订单ID不能为空`);
}
let orderBean = await this.dao.getById(this.trim(params.id));
if(!orderBean){
return system.getResult(null, `订单【${params.id}】不存在`);
}
if(params.merchant_id && this.trim(params.merchant_id)!=orderBean.merchant_id){
return system.getResult(null, `参数错误 订单【${params.id}】不存在`);
}
try{
let orderProperties = {id:orderBean.id,audit_status:this.trim(params.audit_status),audit_remark:this.trim(params.audit_remark) || ""};
orderProperties.live_status = params.audit_status == '20' ? '20' : '30';
......@@ -176,6 +179,9 @@ class EorderSve extends ServiceBase {
if(!orderBean){
return system.getResult(null, `订单【${params.id}】不存在`);
}
if(params.merchant_id && this.trim(params.merchant_id)!=orderBean.merchant_id){
return system.getResult(null, `参数错误 订单【${params.id}】不存在`);
}
//如果支付状态
if (params.pay_status && orderBean.pay_status == '10' && this.PAY_STATUS.includes(this.trim(params.pay_status))) {
orderBean.pay_status = this.trim(params.pay_status);
......@@ -215,6 +221,10 @@ class EorderSve extends ServiceBase {
if(!orderBean){
return system.getResult(null, `订单不存在`);
}
if(params.merchant_id && this.trim(params.merchant_id)!=orderBean.merchant_id){
return system.getResult(null, `参数错误 订单【${params.id}】不存在`);
}
let productIds = await this.eorderproductDao.model.findAll({
where:{
order_id:orderBean.id
......
......@@ -25,6 +25,10 @@ class EorderauthlogSve extends ServiceBase {
if(!params.actual_spend_name){
return system.getResult(null, `参数错误 实际使用方不能为空`);
}
if(!params.platform_name){
return system.getResult(null, `参数错误 平台名称不能为空`);
}
params.platform_id=params.platform_id?params.platform_id:'';
params.spended_num = Number(params.spended_num || 0);
params.spended_at = params.spended_at?params.spended_at:new Date();
try{
......@@ -36,6 +40,7 @@ class EorderauthlogSve extends ServiceBase {
if(!orderBean){
return system.getResult(null, `订单【${params.order_id}】不存在`);
}
params.merchant_id = orderBean.merchant_id;
await this.dao.create(params);
}catch (e) {
console.log(e);
......
......@@ -14,10 +14,10 @@ class EorderproductSve extends ServiceBase {
*/
async listEorderProduct(params){
try{
if(!params.id){
if(!params.product_id){
return system.getResult(null, `参数错误 产品ID不能为空`);
}
let list = await this.dao.model.findAllByOrderIdCreatedAsc({id:this.trim(params.id)});
let list = await this.dao.model.findAllByOrderIdCreatedAsc({product_id:this.trim(params.product_id)});
return system.getResult(list || []);
}catch (e) {
console.log(e);
......@@ -31,9 +31,9 @@ class EorderproductSve extends ServiceBase {
* @returns {Promise<void>}
*/
async listEorderProductByMerchantId(params){
if(!params.merchant_id){
return system.getResult(null, `参数错误 商户ID 不能为空`);
}
// if(!params.merchant_id){
// return system.getResult(null, `参数错误 商户ID 不能为空`);
// }
let list = await this.dao.model.findAll({
where:{
merchant_id: this.trim(params.merchant)
......
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