更新
This commit is contained in:
parent
2aba6a6d81
commit
7b54109189
@ -162,6 +162,7 @@ class StoreOrderRepository extends BaseRepository
|
||||
Db::commit();
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
halt($e);
|
||||
throw new ValidateException('余额支付失败');
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ use app\common\model\system\merchant\Merchant;
|
||||
use think\facade\Db;
|
||||
use crmeb\basic\BaseController;
|
||||
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();
|
||||
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();
|
||||
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;
|
||||
@ -46,6 +73,7 @@ class StoreProcessing extends BaseController
|
||||
$arr[$key]['source'] = 104;
|
||||
unset($arr[$key]['order_product_id']);
|
||||
}
|
||||
$financialRecordRepository->insertAll($finance);
|
||||
Db::name('store_order_product_other')->insertAll($arr);
|
||||
}
|
||||
}
|
||||
|
@ -56,8 +56,16 @@ class OrderOther extends BaseController
|
||||
public function lst()
|
||||
{
|
||||
[$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['mer_id'] = $this->request->merId();
|
||||
$where = $this->request->params(['type','status', 'date', 'order_sn', 'username', 'order_type', 'keywords', 'order_id', 'activity_type', 'group_order_sn', 'store_name','source']);
|
||||
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;
|
||||
if($where['source']<=0){
|
||||
$where['source']=105;
|
||||
|
@ -21,6 +21,7 @@ use app\common\repositories\store\order\StoreOrderRepository;
|
||||
use think\facade\Db;
|
||||
use think\App;
|
||||
use app\common\dao\store\order\StoreOrderDao;
|
||||
use app\common\repositories\system\merchant\FinancialRecordRepository;
|
||||
|
||||
/**代发订单
|
||||
* Class StoreOrder
|
||||
@ -133,22 +134,31 @@ class StoreOrderBehalf extends BaseController
|
||||
$mer_id = $this->request->merId();
|
||||
$status = $this->request->param('status');
|
||||
$id = $this->request->param('id');
|
||||
$type_id = Db::name('merchant')->where('mer_id', $mer_id)->value('type_id');
|
||||
$type_code = Db::name('merchant_type')->where('mer_type_id', $type_id)->value('type_code');
|
||||
$res=0;
|
||||
if ($status == 1) {
|
||||
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]);
|
||||
}
|
||||
}
|
||||
$uid = Db::name('merchant')->where('mer_id', $mer_id)->value('uid');
|
||||
$res = Db::name('store_order_other')->where('uid', $uid)->where('order_id', $id)->update(['status' => $status]);
|
||||
$find = Db::name('store_order_other')->where('uid', $uid)->where('order_id', $id)->find();
|
||||
$find_two = Db::name('store_order')->where('order_sn', $find['order_sn'])->find();
|
||||
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('设置成功');
|
||||
}else{
|
||||
return app('json')->fail('设置失败');
|
||||
|
@ -43,7 +43,7 @@ class paySuccess
|
||||
$this->recordOrderAddr($order);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
Log::error('支付后逻辑报错:' . $e->getMessage() . 'lien:' . $e->getLine());
|
||||
Log::error('支付后逻辑报错:' . $e->getMessage() . '。lien:' . $e->getLine().'。file:'.$e->getFile());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -335,9 +335,11 @@ class ExcelService
|
||||
presell 收入 公共 新订单
|
||||
presell_charge 支出 商户 手续费
|
||||
presell_true 支出 平台 商户入账
|
||||
supply_chain 供应链商户入账
|
||||
*/
|
||||
$financialType = [
|
||||
'order' => '订单支付',
|
||||
'supply_chain' => '供应链',
|
||||
'presell' => '预售订单(尾款)',
|
||||
'brokerage_one' => '一级佣金',
|
||||
'brokerage_two' => '二级佣金',
|
||||
|
Loading…
x
Reference in New Issue
Block a user