处理小程序新增订单商品缺失新增到缺失列表

This commit is contained in:
liu 2024-06-29 18:04:21 +08:00
parent 0fa71e2fe8
commit 82a4fddcfe
2 changed files with 42 additions and 2 deletions

View File

@ -273,9 +273,12 @@ class OrderLogic extends BaseLogic
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function checkLeft($params,$uid)
public static function checkLeft($params,$uid,$type =0)
{
$where = ['is_pay' => 0];
$where = [];
if(empty($type)){
$where = ['is_pay' => 0];
}
$cart_select = Cart::whereIn('id', $params['cart_id'])
->where($where)->field('id,product_id,cart_num,store_id')->select()->toArray();
if (empty($cart_select)) {

View File

@ -104,6 +104,9 @@ class PayNotifyLogic extends BaseLogic
// self::descStock($order['id']);
}
self::afterPay($order);
if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){
self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']);
}
if ($extra && $extra['store_id']) {
$params = [
'verify_code' => $order['verify_code'],
@ -215,6 +218,10 @@ class PayNotifyLogic extends BaseLogic
OrderLogic::writeOff($params);
}
self::dealProductLog($order);
if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){
self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']);
}
// $count = UserSign::where([
// 'uid'=>$order['uid'],
// 'type'=>1,
@ -405,6 +412,9 @@ class PayNotifyLogic extends BaseLogic
$capitalFlowDao->userExpense('user_order_pay', 'order', $order['id'], $order->pay_price, '', 1, $order['store_id']);
}
$order->save();
if($order['reservation'] == 1&& in_array($order['shipping_type'],[1,2])){
self::dealGoodsLeft($order['cart_id'],$order['uid'],$order['id']);
}
self::afterPay($order, $extra['transaction_id']);
// self::addUserSing($order);
self::dealProductLog($order);
@ -1167,6 +1177,33 @@ class PayNotifyLogic extends BaseLogic
}
/**
* 处理商品缺失新增到缺失列表
* @param $cart_id //购物车ids
* @param $uid //用户id
* @param $oid //订单id
* @return void
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public static function dealGoodsLeft($cart_id,$uid,$oid)
{
$cart_id['cart_id'] = explode(',',$cart_id);
$data = OrderLogic::checkLeft($cart_id,$uid,1);
$format = $data['detail'];
foreach ($format as &$value){
$value['oid'] =$oid;
$value['create_time'] =time();
}
Db::name('store_product_miss')->insertAll($format);
}
//礼品券相关对应文本
public static function getTitle($category, $amount)
{