修复添加线上订单和更新购物车信息的问题
- 在添加预订单逻辑中,禁止创建线上订单类型,只能通过转换方式产生 - 更新购物车信息时,同步更新采购产品报价中的需求数量,仅针对买家购物车
This commit is contained in:
parent
c1d1ccc56d
commit
a209a3fc2e
@ -41,6 +41,11 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
|
||||
$order_type=$params['order_type'] ?? 0;
|
||||
if($order_type==4){
|
||||
throw new BusinessException('不能添加线上订单,线上订单只能转换');
|
||||
}
|
||||
Db::startTrans();
|
||||
try {
|
||||
$datas = [];
|
||||
@ -70,7 +75,7 @@ class BeforehandOrderLogic extends BaseLogic
|
||||
'deduction_price' => 0,
|
||||
'paid' => 0,
|
||||
'mark' => $params['mark'] ?? '',
|
||||
'order_type' => $params['order_type'] ?? 4
|
||||
'order_type' => $order_type
|
||||
]);
|
||||
foreach ($datas as $k => $v) {
|
||||
$datas[$k]['bhoid'] = $order['id'];
|
||||
|
@ -96,13 +96,17 @@ class BeforehandOrderCartInfoLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
BeforehandOrderCartInfo::where('id', $params['id'])->update([
|
||||
$find=BeforehandOrderCartInfo::where('id', $params['id'])->find();
|
||||
$find->save([
|
||||
'price' => $params['purchases'],
|
||||
'total_price' => bcmul($params['purchases'],$params['nums'],2),
|
||||
'cart_num' => $params['nums'],
|
||||
]);
|
||||
$bhoid = $params['bhoid'];
|
||||
$info = BeforehandOrderCartInfo::where('bhoid', $bhoid)->field('sum(cart_num) as cart_num,sum(total_price) as total_price')->find();
|
||||
if($find['is_buyer']==1){
|
||||
PurchaseProductOffer::where('order_id',$bhoid)->where('product_id',$find['product_id'])->update(['need_num'=>$params['nums']]);
|
||||
}
|
||||
BeforehandOrder::where('id', $bhoid)->update(['total_price' => $info['total_price'], 'total_num' => $info['cart_num']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user