|
@@ -19,94 +19,98 @@ class OrderService implements OrderServiceInterface
|
|
|
|
|
|
/**
|
|
|
* 查询没有广告的广告位
|
|
|
+ *获取站点下所有的广告尺寸
|
|
|
* @param
|
|
|
* @return void
|
|
|
*/
|
|
|
public function getAD(array $data): array
|
|
|
{
|
|
|
|
|
|
- if (!empty($data)) {
|
|
|
- $where = [
|
|
|
-
|
|
|
- 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
- ];
|
|
|
- $start = Carbon::parse($data['starttime']);
|
|
|
- $end = Carbon::parse($data['endtime']);
|
|
|
- $status = [
|
|
|
- 0 => '1',
|
|
|
- 1 => '4',
|
|
|
- 2 => '6',
|
|
|
- ];
|
|
|
- $ads = Ad::where('fromtime', '<=', $start)->where('totime', '>=', $end)->select('pid')->get()->all();
|
|
|
- $orderads = OrderAd::where('fromtime', '<=', $start)->where('totime', '>=', $end)->whereIn('status', $status)->select('pid')->get()->all();
|
|
|
- $pids = array_merge($ads, $orderads);
|
|
|
- $ad_pids = array_unique($pids);
|
|
|
- // $ad_pid = [1,2,3];
|
|
|
- // 所有与用户有时间冲突的广告位
|
|
|
- if (!empty($ad_pids)) {
|
|
|
- $pid = [];
|
|
|
- foreach ($ad_pids as $val) {
|
|
|
- array_push($pid, $val['pid']);
|
|
|
- }
|
|
|
- $placeids = AdPlace::whereNotIn('id', $pid)->where($where)->select('id')->get()->all();
|
|
|
- //所有去掉与用户时间冲突的广告并且符合图片尺寸的广告位
|
|
|
- // 符合用户条件的空广告位
|
|
|
- $place_id = [];
|
|
|
- foreach ($placeids as $val) {
|
|
|
- array_push($place_id, $val['id']);
|
|
|
- }
|
|
|
- $rep = AdPlace::whereIn('ad_place.id', $place_id)
|
|
|
- ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
- ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
- ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
- ->selectSub('website.id', 'webid')
|
|
|
- ->selectSub('ad_place.id', 'pid')
|
|
|
- ->selectSub('ad_size.width', 'size_width')
|
|
|
- ->selectSub('ad_size.height', 'size_height')
|
|
|
- ->orderBy("website.id", "asc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
- $count = AdPlace::whereIn('ad_place.id', $place_id)->count();
|
|
|
- } else {
|
|
|
- $rep = AdPlace::where($where)
|
|
|
- ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
- ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
- ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
- ->selectSub('website.id', 'webid')
|
|
|
- ->selectSub('ad_place.id', 'pid')
|
|
|
- ->selectSub('ad_size.width', 'size_width')
|
|
|
- ->selectSub('ad_size.height', 'size_height')
|
|
|
- ->orderBy("website.id", "asc")
|
|
|
- ->limit($data['pageSize'])
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->get();
|
|
|
- $count = AdPlace::where($where)->count();
|
|
|
- }
|
|
|
- $startTime = strtotime($data['starttime']);
|
|
|
- $endTime = strtotime($data['endtime']);
|
|
|
- $time = ($endTime - $startTime) / (24 * 60 * 60);
|
|
|
- $roundedValue = round($time, 2);
|
|
|
- $days = number_format($roundedValue, 2, '.', '');
|
|
|
- $result = [
|
|
|
- 'rows' => $rep->toArray(),
|
|
|
- 'count' => $count,
|
|
|
- 'days' => $days,
|
|
|
- ];
|
|
|
-
|
|
|
- if (empty($result['rows'])) {
|
|
|
- return Result::error("暂无符合您条件的广告位!");
|
|
|
-
|
|
|
- }
|
|
|
- } else {
|
|
|
- $result = AdSize::get();
|
|
|
- if (empty($result)) {
|
|
|
- return Result::error('暂无广告尺寸!');
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return Result::success($result);
|
|
|
-
|
|
|
+ // if (!empty($data)) {
|
|
|
+ // $where = [
|
|
|
+
|
|
|
+ // 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
+ // ];
|
|
|
+ // $start = Carbon::parse($data['starttime']);
|
|
|
+ // $end = Carbon::parse($data['endtime']);
|
|
|
+ // $status = [
|
|
|
+ // 0 => '1',
|
|
|
+ // 1 => '4',
|
|
|
+ // 2 => '6',
|
|
|
+ // ];
|
|
|
+ // $ads = Ad::where('fromtime', '<=', $start)->where('totime', '>=', $end)->select('pid')->get()->all();
|
|
|
+ // $orderads = OrderAd::where('fromtime', '<=', $start)->where('totime', '>=', $end)->whereIn('status', $status)->select('pid')->get()->all();
|
|
|
+ // $pids = array_merge($ads, $orderads);
|
|
|
+ // $ad_pids = array_unique($pids);
|
|
|
+ // // $ad_pid = [1,2,3];
|
|
|
+ // // 所有与用户有时间冲突的广告位
|
|
|
+ // if (!empty($ad_pids)) {
|
|
|
+ // $pid = [];
|
|
|
+ // foreach ($ad_pids as $val) {
|
|
|
+ // array_push($pid, $val['pid']);
|
|
|
+ // }
|
|
|
+ // $placeids = AdPlace::whereNotIn('id', $pid)->where($where)->select('id')->get()->all();
|
|
|
+ // //所有去掉与用户时间冲突的广告并且符合图片尺寸的广告位
|
|
|
+ // // 符合用户条件的空广告位
|
|
|
+ // $place_id = [];
|
|
|
+ // foreach ($placeids as $val) {
|
|
|
+ // array_push($place_id, $val['id']);
|
|
|
+ // }
|
|
|
+ // $rep = AdPlace::whereIn('ad_place.id', $place_id)
|
|
|
+ // ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
+ // ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
+ // ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
+ // ->selectSub('website.id', 'webid')
|
|
|
+ // ->selectSub('ad_place.id', 'pid')
|
|
|
+ // ->selectSub('ad_size.width', 'size_width')
|
|
|
+ // ->selectSub('ad_size.height', 'size_height')
|
|
|
+ // ->orderBy("website.id", "asc")
|
|
|
+ // ->limit($data['pageSize'])
|
|
|
+ // ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ // ->get();
|
|
|
+ // $count = AdPlace::whereIn('ad_place.id', $place_id)->count();
|
|
|
+ // } else {
|
|
|
+ // $rep = AdPlace::where($where)
|
|
|
+ // ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
+ // ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
+ // ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
+ // ->selectSub('website.id', 'webid')
|
|
|
+ // ->selectSub('ad_place.id', 'pid')
|
|
|
+ // ->selectSub('ad_size.width', 'size_width')
|
|
|
+ // ->selectSub('ad_size.height', 'size_height')
|
|
|
+ // ->orderBy("website.id", "asc")
|
|
|
+ // ->limit($data['pageSize'])
|
|
|
+ // ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ // ->get();
|
|
|
+ // $count = AdPlace::where($where)->count();
|
|
|
+ // }
|
|
|
+ // $startTime = strtotime($data['starttime']);
|
|
|
+ // $endTime = strtotime($data['endtime']);
|
|
|
+ // $time = ($endTime - $startTime) / (24 * 60 * 60);
|
|
|
+ // $roundedValue = round($time, 2);
|
|
|
+ // $days = number_format($roundedValue, 2, '.', '');
|
|
|
+ // $result = [
|
|
|
+ // 'rows' => $rep->toArray(),
|
|
|
+ // 'count' => $count,
|
|
|
+ // 'days' => $days,
|
|
|
+ // ];
|
|
|
+
|
|
|
+ // if (empty($result['rows'])) {
|
|
|
+ // return Result::error("暂无符合您条件的广告位!");
|
|
|
+
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // $result = AdSize::get();
|
|
|
+ // if (empty($result)) {
|
|
|
+ // return Result::error('暂无广告尺寸!');
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //获取站点下所有的广告尺寸
|
|
|
+ $adssizeid = AdPlace::where('website_id', $data['website_id'] ?? 2)->select('ad_size_id')->get()->all();
|
|
|
+ $adssizeidArray = array_unique(array_column($adssizeid, 'ad_size_id'));
|
|
|
+ var_dump($adssizeidArray, 'p--------------1-------');
|
|
|
+ $adssize = AdSize::whereIn('id', $adssizeidArray)->select('id', 'width', 'height')->get();
|
|
|
+ return Result::success($adssize);
|
|
|
}
|
|
|
/**
|
|
|
* 添加订单
|
|
@@ -144,7 +148,7 @@ class OrderService implements OrderServiceInterface
|
|
|
$page = isset($data['page']) ? (int) $data['page'] : 1;
|
|
|
$perPage = isset($data['pagesize']) ? (int) $data['pagesize'] : 10;
|
|
|
|
|
|
- var_dump($data, 'p---------------------');
|
|
|
+ var_dump($data, 'p--------------1-------');
|
|
|
// 构建查询条件
|
|
|
$where = [];
|
|
|
if (!empty($data['status'])) {
|
|
@@ -191,14 +195,26 @@ class OrderService implements OrderServiceInterface
|
|
|
|
|
|
// 执行分页查询
|
|
|
$result = $query->paginate($perPage, ['*'], 'page', $page);
|
|
|
+ // 循环获取到订单的广告位置名称信息
|
|
|
+ $orderData = $result->items();
|
|
|
+ foreach ($orderData as $key => $value) {
|
|
|
+ $pid = $value['id'];
|
|
|
+ //取出pid
|
|
|
+ $ad = OrderAd::where('order_id', $pid)->select('pid')->get()->all();
|
|
|
+ //ad_place 取出name
|
|
|
+ $ad = array_column($ad, 'pid');
|
|
|
+ var_dump($ad, 'p--------------2-------');
|
|
|
+ $ad = AdPlace::whereIn('id', $ad)->select('name')->get()->all();
|
|
|
+ $orderData[$key]['adname'] = implode(',', array_column($ad, 'name'));
|
|
|
+ }
|
|
|
|
|
|
// 返回分页结果
|
|
|
return Result::success([
|
|
|
- 'count' => $result->total(),
|
|
|
+ 'count1' => $result->total(),
|
|
|
'current_page' => $result->currentPage(),
|
|
|
'last_page' => $result->lastPage(),
|
|
|
'pagesize' => $result->perPage(),
|
|
|
- 'rows' => $result->items(),
|
|
|
+ 'rows' => $orderData,
|
|
|
]);
|
|
|
}
|
|
|
/**
|
|
@@ -417,9 +433,78 @@ class OrderService implements OrderServiceInterface
|
|
|
*/
|
|
|
public function getWebsiteAd(array $data): array
|
|
|
{
|
|
|
- $where = [
|
|
|
- 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
+ $where['website_id'] = $data['website_id'];
|
|
|
+ $where['ad_size_id'] = $data['ad_size_id'] ?? 1;
|
|
|
+
|
|
|
+ $start = Carbon::parse($data['starttime']);
|
|
|
+ $end = Carbon::parse($data['endtime']);
|
|
|
+ $status = [
|
|
|
+ 0 => '1',
|
|
|
+ 1 => '4',
|
|
|
+ 2 => '6',
|
|
|
+ ];
|
|
|
+ //订单状态:1:通过;2:驳回;3:撤回;4:修改;5:过期;6:待审核;7:结束
|
|
|
+ $ads = Ad::where('fromtime', '<=', $start)->where('totime', '>=', $end)->select('pid')->get()->all();
|
|
|
+ $orderads = OrderAd::where('fromtime', '<=', $start)->where('totime', '>=', $end)->whereIn('status', $status)->select('pid')->get()->all();
|
|
|
+ $ads = array_column($ads, 'pid');
|
|
|
+ $orderads = array_column($orderads, 'pid');
|
|
|
+ $pids = array_merge($ads, $orderads);
|
|
|
+ var_dump($pids, '-----------1-------------');
|
|
|
+ //取出pid
|
|
|
+ $ad_pids = array_unique($pids);
|
|
|
+ var_dump($ad_pids, '----------3------------');
|
|
|
+
|
|
|
+ $placeids = AdPlace::whereNotIn('id', $ad_pids)->where($where)->select('id')->get()->all();
|
|
|
+ $ad_pids = array_column($placeids, 'id');
|
|
|
+ $rep = AdPlace::where($where)
|
|
|
+ ->whereIn('ad_place.id', $ad_pids)
|
|
|
+ ->where('ad_place.website_id', $data['website_id'])
|
|
|
+ ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
+ ->leftJoin('ad_size', 'ad_place.ad_size_id', 'ad_size.id')
|
|
|
+ ->select('ad_place.*', 'website.website_name', 'website.id', 'ad_size.*')
|
|
|
+ ->selectSub('website.id', 'webid')
|
|
|
+ ->selectSub('ad_place.id', 'pid')
|
|
|
+ ->selectSub('ad_size.width', 'size_width')
|
|
|
+ ->selectSub('ad_size.height', 'size_height')
|
|
|
+ ->orderBy("website.id", "asc")
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->get();
|
|
|
+ $count = AdPlace::where($where)->where('ad_place.website_id', $data['website_id'])->whereIn('ad_place.id', $ad_pids)->count();
|
|
|
+ $startTime = strtotime($data['starttime']);
|
|
|
+ $endTime = strtotime($data['endtime']);
|
|
|
+ $time = ($endTime - $startTime) / (24 * 60 * 60);
|
|
|
+ $roundedValue = round($time, 2);
|
|
|
+ $days = number_format($roundedValue, 2, '.', '');
|
|
|
+ $result = [
|
|
|
+ 'rows' => $rep->toArray(),
|
|
|
+ 'count' => $count,
|
|
|
+ 'days' => $days,
|
|
|
];
|
|
|
+ return Result::success($result);
|
|
|
+
|
|
|
+ //ad_size_id 必选改可选
|
|
|
+ //单选
|
|
|
+ if (isset($data['ad_size_id']) && is_string($data['ad_size_id'])) {
|
|
|
+ $where = [
|
|
|
+ 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ //如果有website_id
|
|
|
+ if (!isset($data['ad_size_id'])) {
|
|
|
+ // $adsiteids = AdPlace::where('website_id', $data['website_id'])->select('id')->get()->all();
|
|
|
+ // $ad_pids = array_column($adsiteids, 'id');
|
|
|
+ // // $where = [
|
|
|
+ // // 'ad_place.ad_size_id' => $data['ad_size_id'],
|
|
|
+ // // ];
|
|
|
+ // var_dump($ad_pids, 'p--------------3-------');
|
|
|
+ // // $where[] = ['ad_place.id', 'in', $ad_pids];
|
|
|
+ // $where = [
|
|
|
+ // 'ad_place.website_id' => $data['website_id'],
|
|
|
+ // ];
|
|
|
+ }
|
|
|
+ //数组
|
|
|
+
|
|
|
$start = Carbon::parse($data['starttime']);
|
|
|
$end = Carbon::parse($data['endtime']);
|
|
|
$status = [
|
|
@@ -443,6 +528,7 @@ class OrderService implements OrderServiceInterface
|
|
|
if (empty($placeids)) {
|
|
|
return Result::error('暂无数据!');
|
|
|
}
|
|
|
+
|
|
|
if (!isset($data['website_id'])) {
|
|
|
$websiteIds = array_column($placeids, 'website_id');
|
|
|
$website_id = array_unique($websiteIds);
|
|
@@ -755,7 +841,7 @@ class OrderService implements OrderServiceInterface
|
|
|
$time = time();
|
|
|
$timestamp = date('YmdHis', $time);
|
|
|
$randomNumber = mt_rand(100, 999);
|
|
|
- $shopping_id = $randomNumber . $timestamp; // 时间戳与随机数拼接
|
|
|
+ $shopping_id = $randomNumber . $timestamp; // 时间戳与随机数拼接
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
|
if (!empty($shop)) {
|
|
@@ -768,7 +854,7 @@ class OrderService implements OrderServiceInterface
|
|
|
'user_id' => $data['user_id'],
|
|
|
'shopping_id' => $shopping_id,
|
|
|
'created_at' => date('Y-m-d H:i:s', time()),
|
|
|
- 'updated_at' => date('Y-m-d H:i:s', time())
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s', time()),
|
|
|
];
|
|
|
$result = ShoppingCart::insert($shop);
|
|
|
Db::commit();
|
|
@@ -776,9 +862,9 @@ class OrderService implements OrderServiceInterface
|
|
|
Db::rollBack();
|
|
|
return Result::error($e->getMessage());
|
|
|
}
|
|
|
- if(empty($result)){
|
|
|
+ if (empty($result)) {
|
|
|
return Result::error("创建失败");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return Result::success($shopping_id);
|
|
|
}
|
|
|
|
|
@@ -791,16 +877,16 @@ class OrderService implements OrderServiceInterface
|
|
|
public function getShoppingCartAD(array $data): array
|
|
|
{
|
|
|
$shopcart = ShoppingCart::where('shopping_id', $data['shopping_id'])
|
|
|
- ->where('user_id',$data['user_id'])
|
|
|
- ->orderBy('pid')
|
|
|
- ->pluck('pid')
|
|
|
- ->toArray();
|
|
|
-
|
|
|
+ ->where('user_id', $data['user_id'])
|
|
|
+ ->orderBy('pid')
|
|
|
+ ->pluck('pid')
|
|
|
+ ->toArray();
|
|
|
+
|
|
|
$result['pid'] = $shopcart;
|
|
|
-
|
|
|
+
|
|
|
if (empty($result)) {
|
|
|
return Result::error("购物车id错误");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
}
|
|
@@ -811,35 +897,35 @@ class OrderService implements OrderServiceInterface
|
|
|
*/
|
|
|
public function addShoppingCartAD(array $data): array
|
|
|
{
|
|
|
- $shop = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->first();
|
|
|
+ $shop = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id', $data['user_id'])->first();
|
|
|
if (empty($shop)) {
|
|
|
return Result::error("购物车id错误");
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
$ad = AdPlace::where('ad_place.id', $data['pid'])
|
|
|
- ->leftJoin('website','ad_place.website_id','website.id')
|
|
|
- ->select('ad_place.id as pid','website.id as website_id')
|
|
|
- ->first();
|
|
|
- if(empty($ad)) {
|
|
|
- return Result::error("广告位id错误");
|
|
|
+ ->leftJoin('website', 'ad_place.website_id', 'website.id')
|
|
|
+ ->select('ad_place.id as pid', 'website.id as website_id')
|
|
|
+ ->first();
|
|
|
+ if (empty($ad)) {
|
|
|
+ return Result::error("广告位id错误");
|
|
|
}
|
|
|
- if(empty($shop['pid']) && empty($shop['website_id'])){
|
|
|
- $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id',$data['user_id'])->update(['pid' => $ad['pid'],'website_id' => $ad['website_id']]);
|
|
|
- }else{
|
|
|
- if($data['pid'] == $shop['pid']){
|
|
|
- return Result::error("购物车中已存在该广告位");
|
|
|
+ if (empty($shop['pid']) && empty($shop['website_id'])) {
|
|
|
+ $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id', $data['user_id'])->update(['pid' => $ad['pid'], 'website_id' => $ad['website_id']]);
|
|
|
+ } else {
|
|
|
+ if ($data['pid'] == $shop['pid']) {
|
|
|
+ return Result::error("购物车中已存在该广告位");
|
|
|
}
|
|
|
$shop_ad = [
|
|
|
'pid' => $ad['pid'],
|
|
|
'website_id' => $ad['website_id'],
|
|
|
'shopping_id' => $shop['shopping_id'],
|
|
|
- 'user_id' => $data['user_id']
|
|
|
+ 'user_id' => $data['user_id'],
|
|
|
];
|
|
|
$result = ShoppingCart::insertGetId($shop_ad);
|
|
|
}
|
|
|
}
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("添加失败");
|
|
|
- }else{
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("添加失败");
|
|
|
+ } else {
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
|
|
@@ -851,21 +937,21 @@ class OrderService implements OrderServiceInterface
|
|
|
*/
|
|
|
public function delShoppingCartAD(array $data): array
|
|
|
{
|
|
|
- $shop = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->where('pid',$data['pid'])->first();
|
|
|
+ $shop = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id', $data['user_id'])->where('pid', $data['pid'])->first();
|
|
|
if (empty($shop)) {
|
|
|
- return Result::error("不存在此条记录!(参数错误)");
|
|
|
- }else{
|
|
|
- $count = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->count();
|
|
|
- if($count == 1){
|
|
|
- $result = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id',$data['user_id'])->update(['pid' => null, 'website_id' => null]);;
|
|
|
- }else{
|
|
|
- $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id',$data['user_id'])->where('pid',$data['pid'])->delete();
|
|
|
- }
|
|
|
- }
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("删除失败");
|
|
|
- }else{
|
|
|
+ return Result::error("不存在此条记录!(参数错误)");
|
|
|
+ } else {
|
|
|
+ $count = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id', $data['user_id'])->count();
|
|
|
+ if ($count == 1) {
|
|
|
+ $result = ShoppingCart::where('shopping_id', $data['shopping_id'])->where('user_id', $data['user_id'])->update(['pid' => null, 'website_id' => null]);
|
|
|
+ } else {
|
|
|
+ $result = ShoppingCart::where('shopping_id', $shop['shopping_id'])->where('user_id', $data['user_id'])->where('pid', $data['pid'])->delete();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("删除失败");
|
|
|
+ } else {
|
|
|
return Result::success($result);
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
}
|