public function getissue($type = 'dlt') { $lotyid = lottnum::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; }
/** * 任务下达 * @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'); } }
/** * 添加期号 * @param $type */ public function add($type = 'dlt', $id = null) { $data = array(); $data['type'] = $type; if (intval($id)) { $data['id'] = $id; } if (!is_null($id)) { $data['data'] = Qihaoservice::get_instance()->get_qihao_by_id($id); } $lotyid = lottnum::getlottid($type); //彩种配置 $lottconfig = Kohana::config("ticket_type.type"); $data['lottconfig'] = $lottconfig; $data['lotyid'] = $lotyid; //彩种奖项配置 $bonusconfig = Kohana::config("lottnum.bonusinfo"); $thislott = $bonusconfig[$type]; $data['bonusconfig'] = $thislott; $this->template->content = new View("lottnum/qihao_add", $data); }