diff --git a/application/controllers/bug.php b/application/controllers/bug.php index 2a5bb00..5f421af 100755 --- a/application/controllers/bug.php +++ b/application/controllers/bug.php @@ -323,12 +323,21 @@ public function coment_add_ajax() { } $this->load->helper('friendlydate'); if ($feedback['status']) { + if ($row['add_user'] == $this->input->cookie('uids')) { + $role = 'BUG反馈人'; + } elseif ( + $row['accept_user'] == $this->input->cookie('uids')) { + $role = 'BUG受理人'; + } else { + $role = '路人甲'; + } $callBack = array( 'status' => true, 'message' => array( 'content'=>html_entity_decode($this->input->post('content')), 'username'=>$users[$this->input->cookie('uids')]['username'], 'realname'=>$users[$this->input->cookie('uids')]['realname'], + 'role' => $role, 'addtime' => friendlydate(time()) ) ); @@ -447,6 +456,44 @@ public function del() { echo json_encode($callBack); } + public function close() { + $bugId = $this->uri->segment(3, 0); + $this->load->model('Model_bug', 'bug', TRUE); + $flag = $this->bug->close($bugId); + if ($flag) { + $callBack = array( + 'status' => true, + 'message' => '关闭成功' + ); + } else { + $callBack = array( + 'status' => false, + 'message' => '关闭失败' + ); + } + + echo json_encode($callBack); + } + + public function open() { + $bugId = $this->uri->segment(3, 0); + $this->load->model('Model_bug', 'bug', TRUE); + $flag = $this->bug->open($bugId); + if ($flag) { + $callBack = array( + 'status' => true, + 'message' => '操作成功' + ); + } else { + $callBack = array( + 'status' => false, + 'message' => '操作失败' + ); + } + + echo json_encode($callBack); + } + public function star_ajax() { $bugId = $this->uri->segment(3, 0); $this->load->model('Model_bug', 'bug', TRUE); diff --git a/application/controllers/issue.php b/application/controllers/issue.php index 61f3e4e..3028598 100755 --- a/application/controllers/issue.php +++ b/application/controllers/issue.php @@ -1018,6 +1018,21 @@ public function change_flow() { exit(); }*/ + //验证是否还存在激活的BUG + if ($flow == 'wait') { + $this->load->model('Model_bug', 'bug', TRUE); + $bugAct = $this->bug->getBugAct($id); + if ($bugAct) { + $callBack = array( + 'status' => false, + 'message' => '还有正常开启的BUG需要解决', + 'url' => '/issue/view/'.$row['id'] + ); + echo json_encode($callBack); + exit(); + } + } + //更改工作流 $user = $this->input->cookie('uids'); if ($flow == 'fixed') { diff --git a/application/models/model_bug.php b/application/models/model_bug.php index 44ab0a8..a31b669 100755 --- a/application/models/model_bug.php +++ b/application/models/model_bug.php @@ -29,7 +29,7 @@ public function add($data) { public function listByIssueId($id) { $rows = array('total' => 0, 'data' => false); - $this->db->select('id, subject, state, level, add_user, add_time, accept_user, accept_time'); + $this->db->select('id, subject, state, level, add_user, add_time, accept_user, accept_time,status'); $this->db->where('issue_id', $id); $db = clone($this->db); $rows['total'] = $this->db->count_all_results($this->_table); @@ -108,11 +108,19 @@ public function checkin($id, $level) { } public function checkout($id) { - return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'state' => '-1', 'check_time' => time()), array('id' => $id)); + return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'state' => '-1', 'check_time' => time(), 'status' => '0'), array('id' => $id)); + } + + public function close($id) { + return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'check_time' => time(), 'status' => '0'), array('id' => $id)); + } + + public function open($id) { + return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'check_time' => time(), 'status' => '1', 'state' => '0'), array('id' => $id)); } public function over($id) { - return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'state' => '3'), array('id' => $id)); + return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'state' => '3', 'status' => '0'), array('id' => $id)); } public function starList($projectId = 0, $limit = 20, $offset = 0) { @@ -159,4 +167,14 @@ public function starByBugId($array) { $row = $query->result_array(); return $row; } + + public function getBugAct($id) { + $row = array(); + $this->db->select('id'); + $this->db->where('issue_id', $id); + $this->db->where('status', 1); + $query = $this->db->get($this->_table); + $row = $query->result_array(); + return $row; + } } \ No newline at end of file diff --git a/application/models/model_bugcomment.php b/application/models/model_bugcomment.php index a4888aa..8d83bee 100755 --- a/application/models/model_bugcomment.php +++ b/application/models/model_bugcomment.php @@ -42,4 +42,8 @@ public function rows($bugId, $limit = 100, $offset = 0) { public function del($id) { return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'status' => '-1'), array('id' => $id)); } + + public function delByBug($id) { + return $this->db->update($this->_table, array('last_time' => time(), 'last_user' => $this->input->cookie('uids'), 'status' => '-1'), array('bug_id' => $id)); + } } \ No newline at end of file diff --git a/application/models/model_test.php b/application/models/model_test.php index 928350d..49896bc 100755 --- a/application/models/model_test.php +++ b/application/models/model_test.php @@ -86,7 +86,7 @@ public function listByIssueId($id) { $db = clone($this->db); $rows['total'] = $this->db->count_all_results($this->_table); $this->db = $db; - $this->db->order_by('repos_id', 'desc'); + $this->db->order_by('repos_id,id', 'desc'); $query = $this->db->get($this->_table); $rows['data'] = $query->result_array(); return $rows; diff --git a/application/views/bug_add.php b/application/views/bug_add.php index 827a645..dab0a69 100755 --- a/application/views/bug_add.php +++ b/application/views/bug_add.php @@ -23,8 +23,8 @@
'+data.message.content+'
'+data.message.content+'
:提测 的注意事项
:提测 的注意事项