publish_tab_version.php 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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 class="pagination-wrap">
  95. <?php echo getRender($result, $page); ?>
  96. </div>
  97. </div>
  98. <!-- 编辑模态框 -->
  99. <div class="modal fade" role="dialog" id="updateModal">
  100. <div class="modal-dialog" role="document">
  101. <div class="modal-content">
  102. <div class="modal-header">
  103. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
  104. </button>
  105. <h4>版本编辑</h4>
  106. </div>
  107. <div class="modal-body">
  108. <div class="app-details-update">
  109. <div class="form-group clearfix">
  110. <label class="col-sm-2 control-label">更新说明</label>
  111. <div class="col-sm-10">
  112. <textarea rows="6" name="desc" class="form-control"></textarea>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="modal-footer">
  118. <button type="button" class="ms-btn ms-btn-primary w120 plugin-save mr20" data-dismiss="modal">
  119. 保存
  120. </button>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <script>
  126. var app_id = '<?php echo bees_encrypt($id);?>';
  127. // 发布功能
  128. $('.btn-fabu').click(function () {
  129. var history_id = $(this).parent().find('input').val();
  130. $.post('/index/ajax_profile/setUseHistory', {id: history_id, app_id: app_id}, function (data) {
  131. if (data.code == 200) {
  132. alert('发布版本成功', function () {
  133. window.location.reload();
  134. });
  135. return true;
  136. }
  137. }, 'json');
  138. });
  139. // 删除功能
  140. $('.btn-shanchu').click(function () {
  141. var history_id = $(this).parent().find('input').val();
  142. alert('<b>你确定要删除该版本信息吗?</b><br/>删除后将无法恢复!', function () {
  143. $.post('/index/ajax_profile/delHistory', {'id': history_id, app_id: app_id}, function (data) {
  144. if (data.code == 200) {
  145. alert('删除版本成功', function () {
  146. window.location.reload();
  147. });
  148. return true;
  149. } else {
  150. alert(data.msg);
  151. }
  152. }, 'json');
  153. }, function () {
  154. }, 'center', '删除', '取消');
  155. });
  156. // 编辑功能
  157. $('.btn-edit').click(function () {
  158. var history_id = $(this).parent().find('input').val();
  159. $.get('/index/ajax_profile/getHistory?id=' + history_id + '&app_id=' + app_id, function (data) {
  160. if (data.code != 200) {
  161. alert('系统繁忙,请稍后重试');
  162. return true;
  163. }
  164. $("#updateModal textarea[name='desc']").val('').val(data.data.desc);
  165. $('#updateModal').modal('show');
  166. $('#updateModal .ms-btn-primary').unbind().click(function () {
  167. var desc = $("#updateModal textarea[name='desc']").val();
  168. $.post('/index/ajax_profile/updateHistory', {
  169. 'id': history_id,
  170. app_id: app_id,
  171. desc: desc
  172. }, function (data) {
  173. if (data.code == 200) {
  174. alert('更新说明操作成功', function () {
  175. window.location.reload();
  176. });
  177. return true;
  178. }
  179. }, 'json');
  180. })
  181. }, 'json');
  182. });
  183. </script>