This commit is contained in:
mkm 2024-01-18 15:50:06 +08:00
parent aa3e1f316e
commit 2d6da73fa5
3 changed files with 50 additions and 19 deletions

View File

@ -1061,7 +1061,16 @@ class StoreOrderCreateRepository extends StoreOrderRepository
$order_cart['active'] = $cart['productDiscount'];
$order_cart['activeSku'] = $cart['productDiscountAttr'];
}
$product_source_id=0;
$product_mer_id=0;
if($cart['source']==103){
$old_product_id=Db::name('product')->where('product_id',$cart['product_id'])->value('old_product_id');
if($old_product_id){
$old_mer_id=Db::name('product')->where('product_id',$old_product_id)->value('mer_id');
$product_mer_id=$old_mer_id;
$product_source_id=$old_product_id;
}
}
$orderProduct[] = [
'order_id' => $_order->order_id,
'cart_id' => $cart['cart_id'],
@ -1086,7 +1095,9 @@ class StoreOrderCreateRepository extends StoreOrderRepository
'product_type' => $cart['product_type'],
'source' => $cart['source'],
'source_id' => $cart['source_id'],
'cart_info' => json_encode($order_cart)
'cart_info' => json_encode($order_cart),
'product_source_id' => $product_source_id,
'product_mer_id' => $product_mer_id,
];
}

View File

@ -0,0 +1,36 @@
<?php
namespace app\controller\api\store\order;
use app\common\model\system\merchant\Merchant;
use think\facade\Db;
/**
* 订单处理
*/
class StoreOrder extends BaseController
{
/**
* 自动向市级供应链创建订单
*/
public function AutomaticallyCreateOrders($order)
{
// $merchant = Merchant::find($order['mer_id']);
//添加到代发订单表里
// if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
// $codes = explode(',', $order['user_address_code']);
// if (count($codes) > 4) {
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
if ($order['source']==103) {
$datas = [
'master_mer_id' => $order['mer_id'],
'mer_id' => $merchant_two['mer_id'],
'order_id' => $order['order_id'],
'status' => 0
];
Db::name('store_order_behalf')->insert($datas);
}
// }
// }
}
}

View File

@ -43,23 +43,7 @@ class paySuccess
$storeConsumptionUserDao->check($event['groupOrder']['group_order_id']);
}
foreach ($orderList as $k => $order) {
// $merchant = Merchant::find($order['mer_id']);
//添加到代发订单表里
// if ($merchant['type_id'] == Merchant::TypeSupplyChain) {
// $codes = explode(',', $order['user_address_code']);
// if (count($codes) > 4) {
// $merchant_two = Db::name('merchant')->where('street_id', $codes[3])->where('type_id', 17)->where('category_id', $merchant['category_id'])->find();
// if ($merchant_two) {
// $datas = [
// 'master_mer_id' => $order['mer_id'],
// 'mer_id' => $merchant_two['mer_id'],
// 'order_id' => $order['order_id'],
// 'status' => 0
// ];
// Db::name('store_order_behalf')->insert($datas);
// }
// }
// }
$this->recordOrderAddr($order);
}
} catch (\Exception $e) {