Example #1
0
 public static function getissue($type = 'dlt')
 {
     $lotyid = self::getlottid($type);
     $where = array('lotyid' => $lotyid);
     $query_struct_default = array('orderby' => array('id' => 'DESC'), 'limit' => array('per_page' => 20, 'page' => 1), 'where' => $where);
     $qhobj = Qihaoservice::get_instance();
     $issues = $qhobj->query_assoc($query_struct_default);
     return $issues;
 }
Example #2
0
 /**
  * 任务下达
  * @param $type
  */
 public function add($type = 'dlt')
 {
     if (empty($_POST)) {
         remind::set("未选择下达任务!", '/lottnum/jobs/index/' . $type . '/', 'error');
     }
     $lottyid = lottnum::getlottid($type);
     $issue = $this->input->post('issue');
     $jtype = $this->input->post('jtype');
     $query_struct_default = array('where' => array('lotyid' => $lottyid, 'qihao' => $issue));
     $qhservice = Qihaoservice::get_instance();
     $qihao = $qhservice->query_data_list($query_struct_default);
     if ($qihao) {
         if (time() <= strtotime($qihao[0]['endtime'])) {
             remind::set($issue . "期未截止不能下达清算任务!", '/lottnum/jobs/index/' . $type . '/', 'error');
         }
     } else {
         remind::set($issue . "期不存在不可做任务下达!", '/lottnum/jobs/index/' . $type . '/', 'error');
     }
     if ($jtype == 2) {
         $query_struct_default = array('where' => array('lottyid' => $lottyid, 'qihao' => $issue, 'tasktype' => 1));
         $jobobj = Lotty_jobService::get_instance();
         $job = $jobobj->query_data_list($query_struct_default);
         if (count($job) == 0) {
             remind::set($issue . "期清算任务未下达,不可下达算奖任务!", '/lottnum/jobs/index/' . $type . '/', 'error');
         } else {
             if ($qihao[0]['qsstat'] != 1) {
                 remind::set($issue . "期清算任务未完成不可做任务下达!", '/lottnum/jobs/index/' . $type . '/', 'error');
             }
         }
     } elseif ($jtype == 3) {
         $query_struct_default = array('where' => array('lottyid' => $lottyid, 'qihao' => $issue, 'tasktype' => 2));
         $jobobj = Lotty_jobService::get_instance();
         $job = $jobobj->query_data_list($query_struct_default);
         if (count($job) == 0) {
             remind::set($issue . "期算奖任务未下达,不可下达派奖任务!", '/lottnum/jobs/index/' . $type . '/', 'error');
         }
     }
     $data = array();
     $data['lottyid'] = $lottyid;
     $data['qihao'] = $issue;
     $data['tasktype'] = $jtype;
     $data['ctime'] = date("Y-m-d H:i:s");
     $data['stat'] = 0;
     $data['manager'] = $this->manager['username'];
     $flag = Lotty_jobService::get_instance()->add($data);
     if ($flag > 0) {
         remind::set("任务下达成功!", '/lottnum/jobs/index/' . $type . '/', 'success');
     } else {
         remind::set("任务下达失败!", '/lottnum/jobs/index/' . $type . '/', 'error');
     }
 }
Example #3
0
 public function batch_delete($type = 'dlt')
 {
     $qids = $this->input->post('qids');
     foreach ($qids as $val) {
         Qihaoservice::get_instance()->del($val);
     }
     remind::set("删除成功!", '/lottnum/qihao/index/' . $type . '/', 'success');
 }