|
@@ -1001,6 +1001,10 @@ class BookController extends BaseController
|
|
|
$date = date('Ymd');
|
|
|
$cacheKey = 'advertisement:pv:'.$date.':'.$distribution_id.$id;
|
|
|
$this->incrRedisKey($cacheKey);
|
|
|
+ //设置当前用户的所属广告有效期一周
|
|
|
+ $key = 'advertisement:uid:'.$this->uid.':id';
|
|
|
+ Redis::set($key,$id);
|
|
|
+ Redis::expire($key,BaseConst::ONE_WEEK_SECONDS);
|
|
|
return response()->success();
|
|
|
}
|
|
|
|
|
@@ -1017,4 +1021,26 @@ class BookController extends BaseController
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 绑定广告和订单
|
|
|
+ * @param Request $request
|
|
|
+ * @return mixed
|
|
|
+ */
|
|
|
+ public function getAdvertOrders(Request $request)
|
|
|
+ {
|
|
|
+ $order_id = $request->get('order_id','');
|
|
|
+ $uid = $this->uid;
|
|
|
+ $distribution_id = $this->distribution_channel_id;
|
|
|
+ $cacheKey = 'advertisement:uid:'.$uid.':id';
|
|
|
+ if(Redis::exists($cacheKey)){
|
|
|
+ $channel_ad_id = Redis::get($cacheKey);
|
|
|
+ $type = ($channel_ad_id > 0) ? 1 : 0;
|
|
|
+ $created_at = $updated_at = date('Y-m-d H:i:s');
|
|
|
+ DB::table('channel_advert_orders')->insert(compact('order_id','uid','distribution_id','channel_ad_id','type','created_at','updated_at'));
|
|
|
+ return response()->success();
|
|
|
+ }else{
|
|
|
+ return response()->success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|