AdvertiseUserQueque.php 822 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Modules\Cpa\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class AdvertiseUserQueque extends Model
  5. {
  6. protected $table = 'advertise_user_queue';
  7. protected $fillable = ['id', 'ad_user_id', 'uid', 'bid', 'advertise_id', 'add_time','status'];
  8. public static function addToQueue($params){
  9. $res = self::where('uid',$params['uid'])
  10. //->where('status',1)
  11. ->first();
  12. if(!$res) {
  13. return self::updateOrCreate($params);
  14. }
  15. return false;
  16. }
  17. public static function getUserAdvertiseSubscribe($uid,$bid){
  18. return self::where('uid',$uid)->where('bid',$bid)->where('status',1)->first();
  19. }
  20. public static function getUserAdvertise($uid) {
  21. return self::where('uid',$uid)->where('status',1)->first();
  22. }
  23. }