This commit is contained in:
mkm 2024-01-20 10:50:09 +08:00
parent 2aba6a6d81
commit 7b54109189
6 changed files with 67 additions and 18 deletions

View File

@ -162,6 +162,7 @@ class StoreOrderRepository extends BaseRepository
Db::commit(); Db::commit();
} catch (Exception $e) { } catch (Exception $e) {
Db::rollback(); Db::rollback();
halt($e);
throw new ValidateException('余额支付失败'); throw new ValidateException('余额支付失败');
} }

View File

@ -6,6 +6,7 @@ use app\common\model\system\merchant\Merchant;
use think\facade\Db; use think\facade\Db;
use crmeb\basic\BaseController; use crmeb\basic\BaseController;
use think\facade\Log; use think\facade\Log;
use app\common\repositories\system\merchant\FinancialRecordRepository;
/** /**
* 订单处理 * 订单处理
@ -34,6 +35,32 @@ class StoreProcessing extends BaseController
} }
$select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select(); $select = Db::name('store_order_product')->where('order_id', $order['order_id'])->select();
if ($order['source'] == 103 && $select) { if ($order['source'] == 103 && $select) {
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
$financeSn = $financialRecordRepository->getSn();
$finance[] = [
'order_id' => $order->order_id,
'order_sn' => $order->order_sn,
'user_info' => $order['real_name'],
'user_id' => $order['uid'],
'financial_type' => 'supply_chain',
'financial_pm' => 0,
'type' => 0,
'number' => $order['number'],
'mer_id' => $order['mer_id'],
'financial_record_sn' => $financeSn .'1'
];
$finance[] = [
'order_id' => $order->order_id,
'order_sn' => $order->order_sn,
'user_info' => $order['real_name'],
'user_id' => $order['uid'],
'financial_type' => 'supply_chain',
'financial_pm' => 1,
'type' => 0,
'number' => $order['number'],
'mer_id' => $order['mer_id'],
'financial_record_sn' => $financeSn .'2'
];
$arr=$select->toArray(); $arr=$select->toArray();
unset($order['order_id'],$order['orderProduct'],$order['user'],$order['supply_chain_rate'],$order['logistics_code'],$order['logistics_phone']); unset($order['order_id'],$order['orderProduct'],$order['user'],$order['supply_chain_rate'],$order['logistics_code'],$order['logistics_phone']);
$order['group_order_id']=$group_order_id; $order['group_order_id']=$group_order_id;
@ -46,6 +73,7 @@ class StoreProcessing extends BaseController
$arr[$key]['source'] = 104; $arr[$key]['source'] = 104;
unset($arr[$key]['order_product_id']); unset($arr[$key]['order_product_id']);
} }
$financialRecordRepository->insertAll($finance);
Db::name('store_order_product_other')->insertAll($arr); Db::name('store_order_product_other')->insertAll($arr);
} }
} }

View File

@ -56,8 +56,16 @@ class OrderOther extends BaseController
public function lst() public function lst()
{ {
[$page, $limit] = $this->getPage(); [$page, $limit] = $this->getPage();
$where = $this->request->params(['status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','source']); $where = $this->request->params(['type','status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','source']);
$where['mer_id'] = $this->request->merId(); if($where['type']=='user'){
$uid = Db::name('merchant')->where('mer_id',$this->request->merId())->value('uid');
if(!$uid){
return app('json')->fail('商户不存在');
}
$where['uid'] = $uid;
}else{
$where['mer_id'] = $this->request->merId();
}
$where['paid']=1; $where['paid']=1;
if($where['source']<=0){ if($where['source']<=0){
$where['source']=105; $where['source']=105;

View File

@ -21,6 +21,7 @@ use app\common\repositories\store\order\StoreOrderRepository;
use think\facade\Db; use think\facade\Db;
use think\App; use think\App;
use app\common\dao\store\order\StoreOrderDao; use app\common\dao\store\order\StoreOrderDao;
use app\common\repositories\system\merchant\FinancialRecordRepository;
/**代发订单 /**代发订单
* Class StoreOrder * Class StoreOrder
@ -133,22 +134,31 @@ class StoreOrderBehalf extends BaseController
$mer_id = $this->request->merId(); $mer_id = $this->request->merId();
$status = $this->request->param('status'); $status = $this->request->param('status');
$id = $this->request->param('id'); $id = $this->request->param('id');
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id'); $uid = Db::name('merchant')->where('mer_id', $mer_id)->value('uid');
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code'); $res = Db::name('store_order_other')->where('uid', $uid)->where('order_id', $id)->update(['status' => $status]);
$res=0; $find = Db::name('store_order_other')->where('uid', $uid)->where('order_id', $id)->find();
if ($status == 1) { $find_two = Db::name('store_order')->where('order_sn', $find['order_sn'])->find();
if($type_code=='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('product_mer_id', $mer_id)
->where('order_id',$id)->where('status',0)->update(['status'=>1]);
}
}
if ($status == 3) {
if($type_code!='TypeSupplyChain'){
$res = Db::name('store_order_behalf')->where('master_mer_id', $mer_id)
->where('order_id',$id)->where('status',1)->update(['status'=>3]);
}
}
if($res){ if($res){
if($status==3){
//进入市级供应链待分润状态
$financialRecordRepository = app()->make(FinancialRecordRepository::class);
$financeSn = $financialRecordRepository->getSn();
//市级供应链获得
$finance[] = [
'order_id' =>$find_two['order_id'],
'order_sn' => $find_two['order_id'],
'user_info' => $find['real_name'],
'user_id' => $uid,
'financial_type' => 'supply_chain',
'financial_pm' =>1,
'type' => 0,
'number' => $find['procure_price'],
'mer_id' => $find['mer_id'],
'financial_record_sn' => $financeSn.'1'
];
$financialRecordRepository->insertAll($finance);
}
return app('json')->success('设置成功'); return app('json')->success('设置成功');
}else{ }else{
return app('json')->fail('设置失败'); return app('json')->fail('设置失败');

View File

@ -43,7 +43,7 @@ class paySuccess
$this->recordOrderAddr($order); $this->recordOrderAddr($order);
} }
} catch (\Exception $e) { } catch (\Exception $e) {
Log::error('支付后逻辑报错:' . $e->getMessage() . 'lien:' . $e->getLine()); Log::error('支付后逻辑报错:' . $e->getMessage() . 'lien:' . $e->getLine().'。file:'.$e->getFile());
} }
} }

View File

@ -335,9 +335,11 @@ class ExcelService
presell 收入 公共 新订单 presell 收入 公共 新订单
presell_charge 支出 商户 手续费 presell_charge 支出 商户 手续费
presell_true 支出 平台 商户入账 presell_true 支出 平台 商户入账
supply_chain 供应链商户入账
*/ */
$financialType = [ $financialType = [
'order' => '订单支付', 'order' => '订单支付',
'supply_chain' => '供应链',
'presell' => '预售订单(尾款)', 'presell' => '预售订单(尾款)',
'brokerage_one' => '一级佣金', 'brokerage_one' => '一级佣金',
'brokerage_two' => '二级佣金', 'brokerage_two' => '二级佣金',