publish_tab_version.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. // 应用版本列表查询逻辑
  3. $page = SafeRequest("page", "get");
  4. $result = db("app")->where("in_uid", $this->userid)->where("in_appid", $id)->order("in_addtime desc")->paginate(["page" => $page, 'list_rows' => 5]);
  5. $render = $result->render();
  6. $count = $result->total();
  7. $del_vid = 0;
  8. if ($count > 3) {
  9. $del_vid = db("app")->where("in_uid", $this->userid)->where("in_appid", $id)->order("in_addtime asc")->value("in_id");
  10. }
  11. ?>
  12. <div class="table-list">
  13. <div class="table-responsive">
  14. <table class="table version-history-table">
  15. <tbody>
  16. <tr>
  17. <th>版本</th>
  18. <th>大小</th>
  19. <th>证书名称</th>
  20. <th>更新说明</th>
  21. <th>更新时间</th>
  22. <th>操作</th>
  23. </tr>
  24. <?php
  25. foreach ($result as $key => $value) {
  26. ?>
  27. <tr>
  28. <td class="angle-parent">
  29. <?php
  30. if ($value["in_release"] == 1) {
  31. ?><img class="angle" src="/static/index/image/angle-1.png"><?php
  32. }
  33. ?>
  34. <?php echo $value["in_bsvs"]; ?> (Build <?php echo $value["in_bvs"]; ?>)
  35. </td>
  36. <td><?php echo formatsize($value["in_size"]); ?></td>
  37. <td>
  38. <?php
  39. if ($value["in_form"] == "iOS") {
  40. ?>
  41. <div title="<?php echo $value["in_team"]; ?>">
  42. <?php echo $value["in_team"]; ?>
  43. </div>
  44. <?php
  45. } else {
  46. ?> -
  47. <?php
  48. }
  49. ?>
  50. </td>
  51. <td>
  52. <?php
  53. if (empty($value["in_desc"])) {
  54. ?> -- --
  55. <?php
  56. } else {
  57. ?> <?php echo $value["in_desc"]; ?>
  58. <?php
  59. }
  60. ?>
  61. </td>
  62. <td><?php echo date("Y-m-d H:i:s", $value["in_addtime"]); ?></td>
  63. <td>
  64. <input name="history_id" type="hidden" value="<?php echo bees_encrypt($value["in_id"]); ?>">
  65. <?php
  66. if ($value["in_release"] != 1) {
  67. ?><a href="javascript:;" class="btn-fabu" title="发布">发布</a><?php
  68. }
  69. ?>
  70. <a href="#" data-target="#updateModal" data-toggle="modal" class="btn-edit" title="编辑">编辑</a>
  71. <a href="<?php echo getapp_history($value["in_id"], 1); ?>" title="下载">下载</a>
  72. <?php
  73. if ($value["in_release"] != 1) {
  74. ?><a href="javascript:;" class="btn-shanchu" title="删除">删除</a><?php
  75. }
  76. ?>
  77. </td>
  78. </tr>
  79. <?php
  80. }
  81. ?>
  82. </tbody>
  83. <!-- <tfoot>
  84. <tr>
  85. <td colspan="9"><?php echo getRender($result, $page); ?></td>
  86. </tr>
  87. </tfoot> -->
  88. </table>
  89. </div>
  90. <div class="pagination-wrap">
  91. <?php echo getRender($result, $page); ?>
  92. </div>
  93. </div>
  94. <!-- 编辑模态框 -->
  95. <div class="modal fade" role="dialog" id="updateModal">
  96. <div class="modal-dialog" role="document">
  97. <div class="modal-content">
  98. <div class="modal-header">
  99. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  100. </button>
  101. <h4>版本编辑</h4>
  102. </div>
  103. <div class="modal-body">
  104. <div class="app-details-update">
  105. <div class="form-group clearfix">
  106. <label class="col-sm-2 control-label">更新说明</label>
  107. <div class="col-sm-10">
  108. <textarea rows="6" name="desc" class="form-control"></textarea>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. <div class="modal-footer">
  114. <button type="button" class="ms-btn ms-btn-primary w120 plugin-save mr20" data-dismiss="modal">
  115. 保存
  116. </button>
  117. </div>
  118. </div>
  119. </div>
  120. </div>
  121. <script>
  122. var app_id = '<?php echo bees_encrypt($id);?>';
  123. // 发布功能
  124. $('.btn-fabu').click(function () {
  125. var history_id = $(this).parent().find('input').val();
  126. $.post('/index/ajax_profile/setUseHistory', {id: history_id, app_id: app_id}, function (data) {
  127. if (data.code == 200) {
  128. alert('发布版本成功', function () {
  129. window.location.reload();
  130. });
  131. return true;
  132. }
  133. }, 'json');
  134. });
  135. // 删除功能
  136. $('.btn-shanchu').click(function () {
  137. var history_id = $(this).parent().find('input').val();
  138. alert('<b>你确定要删除该版本信息吗?</b><br/>删除后将无法恢复!', function () {
  139. $.post('/index/ajax_profile/delHistory', {'id': history_id, app_id: app_id}, function (data) {
  140. if (data.code == 200) {
  141. alert('删除版本成功', function () {
  142. window.location.reload();
  143. });
  144. return true;
  145. } else {
  146. alert(data.msg);
  147. }
  148. }, 'json');
  149. }, function () {
  150. }, 'center', '删除', '取消');
  151. });
  152. // 编辑功能
  153. $('.btn-edit').click(function () {
  154. var history_id = $(this).parent().find('input').val();
  155. $.get('/index/ajax_profile/getHistory?id=' + history_id + '&app_id=' + app_id, function (data) {
  156. if (data.code != 200) {
  157. alert('系统繁忙,请稍后重试');
  158. return true;
  159. }
  160. $("#updateModal textarea[name='desc']").val('').val(data.data.desc);
  161. $('#updateModal').modal('show');
  162. $('#updateModal .ms-btn-primary').unbind().click(function () {
  163. var desc = $("#updateModal textarea[name='desc']").val();
  164. $.post('/index/ajax_profile/updateHistory', {
  165. 'id': history_id,
  166. app_id: app_id,
  167. desc: desc
  168. }, function (data) {
  169. if (data.code == 200) {
  170. alert('更新说明操作成功', function () {
  171. window.location.reload();
  172. });
  173. return true;
  174. }
  175. }, 'json');
  176. })
  177. }, 'json');
  178. });
  179. </script>