|
@@ -12,6 +12,7 @@
|
|
|
namespace App\Services\Api;
|
|
namespace App\Services\Api;
|
|
|
|
|
|
|
|
use App\Models\AccountLogModel;
|
|
use App\Models\AccountLogModel;
|
|
|
|
|
+use App\Models\CartModel;
|
|
|
use App\Models\GoodsModel;
|
|
use App\Models\GoodsModel;
|
|
|
use App\Models\GoodsSkuModel;
|
|
use App\Models\GoodsSkuModel;
|
|
|
use App\Models\MemberModel;
|
|
use App\Models\MemberModel;
|
|
@@ -190,6 +191,7 @@ class OrderService extends BaseService
|
|
|
public function createOrder($userId, $params)
|
|
public function createOrder($userId, $params)
|
|
|
{
|
|
{
|
|
|
$type = isset($params['type']) && $params['type'] ? $params['type'] : 1;
|
|
$type = isset($params['type']) && $params['type'] ? $params['type'] : 1;
|
|
|
|
|
+ $submitType = isset($params['submit_type']) && $params['submit_type'] ? $params['submit_type'] : '';
|
|
|
$addressId = isset($params['address_id']) && $params['address_id'] ? $params['address_id'] : 0;
|
|
$addressId = isset($params['address_id']) && $params['address_id'] ? $params['address_id'] : 0;
|
|
|
$goods = isset($params['goods']) && $params['goods'] ? $params['goods'] : [];
|
|
$goods = isset($params['goods']) && $params['goods'] ? $params['goods'] : [];
|
|
|
$ids = $goods ? array_column($goods, 'id') : [];
|
|
$ids = $goods ? array_column($goods, 'id') : [];
|
|
@@ -470,6 +472,13 @@ class OrderService extends BaseService
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 清空购物车结算商品
|
|
|
|
|
+ if($submitType == 'cart'){
|
|
|
|
|
+ $skuIds = $goods ? array_column($goods, 'sku_id') : [];
|
|
|
|
|
+ CartModel::whereIn('goods_id',$ids)->whereIn('sku_id',$skuIds)->where(['user_id'=>$userId,'mark'=>1])->update(['mark'=>0,'num'=>0,'update_time'=>time()]);
|
|
|
|
|
+ RedisService::clear("caches:goods:cartCount:{$userId}");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 用户操作记录
|
|
// 用户操作记录
|