123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- /**
- * Created by PhpStorm.
- * User: z-yang
- * Date: 2019/1/7
- * Time: 14:22
- */
- namespace App\Modules\Statistic\Services;
- use App\Modules\Statistic\Models\AdVisitStat;
- class AdVisitStatService
- {
- public static function create($uid,$bid,$cid,$type){
- $model = new AdVisitStat();
- $time = date('Ym');
- if($time == '201905'){
- $model->setCurrentTable();
- }else{
- $model->setCurrentTable($time);
- }
- try{
- $model->uid = $uid;
- $model->bid = $bid;
- $model->cid = $cid;
- $model->type = $type;
- $model->save();
- }catch (\Exception $e){
- }
- }
- 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();
- }
- public static function getInfoV2($uid,$cid,$type){
- $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){
- $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();
- }
- }
|