|
@@ -95,6 +95,7 @@ class Goods extends Common
|
|
|
$user = auth_user();
|
|
|
$id = $this->request->param('id');
|
|
|
$activity_id = $this->request->param('activity_id');
|
|
|
+ $goods_sku_price_id = $this->request->param('goods_sku_price_id');
|
|
|
|
|
|
//判断一下活动是否还可用
|
|
|
$mapa = [
|
|
@@ -102,7 +103,32 @@ class Goods extends Common
|
|
|
'start_time' => ['lt',time()],
|
|
|
'end_time' => ['gt',time()],
|
|
|
];
|
|
|
- $activity_id = Db::name('shopro_activity')->where($mapa)->where('deletetime',NULL)->find() ? $activity_id : 0;
|
|
|
+ $activity = Db::name('shopro_activity')->where($mapa)->where('deletetime',NULL)->find();
|
|
|
+ $activity_id = $activity ? $activity_id : 0;
|
|
|
+
|
|
|
+ //砍价活动处理
|
|
|
+ if($activity && $activity['type'] == 'kan'){
|
|
|
+
|
|
|
+ $kan_id = $this->request->param('kan_id',0);
|
|
|
+
|
|
|
+ if($kan_id && $goods_sku_price_id){
|
|
|
+ $map_kan = [
|
|
|
+ 'id' => $kan_id,
|
|
|
+ 'user_id' => $user['id'],
|
|
|
+ 'goods_id' => $id,
|
|
|
+ 'goods_sku_price_id' => $goods_sku_price_id,
|
|
|
+ 'activity_id' => $activity_id,
|
|
|
+ 'status' => ['IN',['ing','finish']],
|
|
|
+ ];
|
|
|
+ $kan = Db::name('shopro_activity_kan')->where($map_kan)->find();
|
|
|
+ if(!$kan){
|
|
|
+ $activity_id = 0;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ $activity_id = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
|
|
|
// 存一下,获取器获取指定活动的时候会用到
|