publish_tab_version.php 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  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 class="bundle-length" data-container="body"
  42. data-toggle="popover" data-placement="bottom"
  43. data-content="<?php echo $value["in_team"]; ?>"
  44. data-trigger="hover" data-original-title=""
  45. title="">
  46. <?php echo $value["in_team"]; ?>
  47. </div>
  48. <?php
  49. } else {
  50. ?> -
  51. <?php
  52. }
  53. ?>
  54. </td>
  55. <td>
  56. <?php
  57. if (empty($value["in_desc"])) {
  58. ?> -- --
  59. <?php
  60. } else {
  61. ?> <?php echo $value["in_desc"]; ?>
  62. <?php
  63. }
  64. ?>
  65. </td>
  66. <td><?php echo date("Y-m-d H:i:s", $value["in_addtime"]); ?></td>
  67. <td>
  68. <input name="history_id" type="hidden" value="<?php echo bees_encrypt($value["in_id"]); ?>">
  69. <?php
  70. if ($value["in_release"] != 1) {
  71. ?><a href="javascript:;" class="btn-fabu" title="发布">发布</a><?php
  72. }
  73. ?>
  74. <a href="#" data-target="#updateModal" data-toggle="modal" class="btn-edit" title="编辑">编辑</a>
  75. <a href="<?php echo getapp_history($value["in_id"], 1); ?>" title="下载">下载</a>
  76. <?php
  77. if ($value["in_release"] != 1) {
  78. ?><a href="javascript:;" class="btn-shanchu" title="删除">删除</a><?php
  79. }
  80. ?>
  81. </td>
  82. </tr>
  83. <?php
  84. }
  85. ?>
  86. </tbody>
  87. <tfoot>
  88. <tr>
  89. <td colspan="9"><?php echo getRender($result, $page); ?></td>
  90. </tr>
  91. </tfoot>
  92. </table>
  93. </div>
  94. </div>
  95. <!-- 编辑模态框 -->
  96. <div class="modal fade" role="dialog" id="updateModal">
  97. <div class="modal-dialog" role="document">
  98. <div class="modal-content">
  99. <div class="modal-header">
  100. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  101. </button>
  102. <h4>版本编辑</h4>
  103. </div>
  104. <div class="modal-body">
  105. <div class="app-details-update">
  106. <div class="form-group clearfix">
  107. <label class="col-sm-2 control-label">更新说明</label>
  108. <div class="col-sm-10">
  109. <textarea rows="6" name="desc" class="form-control"></textarea>
  110. </div>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="modal-footer">
  115. <button type="button" class="ms-btn ms-btn-primary w120 plugin-save mr20" data-dismiss="modal">
  116. 保存
  117. </button>
  118. </div>
  119. </div>
  120. </div>
  121. </div>
  122. <script>
  123. var app_id = '<?php echo bees_encrypt($id);?>';
  124. // 发布功能
  125. $('.btn-fabu').click(function () {
  126. var history_id = $(this).parent().find('input').val();
  127. $.post('/index/ajax_profile/setUseHistory', {id: history_id, app_id: app_id}, function (data) {
  128. if (data.code == 200) {
  129. alert('发布版本成功', function () {
  130. window.location.reload();
  131. });
  132. return true;
  133. }
  134. }, 'json');
  135. });
  136. // 删除功能
  137. $('.btn-shanchu').click(function () {
  138. var history_id = $(this).parent().find('input').val();
  139. alert('<b>你确定要删除该版本信息吗?</b><br/>删除后将无法恢复!', function () {
  140. $.post('/index/ajax_profile/delHistory', {'id': history_id, app_id: app_id}, function (data) {
  141. if (data.code == 200) {
  142. alert('删除版本成功', function () {
  143. window.location.reload();
  144. });
  145. return true;
  146. } else {
  147. alert(data.msg);
  148. }
  149. }, 'json');
  150. }, function () {
  151. }, 'center', '删除', '取消');
  152. });
  153. // 编辑功能
  154. $('.btn-edit').click(function () {
  155. var history_id = $(this).parent().find('input').val();
  156. $.get('/index/ajax_profile/getHistory?id=' + history_id + '&app_id=' + app_id, function (data) {
  157. if (data.code != 200) {
  158. alert('系统繁忙,请稍后重试');
  159. return true;
  160. }
  161. $("#updateModal textarea[name='desc']").val('').val(data.data.desc);
  162. $('#updateModal').modal('show');
  163. $('#updateModal .ms-btn-primary').unbind().click(function () {
  164. var desc = $("#updateModal textarea[name='desc']").val();
  165. $.post('/index/ajax_profile/updateHistory', {
  166. 'id': history_id,
  167. app_id: app_id,
  168. desc: desc
  169. }, function (data) {
  170. if (data.code == 200) {
  171. alert('更新说明操作成功', function () {
  172. window.location.reload();
  173. });
  174. return true;
  175. }
  176. }, 'json');
  177. })
  178. }, 'json');
  179. });
  180. </script>