|
@@ -13,22 +13,50 @@ use App\Modules\Statistic\Models\AdVisitStat;
|
|
class AdVisitStatService
|
|
class AdVisitStatService
|
|
{
|
|
{
|
|
public static function create($uid,$bid,$cid,$type){
|
|
public static function create($uid,$bid,$cid,$type){
|
|
|
|
+ $model = new AdVisitStat();
|
|
|
|
+ $time = date('Ym');
|
|
|
|
+ if($time == '201905'){
|
|
|
|
+ $model->setCurrentTable();
|
|
|
|
+ }else{
|
|
|
|
+ $model->setCurrentTable($time);
|
|
|
|
+ }
|
|
try{
|
|
try{
|
|
- AdVisitStat::create(compact('uid','bid','cid','type'));
|
|
|
|
|
|
+ $model->create(compact('uid','bid','cid','type'));
|
|
}catch (\Exception $e){
|
|
}catch (\Exception $e){
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public static function getInfo($uid,$cid,$type){
|
|
public static function getInfo($uid,$cid,$type){
|
|
|
|
+ $model = new AdVisitStat();
|
|
|
|
+ $time = date('Ym');
|
|
|
|
+ if($time == '201905'){
|
|
|
|
+ $model->setCurrentTable();
|
|
|
|
+ }else{
|
|
|
|
+ $model->setCurrentTable($time);
|
|
|
|
+ }
|
|
return AdVisitStat::where('uid',$uid)->where('cid',$cid)->where('type',$type)->first();
|
|
return AdVisitStat::where('uid',$uid)->where('cid',$cid)->where('type',$type)->first();
|
|
}
|
|
}
|
|
|
|
|
|
public static function getInfoV2($uid,$cid,$type){
|
|
public static function getInfoV2($uid,$cid,$type){
|
|
- return AdVisitStat::where('uid',$uid)->where('cid',$cid)->whereIn('type',$type)->first();
|
|
|
|
|
|
+ $model = new AdVisitStat();
|
|
|
|
+ $time = date('Ym');
|
|
|
|
+ if($time == '201905'){
|
|
|
|
+ $model->setCurrentTable();
|
|
|
|
+ }else{
|
|
|
|
+ $model->setCurrentTable($time);
|
|
|
|
+ }
|
|
|
|
+ return $model->where('uid',$uid)->where('cid',$cid)->whereIn('type',$type)->first();
|
|
}
|
|
}
|
|
|
|
|
|
public static function getByUid($uid){
|
|
public static function getByUid($uid){
|
|
- return AdVisitStat::where('uid',$uid)->select('id','type')->where('id','<=',12723415)->first();
|
|
|
|
|
|
+ $model = new AdVisitStat();
|
|
|
|
+ $time = date('Ym');
|
|
|
|
+ if($time == '201905'){
|
|
|
|
+ $model->setCurrentTable();
|
|
|
|
+ }else{
|
|
|
|
+ $model->setCurrentTable($time);
|
|
|
|
+ }
|
|
|
|
+ return $model->where('uid',$uid)->select('id','type')->where('id','<=',12723415)->first();
|
|
}
|
|
}
|
|
}
|
|
}
|