domain.php 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?php
  2. namespace app\index;
  3. class domain extends BaseUser
  4. {
  5. function initialize()
  6. {
  7. parent::initialize();
  8. }
  9. function index()
  10. {
  11. $_var_0 = db("app_domain")->where("uid", $this->userid)->order("id desc")->select();
  12. ?> <!DOCTYPE html>
  13. <html lang="zh-cn">
  14. <head>
  15. <meta charset="utf-8">
  16. <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0"/>
  17. <meta name="keywords" content="<?php echo IN_KEYWORDS;?>"/>
  18. <meta name="description" content="<?php echo IN_DESCRIPTION;?>"/>
  19. <title>自定义域名设置 - <?php echo IN_NAME;?> - 免费应用内测托管平台|iOS应用Beta测试分发|Android应用内测分发</title>
  20. <?php
  21. $this->static_();
  22. ?> </head>
  23. <body>
  24. <?php
  25. $this->header();
  26. ?> <link rel="stylesheet" href="/static/pack/font-awesome-4.7.0/css/font-awesome.css"/>
  27. <script src="/static/index/js/jquery.form.js"></script>
  28. <div class="release-app-wrap">
  29. <div class="container">
  30. <div class="release-app2">
  31. <div class="crumbs">
  32. <a href="/index/apps">我的应用</a>
  33. <span>/</span>
  34. <a href="/index/apps">应用列表</a>
  35. <span>/</span>
  36. 自定义域名
  37. </div>
  38. <div class="row clearfix">
  39. <div class="col-sm-2">
  40. <aside class="aside-left">
  41. <ul>
  42. <li class="<?php echo ($this->module == 'publish' || $this->module == 'publish_update') ? 'active' : '' ?>">
  43. <a href="/index/publish/<?php echo $this->action ?>"> <span class="iconfont icon-upload1"></span>上传应用</a>
  44. </li>
  45. <li class="<?php echo $this->module == 'apps' ? 'active' : '' ?>">
  46. <a href="/index/apps/<?php echo $this->action ?>"><span class="iconfont icon-41"></span>应用列表</a>
  47. </li>
  48. <li class="<?php echo $this->module == 'domain' ? 'active' : '' ?>">
  49. <a href="/index/domain/<?php echo $this->action ?>"><span class="iconfont icon-liulanqi"></span>绑定域名</a>
  50. </li>
  51. <li class="<?php echo $this->module == 'combine' ? 'active' : '' ?>">
  52. <a href="/index/combine/<?php echo $this->action ?>"><span class="iconfont icon-erweima"></span>外部链接合并</a>
  53. </li>
  54. <li class="<?php echo $this->module == 'jilu' ? 'active' : '' ?>">
  55. <a href="/index/jilu/<?php echo $this->action ?>"><span class="iconfont icon-jilu"></span>合并记录</a>
  56. </li>
  57. </ul>
  58. </aside>
  59. </div>
  60. <div class="col-sm-10">
  61. <div class="aside-right">
  62. <div class="app-details app-details2">
  63. <div class="details-top clearfix">
  64. <b>自定义域名</b>
  65. <div>
  66. 设置提示:首先将您的域名别名解析(cname)到 <?php echo IN_CNAME ? IN_CNAME : $_SERVER["HTTP_HOST"];?> ,然后下方添加域名。<br>苹果应用需支持https访问,请去第三方平台申请cdn加速配置证书。
  67. </div>
  68. </div>
  69. <hr/>
  70. <div class="download-details">
  71. <div class="d-top clearfix">
  72. <div class="fl">
  73. <input class="form-control" type="text" id="urlpre" value=""
  74. placeholder="输入您的域名">
  75. </div>
  76. <button onclick="urladd();" type="button"
  77. class="ms-btn ms-btn-primary fl query">添加
  78. </button>
  79. </div>
  80. <div class="table-responsive">
  81. <table class="table version-history-table">
  82. <tbody>
  83. <tr>
  84. <th>
  85. ID
  86. </th>
  87. <th>
  88. 域名地址
  89. </th>
  90. <th>
  91. 访问次数
  92. </th>
  93. <th>
  94. 添加时间
  95. </th>
  96. <th>
  97. 操作
  98. </th>
  99. </tr>
  100. <?php
  101. if ($_var_0) {
  102. foreach ($_var_0 as $_var_1 => $_var_2) {
  103. ?> <tr>
  104. <td class="angle-parent">
  105. <?php echo $_var_2["id"];?> </td>
  106. <td>
  107. <a id="copylink<?php echo $_var_2["id"];?>"
  108. style="margin:0 5px;color:#157df1;font-size:14px;"
  109. class="fl" target="_blank"
  110. href="http://<?php echo $_var_2["domain"];?>">http://<?php echo $_var_2["domain"];?></a>
  111. <button class="copy table-btn fl"
  112. style="padding: 0 5px;border:0;font-size:14px;"
  113. data-clipboard-action="copy"
  114. data-clipboard-target="#copylink<?php echo $_var_2["id"];?>">
  115. 复制
  116. </button>
  117. </td>
  118. <td>
  119. <?php echo $_var_2["hits"];?> </td>
  120. <td>
  121. <?php echo $_var_2["create_time"];?> </td>
  122. <td>
  123. <input name="del_id" type="hidden"
  124. value="<?php echo $_var_2["id"];?>">
  125. <a href="javascript:;" class="iconfont icon-shanchu"
  126. title="删除"></a>
  127. </td>
  128. </tr>
  129. <?php
  130. }
  131. }
  132. ?> </tbody>
  133. </table>
  134. </div>
  135. </div>
  136. </div>
  137. </div>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. <script>
  144. function urladd() {
  145. var domain = $("#urlpre").val();
  146. if (!domain) {
  147. return alert('请输入域名!');
  148. }
  149. $.post('/index/domain/add', {domain}, function (ret) {
  150. ret.msg && alert(ret.msg, function () {
  151. if (ret.code) {
  152. window.location.reload();
  153. }
  154. });
  155. }, 'json');
  156. }
  157. $('.icon-shanchu').click(function () {
  158. var id = $(this).parent().find('input').val();
  159. alert('<b>你确定要删除该记录吗?</b>', function () {
  160. $.post('/index/domain/del', {id}, function (ret) {
  161. ret.msg && alert(ret.msg, function () {
  162. if (ret.code) {
  163. window.location.reload();
  164. }
  165. });
  166. }, 'json');
  167. }, function () {
  168. }, 'center', '删除', '取消');
  169. });
  170. </script>
  171. <?php
  172. $this->footer();
  173. ?> </body>
  174. </html>
  175. <?php
  176. }
  177. function add()
  178. {
  179. $_var_3 = SafeRequest("domain");
  180. if (!$_var_3) {
  181. reJson("请输入域名!");
  182. }
  183. if (db("app_domain")->where("domain", $_var_3)->count() || $_var_3 == $_SERVER["HTTP_HOST"] || $_var_3 == IN_TZDOMAIN || stristr(IN_SJDOMAIN, $_var_3)) {
  184. reJson("域名已存在!");
  185. }
  186. $_var_4 = db("app_domain")->insertGetId(["uid" => $this->userid, "domain" => $_var_3]);
  187. reJson($_var_4 ? "添加成功!" : "添加失败!", $_var_4);
  188. }
  189. function del()
  190. {
  191. $_var_5 = SafeRequest("id");
  192. $_var_6 = db("app_domain")->where("id", $_var_5)->delete();
  193. reJson($_var_6 ? "删除成功!" : "删除失败!", $_var_6);
  194. }
  195. }