123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- namespace App\Modules\PersonalOp\Models;
- use Illuminate\Database\Eloquent\Model;
- use DB;
- class MediaPushDetailRecord extends Model
- {
- protected $table = 'media_push_detail_records';
- protected $fillable = ['uid', 'distribution_channel_id', 'appid', 'bid', 'date', 'hour', 'batch_id', 'push_time', 'user_num', 'origin_source_url',
- 'media_push_channel_user_id', 'seq', 'headline', 'media_push_record_id', 'promotion_id'];
- static function getInfos($params = [])
- {
- $search_obj = self::orderBy('id', 'desc');
- if (isset($params['start_time']) && $params['start_time']) {
- $search_obj->where('push_time', '>=', $params['start_time']);
- }
- if (isset($params['end_time']) && $params['end_time']) {
- $search_obj->where('push_time', '<=', $params['end_time']);
- }
- if (isset($params['appid']) && $params['appid']) {
- $search_obj->where('appid', $params['appid']);
- }
- return $search_obj->get();
- }
- static function getAppids($start_time, $end_time)
- {
- return self::where('push_time', '>=', $start_time)->where('push_time', '<=', $end_time)->select('appid')->distinct()->get();
- }
- static function updateInfos($id, $params = [])
- {
- return self::where('id', $id)->update($params);
- }
- static function getUnUpdatedInfos($params = [])
- {
- $search_obj = self::orderBy('id', 'desc');
- if (isset($params['start_time']) && $params['start_time']) {
- $search_obj->where('push_time', '<=', $params['start_time']);
- }
- if (isset($params['is_one_day']) && $params['is_one_day']) {
- $search_obj->whereNull('recharge_in_one_day');
- }
- if (isset($params['is_three_day']) && $params['is_three_day']) {
- $search_obj->whereNull('recharge_in_three_days');
- }
- return $search_obj->get();
- }
- }
|