combine.php 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185
  1. <?php
  2. namespace app\index;
  3. class combine extends BaseUser
  4. {
  5. function initialize()
  6. {
  7. parent::initialize();
  8. }
  9. function index()
  10. {ini_set('display_errors', 1);
  11. ini_set('display_startup_errors', 1);
  12. error_reporting(E_ALL);
  13. // 获取页码参数
  14. $page = SafeRequest("page", "get");
  15. if (empty($page)) {
  16. $page = 1;
  17. }
  18. // 使用分页查询
  19. $result = db("combine")->where("userid", $this->userid)->order("id desc")->paginate(["page" => $page, 'list_rows' => 5]);
  20. $count = $result->total();
  21. ?>
  22. <!DOCTYPE html>
  23. <html lang="zh-cn">
  24. <head>
  25. <meta charset="utf-8">
  26. <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
  27. <meta name="keywords" content="<?php echo IN_KEYWORDS; ?>" />
  28. <meta name="description" content="<?php echo IN_DESCRIPTION; ?>" />
  29. <title>外部链接合并 - <?php echo IN_NAME; ?> - 免费应用内测托管平台|iOS应用Beta测试分发|Android应用内测分发</title>
  30. <?php $this->static_(); ?>
  31. </head>
  32. <body>
  33. <?php $this->header(); ?>
  34. <style>
  35. .details-top {
  36. padding: 39px 30px;
  37. }
  38. .details-top .p1{
  39. color: rgba(21, 21, 21, 1);
  40. font-family: Source Han Sans SC;
  41. font-weight: 500;
  42. font-size: 16px;
  43. line-height: 20px;
  44. }
  45. #hotApp_box {
  46. display: flex;
  47. justify-content: space-between;
  48. align-items: start;
  49. margin: 0;
  50. }
  51. .download-details {
  52. padding: 10px 30px 72px;
  53. }
  54. .flex-left {
  55. width: calc(100% - 303px);
  56. }
  57. .flex-right {
  58. width: 303px;
  59. }
  60. .qrcode_img {
  61. width: 235px;
  62. height: 235px;
  63. object-fit: cover;
  64. border: 1px solid rgba(232, 234, 236, 1);
  65. }
  66. .qrcode_img::placeholder {
  67. color: rgba(143, 149, 159, 1);
  68. font-size: 16px;
  69. line-height: 22px;
  70. }
  71. .qrcode_url_tips {
  72. font-size: 13px;
  73. line-height: 17px;
  74. margin: 10px 0;
  75. }
  76. .qrcode_url_input_box {
  77. margin-bottom: 30px;
  78. }
  79. .qrcode_url_input_box input {
  80. border: 1px solid rgba(232, 234, 236, 1);
  81. /* width: 711px; */
  82. height: 52px;
  83. line-height: 52px;
  84. border-width: 1px;
  85. padding: 0 20px;
  86. box-sizing: border-box;
  87. font-size: 14px;
  88. color: rgba(21, 21, 21, 1);
  89. }
  90. .qrcode_url_input_box input::placeholder {
  91. font-size: 14px;
  92. color: rgba(143, 149, 159, 1);
  93. }
  94. .generate_btn_box {
  95. margin-top: 50px;
  96. }
  97. .generate_qrcode_btn {
  98. background: rgba(33, 104, 251, 1);
  99. width: 120px;
  100. height: 34px;
  101. border-radius: 4px;
  102. padding-top: 7px;
  103. padding-right: 20px;
  104. padding-bottom: 7px;
  105. padding-left: 20px;
  106. color: rgba(255, 255, 255, 1);
  107. font-family: Source Han Sans SC;
  108. font-weight: 500;
  109. font-style: Medium;
  110. font-size: 16px;
  111. line-height: 20px;
  112. }
  113. #hotApp-qrcode-downBtn:active:focus,
  114. #hotApp-qrcode-downBtn:hover,
  115. .generate_qrcode_btn:active:focus,
  116. .generate_qrcode_btn:hover {
  117. background: rgba(33, 104, 251, 1);
  118. color: rgba(255, 255, 255, 1);
  119. border: unset;
  120. outline: none;
  121. }
  122. .qrcode_show_box {
  123. text-align: right;
  124. margin-bottom: 12px;
  125. margin-top: 10px;
  126. }
  127. .qrcode_url_box { margin-bottom: 20px; }
  128. .qrcode_url_tips { margin-bottom: 10px; }
  129. .os_name { font-weight: bold; color: #333; }
  130. .qrcode_url_input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
  131. /* .qrcode_function {
  132. text-align: center;
  133. }
  134. .down_btnbox {
  135. text-align: center;
  136. } */
  137. .qrcode_function {
  138. margin: 0 auto;
  139. }
  140. .down_btnbox {
  141. padding-left: 126px;
  142. }
  143. #hotApp-qrcode-downBtn {
  144. border: 1px solid rgba(33, 104, 251, 1);
  145. width: 120px;
  146. height: 34px;
  147. border-radius: 4px;
  148. padding: 0 20px;
  149. background: rgba(255, 255, 255, 1);
  150. color: rgba(33, 104, 251, 1);
  151. font-size: 16px;
  152. line-height: 34px;
  153. float: unset;
  154. margin: 0 auto;
  155. }
  156. .tab-content {
  157. display: none;
  158. }
  159. .tab-content.active {
  160. display: block;
  161. }
  162. /* 标签页样式 */
  163. .tabs {
  164. margin: 12px 0 0 0;
  165. padding: 10px 30px;
  166. }
  167. .tabs .nav-tabs {
  168. border-bottom: 0 solid #e5e5e5;
  169. /* 添加横向滚动支持 */
  170. overflow-x: auto;
  171. overflow-y: hidden;
  172. white-space: nowrap;
  173. display: flex;
  174. flex-wrap: nowrap;
  175. -webkit-overflow-scrolling: touch;
  176. /* iOS滚动优化 */
  177. scrollbar-width: none;
  178. /* Firefox隐藏滚动条 */
  179. -ms-overflow-style: none;
  180. /* IE隐藏滚动条 */
  181. }
  182. /* 隐藏Webkit浏览器的滚动条 */
  183. .tabs .nav-tabs::-webkit-scrollbar {
  184. display: none;
  185. }
  186. .tabs .nav-tabs>li>a {
  187. border: none;
  188. padding: 12px 2px;
  189. margin-right: 24px;
  190. border-radius: 0;
  191. color: rgba(143, 149, 159, 1);
  192. font-family: Source Han Sans SC;
  193. font-weight: 500;
  194. font-size: 15px;
  195. line-height: 20px;
  196. }
  197. .tabs .nav-tabs>li>a:hover {
  198. border: none;
  199. background-color: #ffffff;
  200. color: rgba(75, 132, 255, 1);
  201. }
  202. .tabs .nav-tabs>li.active>a,
  203. .tabs .nav-tabs>li.active>a:hover,
  204. .tabs .nav-tabs>li.active>a:focus {
  205. border: none;
  206. border-bottom: 2px solid rgba(75, 132, 255, 1);
  207. color: rgba(75, 132, 255, 1);
  208. font-weight: 700;
  209. }
  210. /* 记录 */
  211. .table-responsive {
  212. overflow-x: auto;
  213. border: 1px solid rgba(232, 234, 236, 1);
  214. }
  215. /* 通用表格设置 */
  216. .table {
  217. border: 1px solid #e5e5e5;
  218. margin-bottom: 0;
  219. }
  220. .table>tbody>tr>th {
  221. background: rgba(245, 246, 247, 1);
  222. height: 36px;
  223. color: rgba(143, 149, 159, 1);
  224. font-family: Source Han Sans SC;
  225. font-weight: 500;
  226. font-size: 14px;
  227. line-height: 18px;
  228. text-align: center;
  229. vertical-align: middle !important;
  230. }
  231. .table>tbody>tr>td {
  232. color: rgba(0, 0, 0, 1);
  233. box-sizing: border-box;
  234. padding: 0 15px !important;
  235. height: 68px;
  236. text-align: center;
  237. font-family: Source Han Sans SC;
  238. font-weight: 400;
  239. font-size: 14px;
  240. line-height: 13px;
  241. border-top: unset;
  242. border-bottom: 1px solid rgba(232, 234, 236, 1);
  243. vertical-align: middle !important;
  244. }
  245. .table>tfoot>tr>td {
  246. padding: 0 15px !important;
  247. vertical-align: middle !important;
  248. text-align: center;
  249. }
  250. .table>tbody>tr:hover>td {
  251. background-color: #ebf7ff;
  252. }
  253. .table>tbody>tr>td.angle-parent {
  254. color: rgba(75, 132, 255, 1);
  255. }
  256. .table>tbody>tr>td>a {
  257. color: rgba(33, 104, 251, 1);
  258. font-weight: 500;
  259. font-size: 14px;
  260. }
  261. .table>tbody>tr>td>a+a {
  262. margin-left: 14px;
  263. }
  264. /* 操作按钮 */
  265. .table .btn-detail {
  266. height: 30px;
  267. border-width: 1px;
  268. border-radius: 4px;
  269. padding-top: 5px;
  270. padding-right: 8px;
  271. padding-bottom: 5px;
  272. padding-left: 8px;
  273. color: rgba(255, 116, 41, 1);
  274. border: 1px solid rgba(255, 116, 41, 1);
  275. font-family: Source Han Sans SC;
  276. font-weight: 500;
  277. font-size: 14px;
  278. line-height: 20px;
  279. }
  280. /* 翻页 */
  281. .pagination-box {
  282. /* text-align: right; */
  283. }
  284. .pagination {
  285. margin: 10px auto 10px;
  286. }
  287. .pagination>li>a,
  288. .pagination>li>span {
  289. color: rgba(33, 104, 251, 1);
  290. }
  291. .pagination>.active>a,
  292. .pagination>.active>a:focus,
  293. .pagination>.active>a:hover,
  294. .pagination>.active>span,
  295. .pagination>.active>span:focus,
  296. .pagination>.active>span:hover {
  297. background-color: rgba(33, 104, 251, 1);
  298. border-color: rgba(33, 104, 251, 1);
  299. }
  300. .pagination>li:first-child {
  301. display: inline-block;
  302. padding: 7px 0 7px 12px;
  303. background-color: transparent !important;
  304. border: unset;
  305. color: rgba(33, 104, 251, 1);
  306. pointer-events: none;
  307. }
  308. /* 底部 */
  309. .tips {
  310. margin: 12px auto 57px;
  311. color: rgba(143, 149, 159, 1);
  312. font-size: 13px;
  313. line-height: 20px;
  314. }
  315. @media (max-width: 768px) {
  316. .release-app2>.row {
  317. margin: 0;
  318. }
  319. .app-details .details-top {
  320. padding: 0.32rem;
  321. }
  322. .details-top .p1{
  323. font-size: 0.28rem;
  324. line-height: 0.40rem;
  325. }
  326. #hotApp_box {
  327. margin: 0;
  328. display: block;
  329. }
  330. .download-details {
  331. padding: 0.20rem 0.32rem 0.60rem;
  332. }
  333. .flex-left {
  334. width: 100%;
  335. }
  336. .flex-right {
  337. width: 100%;
  338. }
  339. .qrcode_img {
  340. width: 2.66rem;
  341. height: 2.66rem;
  342. margin: 0 auto;
  343. }
  344. .qrcode_url_tips {
  345. font-size: 0.28rem;
  346. line-height: 0.34rem;
  347. margin: 0.20rem 0;
  348. }
  349. .qrcode_url_input_box {
  350. margin-bottom: 0.4rem;
  351. }
  352. .qrcode_url_input_box input {
  353. height: 0.64rem;
  354. line-height: 0.64rem;
  355. padding: 0 0.24rem;
  356. font-size: 0.28rem;
  357. }
  358. .qrcode_url_input_box input::placeholder {
  359. font-size: 0.28rem;
  360. }
  361. .generate_btn_box {
  362. margin-top: 0;
  363. }
  364. .generate_qrcode_btn {
  365. width: 100%;
  366. height: 0.68rem;
  367. border-radius: 0.08rem;
  368. font-size: 0.32rem;
  369. line-height: 0.68rem;
  370. padding: 0;
  371. }
  372. #hotApp-qrcode-downBtn:active:focus,
  373. #hotApp-qrcode-downBtn:hover,
  374. .generate_qrcode_btn:active:focus,
  375. .generate_qrcode_btn:hover {
  376. background: rgba(33, 104, 251, 1);
  377. color: rgba(255, 255, 255, 1);
  378. }
  379. .qrcode_show_box {
  380. margin-bottom: 0.2rem;
  381. margin-top: 0.48rem;
  382. text-align: center;
  383. }
  384. .qrcode_url_box { margin-bottom: 20px; }
  385. .qrcode_url_tips {margin-bottom: 0.20rem;}
  386. .qrcode_url_input {
  387. width: 100%;
  388. padding: 10px;
  389. border-radius: 4px;
  390. }
  391. .qrcode_function {
  392. margin: 0 auto;
  393. }
  394. .down_btnbox {
  395. padding-left: 0;
  396. }
  397. #hotApp-qrcode-downBtn {
  398. width: 100%;
  399. height: 0.68rem;
  400. border-radius: 0.08rem;
  401. font-size: 0.32rem;
  402. line-height: 0.68rem;
  403. }
  404. .down_qrcode_box {
  405. width: 100%;
  406. }
  407. /* 标签页样式 */
  408. .tabs {
  409. margin: 0;
  410. padding: 0 0.32rem;
  411. }
  412. .tabs .nav-tabs>li>a {
  413. padding: 0.24rem 0.04rem;
  414. margin-right: 0.48rem;
  415. font-size: 0.30rem;
  416. line-height: 0.40rem;
  417. }
  418. /* 通用表格设置 */
  419. .table {
  420. margin-bottom: 0;
  421. }
  422. .table>tbody>tr>th {
  423. height: 0.72rem;
  424. font-size: 0.28rem;
  425. line-height: 0.36rem;
  426. }
  427. .table>tbody>tr>td {
  428. padding: 0.2rem 0.30rem!important;
  429. height: 1.36rem;
  430. font-size: 0.28rem;
  431. line-height: 0.32rem;
  432. }
  433. .table>tfoot>tr>td {
  434. padding: 0 0.30rem !important;
  435. }
  436. .table>tbody>tr>td>a {
  437. font-size: 0.28rem;
  438. }
  439. .table>tbody>tr>td>a+a {
  440. margin-left: 0.28rem;
  441. }
  442. /* 操作按钮 */
  443. .table .btn-detail {
  444. height: 0.60rem;
  445. border-radius: 0.08rem;
  446. padding-top: 0.10rem;
  447. padding-right: 0.16rem;
  448. padding-bottom: 0.10rem;
  449. padding-left: 0.16rem;
  450. font-size: 0.28rem;
  451. line-height: 0.40rem;
  452. }
  453. /* 翻页 */
  454. .pagination {
  455. margin: 0.20rem auto 0.20rem;
  456. }
  457. .pagination>li:first-child {
  458. padding: 0.14rem 0 0.14rem 0.24rem;
  459. }
  460. /* 底部 */
  461. .release-app2 .warn-prompt-wrap {
  462. padding-bottom: unset;
  463. margin-top: 0;
  464. margin-bottom: 1.46rem;
  465. }
  466. .tips {
  467. margin: 0.24rem auto 0.48rem;
  468. color: rgba(143, 149, 159, 1);
  469. font-weight: 400;
  470. font-size: 0.24rem;
  471. line-height: 0.40rem;
  472. }
  473. }
  474. </style>
  475. <div class="release-app-wrap">
  476. <div class="container">
  477. <div class="release-app2">
  478. <div class="crumbs">
  479. <a href="/index/apps">我的应用</a>
  480. <span>/</span>
  481. <a href="/index/apps">应用列表</a>
  482. <span>/</span>
  483. 外部链接合并
  484. </div>
  485. <div class="row clearfix">
  486. <div class="col-sm-2">
  487. <aside class="aside-left">
  488. <ul>
  489. <li title="上传应用" class="<?php echo ($this->module == 'publish' || $this->module == 'publish_update') ? 'active' : '' ?>">
  490. <a href="/index/publish/<?php echo $this->action ?>"> <span class="iconfont icon-upload1"></span>上传应用</a>
  491. </li>
  492. <li title="应用列表" class="<?php echo $this->module == 'apps' ? 'active' : '' ?>">
  493. <a href="/index/apps/<?php echo $this->action ?>"><span class="iconfont icon-41"></span>应用列表</a>
  494. </li>
  495. <li title="绑定域名" class="<?php echo $this->module == 'domain' ? 'active' : '' ?>">
  496. <a href="/index/domain/<?php echo $this->action ?>"><span class="iconfont icon-liulanqi"></span>绑定域名</a>
  497. </li>
  498. <li title="外部链接合并" class="<?php echo $this->module == 'combine' ? 'active' : '' ?>">
  499. <a href="/index/combine/<?php echo $this->action ?>"><span class="iconfont icon-erweima"></span>外部链接合并</a>
  500. </li>
  501. <!-- <li title="合并记录" class="<?php echo $this->module == 'jilu' ? 'active' : '' ?>">
  502. <a href="/index/jilu/<?php echo $this->action ?>"><span class="iconfont icon-jilu"></span>合并记录</a>
  503. </li> -->
  504. </ul>
  505. </aside>
  506. </div>
  507. <div class="col-sm-10">
  508. <div class="aside-right">
  509. <div class="app-details app-details2">
  510. <div class="details-top clearfix">
  511. <b class="p1">外部链接合并</b>
  512. <div class="p1">
  513. 设置提示:本功能可将外部的ios链接或安卓链接,来和本站的链接进行合并到一起使用,
  514. <br class="hidden-xs">
  515. 以便更好的管理不同平台链接的使用,可生成二维码和短链接。
  516. </div>
  517. </div>
  518. <div style="height: 10px; background: rgb(242, 242, 245)"></div>
  519. <div class="tabs">
  520. <ul class="nav nav-tabs" role="tablist">
  521. <li role="presentation" class="active">
  522. <a href="?tab=combine" aria-controls="tab-combine" role="tab">链接合并</a>
  523. </li>
  524. <li role="presentation" class="">
  525. <a href="?tab=record" aria-controls="tab-record" role="tab">合并记录</a>
  526. </li>
  527. </ul>
  528. </div>
  529. <div class="download-details">
  530. <!-- 链接合并表单 -->
  531. <div id="tab-combine" class="generate_qrcode_box tab-content <?php echo (SafeRequest("tab", "get") != 'record') ? 'active' : ''; ?>">
  532. <div class="row" id="hotApp_box">
  533. <div class="flex-left">
  534. <div class="qrcode_url_box">
  535. <div class="qrcode_url_tips">
  536. <b class="os_name">iOS系统</b>
  537. </div>
  538. <div class="qrcode_url_input_box">
  539. <input type="text" placeholder="请输入苹果应用下载地址" id="ios_url" class="form-control qrcode_url_input">
  540. </div>
  541. </div>
  542. <div class="qrcode_url_box">
  543. <div class="qrcode_url_tips">
  544. <b class="os_name">安卓系统</b>
  545. </div>
  546. <div class="qrcode_url_input_box">
  547. <input type="text" id="android_url" class="form-control qrcode_url_input" placeholder="请输入安卓系统应用下载地址">
  548. </div>
  549. </div>
  550. <div class="qrcode_url_box" id="shortUrlha" style="display:none">
  551. <div class="qrcode_url_tips">
  552. <b class="os_name">短连接地址</b>
  553. </div>
  554. <div class="qrcode_url_input_box">
  555. <input type="text" id="shortUrlh" class="form-control qrcode_url_input" placeholder="">
  556. </div>
  557. </div>
  558. <div class="alert alert-success" style="display: none;">
  559. <span class="txt"></span>
  560. </div>
  561. <div class="alert alert-danger" style="display: none;">
  562. <span class="txt"></span>
  563. </div>
  564. <div class="generate_btn_box">
  565. <a class="btn generate_qrcode_btn">
  566. 生成二维码
  567. </a>
  568. </div>
  569. </div>
  570. <div class="flex-right">
  571. <div class="qrcode_show_box">
  572. <img class="qrcode_img hidden-xs" src="/img/qrcode_no.png">
  573. <img class="qrcode_img visible-xs" src="/img/qrcode_no_m.png">
  574. </div>
  575. <div class="qrcode_function clearfix row">
  576. <input type="hidden" name="" class="qrcode_key" value="">
  577. <input type="hidden" name="" class="shortUrl" value="">
  578. <input type="hidden" name="download_url" id="download_url" value="<?php echo $_SERVER['HTTP_HOST']; ?>/index/combine/download?qrcode_path=">
  579. <input type="hidden" name="more_down_url" id="more_down_url" value="<?php echo $_SERVER['HTTP_HOST']; ?>/index/combine/downloadQrCode?qrcode_path=">
  580. <input type="hidden" name="" class="qrcode_path" value="">
  581. <div class="down_btnbox">
  582. <div class="btn-group down_qrcode_box">
  583. <a href="javascript:qrcodeDown();" style="width:100%" class="btn btn-default down_qrcode_btn" id="hotApp-qrcode-downBtn" data-downurl="" >下载二维码</a>
  584. </div>
  585. </div>
  586. </div>
  587. </div>
  588. </div>
  589. </div>
  590. <!-- 合并记录表格 -->
  591. <div id="tab-record" class="tab-content <?php echo (SafeRequest("tab", "get") == 'record') ? 'active' : ''; ?>">
  592. <div class="table-responsive">
  593. <table class="table">
  594. <tbody>
  595. <tr>
  596. <th>ID</th>
  597. <th>安卓地址</th>
  598. <th>IOS地址</th>
  599. <th>短链接</th>
  600. <th>添加时间</th>
  601. <th>操作</th>
  602. </tr>
  603. <?php if(!empty($result) && $count > 0): ?>
  604. <?php foreach($result as $item): ?>
  605. <tr>
  606. <td><div><?php echo $item['id']; ?></div></td>
  607. <td><div><?php echo htmlspecialchars($item['android']); ?></div></td>
  608. <td><div><?php echo htmlspecialchars($item['ios']); ?></div></td>
  609. <td><div><?php echo htmlspecialchars($item['link']); ?></div></td>
  610. <td><div style="min-width: 135px;"><?php echo date('Y-m-d H:i:s', $item['ctime']); ?></div></td>
  611. <td><div><a href="<?php echo $item['link']; ?>" target="_blank" class="btn-detail">查看</a></div></td>
  612. </tr>
  613. <?php endforeach; ?>
  614. <?php else: ?>
  615. <tr>
  616. <td colspan="6" class="text-center">暂无记录</td>
  617. </tr>
  618. <?php endif; ?>
  619. </tbody>
  620. </table>
  621. <?php
  622. if ($count == 0) {
  623. ?>
  624. <div class="text-center no-content">
  625. <img src="/static/index/image/invoice-1.png" alt="">
  626. <p class="color-333 mt10">
  627. 暂无任何数据
  628. </p>
  629. </div>
  630. <?php
  631. }
  632. ?>
  633. </div>
  634. <div class="pagination-box">
  635. <?php echo getRender($result, $page); ?>
  636. </div>
  637. </div>
  638. </div>
  639. </div>
  640. </div>
  641. </div>
  642. </div>
  643. <div class="warn-prompt-wrap clearfix">
  644. <dl class="clearfix fr warn-prompt-1 tips">
  645. <!-- <dd> -->
  646. 提示:请您确认您合并的二维码,符合
  647. 《<a href="/index/about/specification" target="_blank" class="color-hover">审核规范</a>》,如违反规范,APP将做删除处理,屡次合并二维码将被封禁账号。
  648. <br>根据最新审核规范,不接受如下APP在平台进行合并二维码:色情类、直播类、金融类、区块链虚拟币等。如已合并,将做删除处理。
  649. <!-- </dd> -->
  650. </dl>
  651. </div>
  652. </div>
  653. </div>
  654. </div>
  655. </div>
  656. <script>
  657. // 页面加载时清理不必要的cookie
  658. $(document).ready(function() {
  659. console.log('页面加载完成!');
  660. cleanUnnecessaryCookies();
  661. // 检查jQuery是否加载
  662. if (typeof $ !== 'undefined') {
  663. console.log('jQuery已加载');
  664. } else {
  665. console.log('jQuery未加载!');
  666. }
  667. // 检查按钮是否存在
  668. if ($('#hotApp_box .generate_qrcode_btn').length > 0) {
  669. console.log('生成二维码按钮已找到');
  670. } else {
  671. console.log('生成二维码按钮未找到!');
  672. }
  673. // Tab切换功能
  674. $('.nav-tabs a').on('click', function(e) {
  675. e.preventDefault();
  676. var target = $(this).attr('href').replace('?tab=', '');
  677. // 获取当前URL参数
  678. var currentUrl = new URL(window.location);
  679. var currentPage = currentUrl.searchParams.get('page');
  680. // 构建新的URL
  681. var newUrl = '/index/combine/index';
  682. if (target === 'record') {
  683. newUrl += '?tab=record';
  684. if (currentPage) {
  685. newUrl += '&page=' + currentPage;
  686. }
  687. } else {
  688. newUrl += '?tab=combine';
  689. }
  690. // 跳转到新URL
  691. window.location.href = newUrl;
  692. });
  693. // 根据URL参数设置初始tab状态
  694. var urlParams = new URLSearchParams(window.location.search);
  695. var tabParam = urlParams.get('tab');
  696. if (tabParam === 'record') {
  697. $('.nav-tabs li').removeClass('active');
  698. $('.nav-tabs a[href="?tab=record"]').parent().addClass('active');
  699. $('.tab-content').removeClass('active');
  700. $('#tab-record').addClass('active');
  701. } else {
  702. $('.nav-tabs li').removeClass('active');
  703. $('.nav-tabs a[href="?tab=combine"]').parent().addClass('active');
  704. $('.tab-content').removeClass('active');
  705. $('#tab-combine').addClass('active');
  706. }
  707. });
  708. function qrcodeDown() {
  709. var qrcode_path = $('.qrcode_path').val();
  710. if (qrcode_path == '') {
  711. alert("请先生成二维码!");
  712. return false;
  713. } else {
  714. window.open(qrcode_path);
  715. }
  716. }
  717. // 绑定生成二维码按钮事件
  718. $('#hotApp_box .generate_qrcode_btn').on('click', function() {
  719. console.log('按钮被点击了!');
  720. var $btn = $(this);
  721. var ios_url = $('#ios_url').val();
  722. var android_url = $('#android_url').val();
  723. console.log('iOS URL:', ios_url);
  724. console.log('Android URL:', android_url);
  725. $btn.button('loading');
  726. if(!ios_url){
  727. alert('请输入IOS地址');
  728. $btn.button('reset');
  729. return false;
  730. }
  731. if(!android_url){
  732. alert('请输入安卓地址');
  733. $btn.button('reset');
  734. return false;
  735. }
  736. // 清理不必要的cookie
  737. cleanUnnecessaryCookies();
  738. console.log('开始发送AJAX请求...');
  739. $.ajax({
  740. type: "POST",
  741. url: "/index/combine/down",
  742. data: "ios_url=" + encodeURIComponent(ios_url) + "&android_url=" + encodeURIComponent(android_url),
  743. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  744. headers: {
  745. "X-Requested-With": "XMLHttpRequest",
  746. "Accept": "application/json, text/javascript, */*; q=0.01"
  747. },
  748. success: function(ret) {
  749. console.log('AJAX成功响应:', ret);
  750. $btn.button('reset');
  751. if (ret.status == 1) {
  752. $('.qrcode_img').attr("src", ret.qrcode_path);
  753. $('#shortUrlh').val(ret.shortUrl);
  754. $('#shortUrlha').show();
  755. $('.qrcode_path').val(ret.qrcode_path);
  756. $('.shortUrl').val(ret.shortUrl);
  757. } else {
  758. alert(ret.msg || '生成失败!');
  759. }
  760. },
  761. error: function(err) {
  762. console.log('AJAX错误:', err);
  763. $btn.button('reset');
  764. alert('请求失败,请重试!');
  765. }
  766. });
  767. });
  768. function cleanUnnecessaryCookies() {
  769. // 定义需要保留的cookie
  770. var keepCookies = ['PHPSESSID', 'in_userid', 'in_username', 'in_userpassword'];
  771. // 获取所有cookie
  772. var cookies = document.cookie.split(';');
  773. // 清理不必要的cookie
  774. for (var i = 0; i < cookies.length; i++) {
  775. var cookie = cookies[i].trim();
  776. var cookieName = cookie.split('=')[0];
  777. // 如果cookie不在保留列表中,则删除
  778. if (keepCookies.indexOf(cookieName) === -1) {
  779. document.cookie = cookieName + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
  780. console.log('已删除cookie: ' + cookieName);
  781. }
  782. }
  783. }
  784. </script>
  785. <?php $this->footer(); ?>
  786. </body>
  787. </html>
  788. <?php
  789. }
  790. function down()
  791. {
  792. // 生产环境应该关闭错误显示
  793. if (defined('ENVIRONMENT') && ENVIRONMENT === 'production') {
  794. ini_set('display_errors', 0);
  795. ini_set('display_startup_errors', 0);
  796. error_reporting(0);
  797. } else {
  798. ini_set('display_errors', 1);
  799. ini_set('display_startup_errors', 1);
  800. error_reporting(E_ALL);
  801. }
  802. error_log("=== down() 方法开始执行 ===");
  803. // 设置session配置
  804. if (!session_id()) {
  805. session_set_cookie_params(0, '/', '', false, true);
  806. session_start();
  807. }
  808. // 设置AJAX响应头
  809. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  810. header("Cache-Control: no-store, no-cache, must-revalidate");
  811. header("Pragma: no-cache");
  812. header("Content-type: application/json; charset=utf-8");
  813. error_log("响应头已设置");
  814. // 检查用户登录状态
  815. error_log("检查用户登录状态: " . ($this->userlogined ? "已登录" : "未登录"));
  816. if (!$this->userlogined) {
  817. error_log("用户未登录,返回错误");
  818. $response = [
  819. "qrcode_path" => "",
  820. "status" => 0,
  821. "msg" => "请先登录后再操作!",
  822. "shortUrl" => ""
  823. ];
  824. echo json_encode($response);
  825. exit;
  826. }
  827. $_var_3 = SafeRequest("ios_url");
  828. $_var_4 = SafeRequest("android_url");
  829. error_log("接收到的参数 - ios_url: " . $_var_3 . ", android_url: " . $_var_4);
  830. if (!$_var_3) {
  831. $response = [
  832. "qrcode_path" => "",
  833. "status" => 0,
  834. "msg" => "请输入iOS地址!",
  835. "shortUrl" => ""
  836. ];
  837. echo json_encode($response);
  838. exit;
  839. }
  840. if (!$_var_4) {
  841. $response = [
  842. "qrcode_path" => "",
  843. "status" => 0,
  844. "msg" => "请输入Android地址!",
  845. "shortUrl" => ""
  846. ];
  847. echo json_encode($response);
  848. exit;
  849. }
  850. // 验证URL格式和安全性
  851. if (!$this->isValidUrl($_var_3)) {
  852. $response = [
  853. "qrcode_path" => "",
  854. "status" => 0,
  855. "msg" => "iOS地址格式无效!",
  856. "shortUrl" => ""
  857. ];
  858. echo json_encode($response);
  859. exit;
  860. }
  861. if (!$this->isValidUrl($_var_4)) {
  862. $response = [
  863. "qrcode_path" => "",
  864. "status" => 0,
  865. "msg" => "Android地址格式无效!",
  866. "shortUrl" => ""
  867. ];
  868. echo json_encode($response);
  869. exit;
  870. }
  871. // 生成短链接
  872. $_var_5 = $this->generateShortUrl();
  873. error_log("生成的短链接: " . $_var_5);
  874. // 生成短链接URL
  875. $short_url = "http://" . $_SERVER['HTTP_HOST'] . "/" . $_var_5;
  876. error_log("生成的短链接URL: " . $short_url);
  877. // 生成二维码图片路径
  878. $qrcode_url = "http://" . $_SERVER['HTTP_HOST'] . "/qrcode?link=" . urlencode($short_url);
  879. error_log("生成的二维码URL: " . $qrcode_url);
  880. // 保存到数据库 - 按照指定格式
  881. $insert_data = [
  882. "userid" => $this->userid,
  883. "username" => $this->username,
  884. "android" => $_var_4, // android字段存储android_url
  885. "ios" => $_var_3, // ios字段存储ios_url
  886. "link" => $short_url, // link字段存储短链接URL
  887. "short" => $_var_5, // short字段存储短链接标识符
  888. "ctime" => time()
  889. ];
  890. error_log("插入数据: " . json_encode($insert_data));
  891. try {
  892. $_var_7 = db("combine")->insertGetId($insert_data);
  893. error_log("数据库插入结果: " . $_var_7);
  894. } catch (Exception $e) {
  895. error_log("数据库错误: " . $e->getMessage());
  896. $response = [
  897. "qrcode_path" => "",
  898. "status" => 0,
  899. "msg" => "数据库操作失败,请稍后重试!",
  900. "shortUrl" => ""
  901. ];
  902. echo json_encode($response);
  903. exit;
  904. }
  905. if ($_var_7) {
  906. // 使用新的返回格式
  907. $response = [
  908. "qrcode_path" => $qrcode_url,
  909. "status" => 1,
  910. "msg" => "success",
  911. "shortUrl" => $short_url // 返回完整的短链接URL
  912. ];
  913. error_log("成功响应: " . json_encode($response));
  914. echo json_encode($response);
  915. } else {
  916. $response = [
  917. "qrcode_path" => "",
  918. "status" => 0,
  919. "msg" => "生成失败!",
  920. "shortUrl" => ""
  921. ];
  922. error_log("失败响应: " . json_encode($response));
  923. echo json_encode($response);
  924. }
  925. error_log("=== down() 方法执行完成 ===");
  926. exit;
  927. }
  928. function download()
  929. {
  930. $_var_8 = SafeRequest("qrcode_path");
  931. if (!$_var_8) {
  932. reJSON("参数错误!", 404);
  933. }
  934. // 修复路径遍历漏洞
  935. $qrcode_path = $_var_8;
  936. // 验证路径格式,只允许字母数字和基本符号
  937. if (!preg_match('/^[a-zA-Z0-9\/\-_\.]+$/', $qrcode_path)) {
  938. reJSON("无效的文件路径!", 403);
  939. }
  940. // 确保路径在允许的目录内
  941. $allowed_dirs = ['/uploads/qrcode/', '/qrcode/'];
  942. $is_allowed = false;
  943. foreach ($allowed_dirs as $dir) {
  944. if (strpos($qrcode_path, $dir) === 0) {
  945. $is_allowed = true;
  946. break;
  947. }
  948. }
  949. if (!$is_allowed) {
  950. reJSON("访问被拒绝!", 403);
  951. }
  952. $file_path = $_SERVER['DOCUMENT_ROOT'] . $qrcode_path;
  953. // 防止目录遍历
  954. $real_path = realpath($file_path);
  955. $doc_root = realpath($_SERVER['DOCUMENT_ROOT']);
  956. if ($real_path === false || strpos($real_path, $doc_root) !== 0) {
  957. reJSON("文件不存在!", 404);
  958. }
  959. if (file_exists($file_path)) {
  960. // 验证文件类型
  961. $finfo = finfo_open(FILEINFO_MIME_TYPE);
  962. $mime_type = finfo_file($finfo, $file_path);
  963. finfo_close($finfo);
  964. if ($mime_type !== 'image/png' && $mime_type !== 'image/jpeg' && $mime_type !== 'image/gif') {
  965. reJSON("不支持的文件类型!", 403);
  966. }
  967. header('Content-Type: ' . $mime_type);
  968. header('Content-Disposition: attachment; filename="qrcode.png"');
  969. readfile($file_path);
  970. exit;
  971. } else {
  972. reJSON("文件不存在!", 404);
  973. }
  974. }
  975. private function generateShortUrl()
  976. {
  977. $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
  978. $short_url = '';
  979. // 使用更安全的随机数生成方法
  980. if (function_exists('random_bytes')) {
  981. $random_bytes = random_bytes(6);
  982. for ($i = 0; $i < 6; $i++) {
  983. $short_url .= $chars[ord($random_bytes[$i]) % strlen($chars)];
  984. }
  985. } elseif (function_exists('openssl_random_pseudo_bytes')) {
  986. $random_bytes = openssl_random_pseudo_bytes(6);
  987. for ($i = 0; $i < 6; $i++) {
  988. $short_url .= $chars[ord($random_bytes[$i]) % strlen($chars)];
  989. }
  990. } else {
  991. // 降级到rand(),但增加熵
  992. for ($i = 0; $i < 6; $i++) {
  993. $short_url .= $chars[rand(0, strlen($chars) - 1)];
  994. }
  995. }
  996. return $short_url; // 只返回短链接标识符,不包含域名
  997. }
  998. private function generateQrcodeImage($url)
  999. {
  1000. $qrcode_path = '/uploads/qrcode/' . md5($url) . '.png';
  1001. return $qrcode_path;
  1002. }
  1003. private function isValidUrl($url)
  1004. {
  1005. // 基本URL格式验证
  1006. if (!filter_var($url, FILTER_VALIDATE_URL)) {
  1007. return false;
  1008. }
  1009. // 解析URL
  1010. $parsed_url = parse_url($url);
  1011. if (!$parsed_url || !isset($parsed_url['scheme']) || !isset($parsed_url['host'])) {
  1012. return false;
  1013. }
  1014. // 只允许HTTP和HTTPS协议
  1015. if (!in_array($parsed_url['scheme'], ['http', 'https'])) {
  1016. return false;
  1017. }
  1018. // 检查是否为私有IP地址(防止SSRF)
  1019. $host = $parsed_url['host'];
  1020. $ip = gethostbyname($host);
  1021. if ($ip && $ip !== $host) {
  1022. // 检查是否为私有IP
  1023. if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
  1024. // 这是公网IP,允许
  1025. } else {
  1026. // 这是私有IP或保留IP,拒绝
  1027. return false;
  1028. }
  1029. }
  1030. // 检查URL长度限制
  1031. if (strlen($url) > 2048) {
  1032. return false;
  1033. }
  1034. return true;
  1035. }
  1036. }