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 @@
快捷方式
diff --git a/application/views/bug_index.php b/application/views/bug_index.php index c923841..b8c9bd1 100755 --- a/application/views/bug_index.php +++ b/application/views/bug_index.php @@ -102,8 +102,18 @@
+ + 开启'; + } elseif ($value['status'] == 0) { + echo '关闭'; + }elseif ($value['status'] == '-1') { + echo '删除'; + } + ?> + - 无效反馈 @@ -119,11 +129,6 @@ 已处理 - - 已关闭 - - 已删除 - ".$level[$value['level']]['name']." ";?> diff --git a/application/views/bug_view.php b/application/views/bug_view.php index 1fca1bf..b12fad2 100755 --- a/application/views/bug_view.php +++ b/application/views/bug_view.php @@ -33,18 +33,30 @@
- input->cookie('uids') == $row['accept_user'])) {?> + input->cookie('uids') == $row['accept_user'])) {?>
- +
+ input->cookie('uids') || $row['accept_user'] == $this->input->cookie('uids'))) { ?> +
+ +
+ + + input->cookie('uids') || $row['accept_user'] == $this->input->cookie('uids'))) { ?> +
+ +
+ +
@@ -67,7 +79,16 @@

BUG反馈人 +

-

所属任务:

+

所属任务:

=1) {?>
@@ -104,10 +120,10 @@
- input->cookie('uids')) {?>
删除 + input->cookie('uids')) {?>
删除

- 路人甲 -

+ +
@@ -203,6 +219,7 @@ + @@ -241,7 +258,7 @@ dataType: "JSON", success: function(data){ if (data.status) { - $("#box").append('
'+data.message.addtime+'

'+data.message.realname+'

路人甲

'+data.message.content+'

'); + $("#box").append('
'+data.message.addtime+'

'+data.message.realname+'

'+data.message.role+'

'+data.message.content+'

'); editor.setValue(''); } else { alert('fail'); @@ -281,7 +298,7 @@ dataType: "JSON", success: function(data){ if (data.status) { - tip(data.message, '/bug/view/'+id, 'success', 2000); + tip(data.message, '/bug/view/'+id, 'success', 1000); } else { alert('fail'); } @@ -299,7 +316,7 @@ url: "/bug/checkin/"+bug_id+"/"+level, success: function(data){ if (data.status) { - location.href = '/bug/view/'+bug_id; + tip(data.message, '/bug/view/'+bug_id, 'success', 1000); } else { alert('fail'); } @@ -322,7 +339,7 @@ data: "content="+content+"&bug_id="+bug_id+"&security->get_csrf_token_name();?>=security->get_csrf_hash();?>", success: function(data){ if (data.status) { - location.href = '/bug/view/'+bug_id; + tip(data.message, '/bug/view/'+bug_id, 'success', 1000); } else { alert('fail'); } @@ -349,7 +366,7 @@ url: "/bug/del/"+id, success: function(data){ if (data.status) { - location.href = '/bug/view/'+id; + tip(data.message, '/bug/view/'+id, 'success', 1000); } else { alert('fail'); } @@ -358,6 +375,44 @@ } }); + $("#close").click(function(){ + var c = confirm("确认要关闭吗?"); + if(c) { + id = $(this).attr("ids"); + $.ajax({ + type: "GET", + dataType: "JSON", + url: "/bug/close/"+id, + success: function(data){ + if (data.status) { + tip(data.message, '/bug/view/'+id, 'success', 1000); + } else { + alert(data.message); + } + } + }); + } + }); + + $("#open").click(function(){ + var c = confirm("确认要重新打开吗?"); + if(c) { + id = $(this).attr("ids"); + $.ajax({ + type: "GET", + dataType: "JSON", + url: "/bug/open/"+id, + success: function(data){ + if (data.status) { + tip(data.message, '/bug/view/'+id, 'success', 1000); + } else { + alert(data.message); + } + } + }); + } + }); + //调整严重级别 jQuery(".select2").select2({ width: '100%', diff --git a/application/views/issue_view.php b/application/views/issue_view.php index d2eb454..07938fb 100755 --- a/application/views/issue_view.php +++ b/application/views/issue_view.php @@ -182,12 +182,13 @@ foreach ($test as $value) { if (!isset($timeGroup[$value['repos_id']])) { $timeGroup[$value['repos_id']] = 1; - echo ' '.$repos[$value['repos_id']]['repos_name'].''; + echo ' '.$repos[$value['repos_id']]['repos_name'].''; } ?>
- '.$repos[$value['repos_id']]['repos_name'].''; } else { echo ''.$repos[$value['repos_id']]['repos_name'].''; }?>@ + + '.$repos[$value['repos_id']]['repos_name'].''; } else { echo ''.$repos[$value['repos_id']]['repos_name'].''; }?> @当前'; } ?> @@ -242,13 +243,14 @@ - +
"; } ?>
-

:提测 的注意事项
+

:提测 的注意事项
@@ -323,27 +325,41 @@ foreach ($bug as $value) { ?> - + + 开启'; + } elseif ($value['status'] == 0) { + echo '关闭'; + }elseif ($value['status'] == '-1') { + echo '删除'; + } + ?> +
- ".$level[$value['level']]['name']." ";?> + ".$level[$value['level']]['name']." ";?> - - 未确认 - - - 处理中 - - - 已处理 - - - 反馈无效 - + + + 未确认 + + + 已确认 + + + 已确认 + + + 已处理 + + + 无效反馈 +