修复了财务记录和购货订单的逻辑错误,优化了时间选择逻辑。

This commit is contained in:
mkm 2024-05-23 16:39:30 +08:00
parent 8aa441214d
commit f2277960c2
3 changed files with 7 additions and 19 deletions

View File

@ -261,21 +261,8 @@ class OpurchaseclassLogic extends BaseLogic
}
$number=Opurchaseclass::where('id',$find['order_id'])->value('number');
$time=time();
//平台支出
$record[] = [
'financial_record_sn' => $time,
'order_id' => $find['order_id'],
'number_sn' => $number,
'user_id' => 0,
'financial_type' => OrderEnum::PLATFORM_ORDER_PAY,
'financial_pm' => OrderEnum::EXPENDITURE,
'number' => $price,
'status' => 1,
'type' => OrderEnum::USER,
'mer_id' => getenv('OPERATED')
];
//供应链获得流水
$record[] = [
$record = [
'financial_record_sn' => $time,
'order_id' => $find['order_id'],
'number_sn' => $number,
@ -287,7 +274,7 @@ class OpurchaseclassLogic extends BaseLogic
'type' => OrderEnum::SUPPLIER,
'mer_id' => $find['supplier_id'],
];
(new FinancialRecord())->saveAll($record);
FinancialRecord::create($record);
}
$res = $find->save();
if ($res) {

View File

@ -23,8 +23,9 @@ class FinancialRecordController extends BaseApiController
{
$start_time = $this->request->get('start_time');
$end_time = $this->request->get('end_time');
if(!isset($start_time)||!isset($end_time)){
return $this->fail('请选择时间');
if(isset($start_time)||isset($end_time)){
$start_time=date('Y-m-d',time());
$end_time=date('Y-m-d',strtotime('-7 days'));
}
$start_time = strtotime($start_time); // 开始时间
$end_time = strtotime($end_time); // 结束时间

View File

@ -88,7 +88,7 @@ class OpurchaseOrderController extends BaseApiController
}
/**
* @notes 创建购货订单
* @notes 商户创建购货订单
*/
public function createOrder(){
$params=$this->request->post();
@ -98,7 +98,7 @@ class OpurchaseOrderController extends BaseApiController
}else{
PayNotifyLogic::handle('opurchaseclass', $order['number']);
//推送队列
Redis::send('push-supplier-products', ['order_id'=>$order['id']]);
// Redis::send('push-supplier-products', ['order_id'=>$order['id']]);
return $this->success('支付成功');
}
}