| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 | 
							- <?php
 
- namespace App\Services\Common;
 
- use App\Exceptions\ResponseException;
 
- use App\Repositories\QueueAutoRefreshRepository;
 
- use http\Exception\RuntimeException;
 
- /**
 
-  * 自动刷新。
 
-  * Class QueueAutoRefreshService
 
-  * @package App\Services\Common
 
-  */
 
- class QueueAutoRefreshService
 
- {
 
-     protected $queueAutoRefreshRepository;
 
-     /**
 
-      * QqService constructor.
 
-      */
 
-     public function __construct(QueueAutoRefreshRepository $queueAutoRefreshRepository)
 
-     {
 
-        $this->queueAutoRefreshRepository = $queueAutoRefreshRepository;
 
-     }
 
-     public function getQueuAutoRefresh($pid, $utype)
 
-     {
 
-         $where['pid'] = $pid;
 
-         $where['utype'] = $utype;
 
-         $res = $this->queueAutoRefreshRepository->findData($where);
 
-         $status = false;
 
-         $refresh_start = '';
 
-         $refresh_end = '';
 
-         $id = '';
 
-         if($res){
 
-             if($res->refreshtime>=time() && $res->start_time){
 
-                 $status = true;
 
-                 $refresh_start = date('Y-m-d', $res->start_time);
 
-                 $refresh_end = date('Y-m-d', $res->refreshtime);
 
-                 $id = $res->id;
 
-             }
 
-         }
 
-         return ['status'=>$status,'refresh_start'=>$refresh_start,'refresh_end'=>$refresh_end,'id'=>$id];
 
-     }
 
-     public function delRefreshResume($id,$user)
 
-     {
 
-         if(!$id) {
 
-             throw new ResponseException('参数错误!');
 
-         }
 
-         $autoRefresh = $this->queueAutoRefreshRepository->findData(['id'=>$id]);
 
-         if(!$autoRefresh) {
 
-             throw new ResponseException('简历不存在!');
 
-         }
 
-         if($autoRefresh->uid != $user->id) {
 
-             throw new ResponseException('对不起,您只能操作自己的简历!');
 
-         }
 
-         return $this->queueAutoRefreshRepository->delRefreshResume(['id'=>$id]);
 
-     }
 
- }
 
 
  |