微信退款财务流水

This commit is contained in:
liu 2024-06-24 16:23:20 +08:00
parent 291b0dabb1
commit f649369f08
2 changed files with 28 additions and 0 deletions

View File

@ -46,6 +46,7 @@ class OrderEnum
const CASHIER_FACE_PAY = 17;//现金收银
const PURCHASE_FUNDS = 18;//采购款收银
const PAY_BACK =-1;
/**

View File

@ -293,11 +293,38 @@ class PayNotifyLogic extends BaseLogic
}
//微信日志 user_order_refund
$capitalFlowDao->userIncome('user_order_refund', 'system_back', $order['id'], $deal_money,'',1);
//处理财务流水退还
self::store_finance_back($orderSn);
self::addStock($order['id']);//微信
// self::afterPay($order,$extra['transaction_id']);
}
/**
* 财务退还金额相关
* @param $orderSn
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function store_finance_back($orderSn)
{
$data = StoreFinanceFlow::where('order_sn',$orderSn)
->where(['financial_pm'=>1])
->select()->toArray();
foreach ($data as &$value){
unset($value['id']);
$value['financial_record_sn']=(new StoreFinanceFlowLogic)->getSn();
$value['financial_pm']=0;
$value['financial_type']= OrderEnum::PAY_BACK;
$value['create_time']=time();
}
(new StoreFinanceFlow)->saveAll($data);
}
/**
* 现金退款相关
* @param $orderSn