|
|
@ -117,21 +117,22 @@ class Goods extends GoodsModel |
|
|
|
return $this->setGoodsListDataFromApi($list); |
|
|
|
return $this->setGoodsListDataFromApi($list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function presale() |
|
|
|
public function presale($param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$userId = UserService::getCurrentLoginUserId(true); |
|
|
|
$userId = UserService::getCurrentLoginUserId(true); |
|
|
|
|
|
|
|
|
|
|
|
$info = PreSaleLog::where([ |
|
|
|
$info = PreSaleLog::where([ |
|
|
|
'user_id' => $userId, |
|
|
|
'user_id' => $userId, |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'goods_id' => $_POST['goods_id'], |
|
|
|
'goods_id' => $param['goods_id'] ?? 0, |
|
|
|
])->find(); |
|
|
|
])->find(); |
|
|
|
|
|
|
|
|
|
|
|
if (!$info) { |
|
|
|
if (!$info) { |
|
|
|
PreSaleLog::insert([ |
|
|
|
PreSaleLog::insert([ |
|
|
|
'user_id' => $userId, |
|
|
|
'user_id' => $userId, |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'store_id' => request()->header()['storeid'], |
|
|
|
'goods_id' => $_POST['goods_id'], |
|
|
|
'pre_id' => $param['pre_id'] ?? 0, |
|
|
|
|
|
|
|
'goods_id' => $param['goods_id'] ?? 0, |
|
|
|
'ctime' => date('Y-m-d H:i:s') |
|
|
|
'ctime' => date('Y-m-d H:i:s') |
|
|
|
]); |
|
|
|
]); |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -224,7 +225,7 @@ class Goods extends GoodsModel |
|
|
|
->where([ |
|
|
|
->where([ |
|
|
|
'a.store_id' => request()->header()['storeid'], |
|
|
|
'a.store_id' => request()->header()['storeid'], |
|
|
|
'a.user_id' => $userId, |
|
|
|
'a.user_id' => $userId, |
|
|
|
])->field('c.goods_name,c.goods_price_min,a.id,b.p_time')->paginate(15); |
|
|
|
])->field('c.goods_name,c.goods_price_min,a.id,b.p_time,c.goods_id')->paginate(15); |
|
|
|
|
|
|
|
|
|
|
|
return $info; |
|
|
|
return $info; |
|
|
|
} |
|
|
|
} |
|
|
@ -302,11 +303,11 @@ class Goods extends GoodsModel |
|
|
|
return array_values($uniqueArray); |
|
|
|
return array_values($uniqueArray); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public function canlpresale() |
|
|
|
public function canlpresale($param) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$userId = UserService::getCurrentLoginUserId(true); |
|
|
|
$userId = UserService::getCurrentLoginUserId(true); |
|
|
|
$info = PreSaleLog::where([ |
|
|
|
$info = PreSaleLog::where([ |
|
|
|
'id' => $_POST['id'], |
|
|
|
'id' => $param['id'], |
|
|
|
'user_id' => $userId |
|
|
|
'user_id' => $userId |
|
|
|
])->delete(); |
|
|
|
])->delete(); |
|
|
|
|
|
|
|
|
|
|
|