123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- /**
- * Created by PhpStorm.
- * User: wuzhenke
- * Date: 2018/12/12
- * Time: 9:58
- */
- namespace App\Repositories;
- use App\Models\QueueAutoRefresh;
- use Prettus\Repository\Criteria\RequestCriteria;
- use Prettus\Repository\Eloquent\BaseRepository;
- class QueueAutoRefreshRepository extends BaseRepository
- {
- public function model()
- {
- return QueueAutoRefresh::class;
- }
- public function boot()
- {
- $this->pushCriteria(app(RequestCriteria::class));
- }
- public function findData($where)
- {
- return $this->model->where($where)->first();
- }
- public function getRefreshList($where)
- {
- return $this->model->where($where)->get();
- }
- public function resumeAutoRefresh()
- {
- $timeSpace = config('aix.personal_set.per_set.per_set.refresh_resume_space')*60;
- return $this->model->whereHas('resume',function ($query) use ($timeSpace) {
- $query->where('display',1)->whereIn('audit',getResumeStatus())->where('updated_at','<',date('Y-m-d H:i:s',time()-$timeSpace));
- })->where('type',2)->where('refreshtime','>=',time())->where('start_time','>=',strtotime(date('Y-m-d 00:00:00')))->where('start_time','<',strtotime(date('Y-m-d 23:59:59')))->get()->toArray();
- }
- public function delRefreshResume($where)
- {
- return $this->model->where($where)->delete();
- }
- public function getCrmRefreshs($where, $group_by = '')
- {
- $rst = $this->model->where($where);
- if ($group_by) {
- $rst->groupBy($group_by);
- }
- return $rst->get();
- }
- }
|