Exemplo n.º 1
0
 /**
  * delete a job
  */
 public function delAction()
 {
     $oJob = new Job();
     $id = $this->params['job_id'];
     $ret = $oJob->del($id);
     $errno = $ret ? 0 : 1;
     $data = ['errno' => $errno];
     $this->json($data);
 }
Exemplo n.º 2
0
 /**
  * rely add
  */
 public function addAction()
 {
     $oRely = new Rely();
     $bind = [];
     $fields = Rely::$fields;
     foreach ($fields as $key => $default) {
         isset($this->params[$key]) && ($bind[$key] = $this->params[$key]);
     }
     $rely_job = $bind['rely_job'];
     $oJob = new Job();
     $arr = $oJob->get($rely_job, 'freq');
     $bind['freq'] = $arr['freq'];
     $id = $oRely->add($bind);
     $errno = $id > 0 ? 0 : -$id;
     $data = ['errno' => $errno, 'id' => $id];
     $this->json($data);
 }
Exemplo n.º 3
0
 /**
  * add a task
  */
 public function addAction()
 {
     $oTask = new Task();
     $bind = [];
     $fields = Task::$fields;
     foreach ($fields as $key => $default) {
         isset($this->params[$key]) && ($bind[$key] = $this->params[$key]);
     }
     $oJob = new Job();
     $arr = $oJob->get($bind['job_id'], 'freq,name,priority');
     $bind['freq'] = $arr['freq'];
     $bind['name'] = $arr['name'];
     if (empty($bind['priority'])) {
         $bind['priority'] = $arr['priority'];
     }
     $id = $oTask->add($bind);
     $errno = $id > 0 ? 0 : -$id;
     $data = ['errno' => $errno, 'id' => $id];
     $this->json($data);
 }