12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235 |
- <?php
- namespace app\index;
- class combine extends BaseUser
- {
- function initialize()
- {
- parent::initialize();
- }
-
- function index()
- {ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
-
- // 获取页码参数
- $page = SafeRequest("page", "get");
- if (empty($page)) {
- $page = 1;
- }
-
- // 使用分页查询
- $result = db("combine")->where("userid", $this->userid)->order("id desc")->paginate(["page" => $page, 'list_rows' => 5]);
- $count = $result->total();
- $this -> action = 'apps'
- ?>
- <!DOCTYPE html>
- <html lang="zh-cn">
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=0" />
- <meta name="keywords" content="<?php echo IN_KEYWORDS; ?>" />
- <meta name="description" content="<?php echo IN_DESCRIPTION; ?>" />
- <title>外部链接合并 - <?php echo IN_NAME; ?> - 免费应用内测托管平台|iOS应用Beta测试分发|Android应用内测分发</title>
- <?php $this->static_(); ?>
- </head>
- <body>
- <?php $this->header(); ?>
- <style>
- .details-top {
- padding: 39px 30px;
- }
- .details-top .p1{
- color: rgba(21, 21, 21, 1);
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-size: 16px;
- line-height: 20px;
- }
- #hotApp_box {
- display: flex;
- justify-content: space-between;
- align-items: start;
- margin: 0;
- }
- .download-details {
- padding: 10px 30px 72px;
- }
- .flex-left {
- width: calc(100% - 303px);
- }
- .flex-right {
- width: 303px;
- }
- .qrcode_img {
- width: 235px;
- height: 235px;
- object-fit: cover;
- border: 1px solid rgba(232, 234, 236, 1);
- }
- .qrcode_img::placeholder {
- color: rgba(143, 149, 159, 1);
- font-size: 16px;
- line-height: 22px;
- }
- .qrcode_url_tips {
- font-size: 13px;
- line-height: 17px;
- margin: 10px 0;
- }
- .qrcode_url_input_box {
- margin-bottom: 30px;
- }
- .qrcode_url_input_box input {
- border: 1px solid rgba(232, 234, 236, 1);
- /* width: 711px; */
- height: 52px;
- line-height: 52px;
- border-width: 1px;
- padding: 0 20px;
- box-sizing: border-box;
- font-size: 14px;
- color: rgba(21, 21, 21, 1);
- }
- .qrcode_url_input_box input::placeholder {
- font-size: 14px;
- color: rgba(143, 149, 159, 1);
- }
- .generate_btn_box {
- margin-top: 50px;
- }
- .generate_qrcode_btn {
- background: rgba(33, 104, 251, 1);
- width: 120px;
- height: 34px;
- border-radius: 4px;
- padding-top: 7px;
- padding-right: 20px;
- padding-bottom: 7px;
- padding-left: 20px;
- color: rgba(255, 255, 255, 1);
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-style: Medium;
- font-size: 16px;
- line-height: 20px;
- }
- #hotApp-qrcode-downBtn:active:focus,
- #hotApp-qrcode-downBtn:hover,
- .generate_qrcode_btn:active:focus,
- .generate_qrcode_btn:hover {
- background: rgba(33, 104, 251, 1);
- color: rgba(255, 255, 255, 1);
- border: unset;
- outline: none;
- }
- .qrcode_show_box {
- text-align: right;
- margin-bottom: 12px;
- margin-top: 10px;
- }
- .qrcode_url_box { margin-bottom: 20px; }
- .qrcode_url_tips { margin-bottom: 10px; }
- .os_name { font-weight: bold; color: #333; }
- .qrcode_url_input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 4px; }
- /* .qrcode_function {
- text-align: center;
- }
- .down_btnbox {
- text-align: center;
- } */
- .qrcode_function {
- margin: 0 auto;
- }
- .down_btnbox {
- padding-left: 126px;
- }
- #hotApp-qrcode-downBtn {
- border: 1px solid rgba(33, 104, 251, 1);
- width: 120px;
- height: 34px;
- border-radius: 4px;
- padding: 0 20px;
- background: rgba(255, 255, 255, 1);
- color: rgba(33, 104, 251, 1);
- font-size: 16px;
- line-height: 34px;
- float: unset;
- margin: 0 auto;
- }
- .tab-content {
- display: none;
- }
- .tab-content.active {
- display: block;
- }
-
- /* 标签页样式 */
- .tabs {
- margin: 12px 0 0 0;
- padding: 10px 30px;
- }
- .tabs .nav-tabs {
- border-bottom: 0 solid #e5e5e5;
- /* 添加横向滚动支持 */
- overflow-x: auto;
- overflow-y: hidden;
- white-space: nowrap;
- display: flex;
- flex-wrap: nowrap;
- -webkit-overflow-scrolling: touch;
- /* iOS滚动优化 */
- scrollbar-width: none;
- /* Firefox隐藏滚动条 */
- -ms-overflow-style: none;
- /* IE隐藏滚动条 */
- }
- /* 隐藏Webkit浏览器的滚动条 */
- .tabs .nav-tabs::-webkit-scrollbar {
- display: none;
- }
- .tabs .nav-tabs>li>a {
- border: none;
- padding: 12px 2px;
- margin-right: 24px;
- border-radius: 0;
- color: rgba(143, 149, 159, 1);
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-size: 15px;
- line-height: 20px;
- }
- .tabs .nav-tabs>li>a:hover {
- border: none;
- background-color: #ffffff;
- color: rgba(75, 132, 255, 1);
- }
- .tabs .nav-tabs>li.active>a,
- .tabs .nav-tabs>li.active>a:hover,
- .tabs .nav-tabs>li.active>a:focus {
- border: none;
- border-bottom: 2px solid rgba(75, 132, 255, 1);
- color: rgba(75, 132, 255, 1);
- font-weight: 700;
- }
- /* 记录 */
- .table-responsive {
- overflow-x: auto;
- border: 1px solid rgba(232, 234, 236, 1);
- }
- /* 通用表格设置 */
- .table {
- border: 1px solid #e5e5e5;
- margin-bottom: 0;
- }
- .table>tbody>tr>th {
- background: rgba(245, 246, 247, 1);
- height: 36px;
- color: rgba(143, 149, 159, 1);
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-size: 14px;
- line-height: 18px;
- text-align: center;
- vertical-align: middle !important;
- }
- .table>tbody>tr>td {
- color: rgba(0, 0, 0, 1);
- box-sizing: border-box;
- padding: 0 15px !important;
- height: 68px;
- text-align: center;
- font-family: Source Han Sans SC;
- font-weight: 400;
- font-size: 14px;
- line-height: 13px;
- border-top: unset;
- border-bottom: 1px solid rgba(232, 234, 236, 1);
- vertical-align: middle !important;
- }
- .table>tfoot>tr>td {
- padding: 0 15px !important;
- vertical-align: middle !important;
- text-align: center;
- }
- .table>tbody>tr:hover>td {
- background-color: #ebf7ff;
- }
- .table>tbody>tr>td.angle-parent {
- color: rgba(75, 132, 255, 1);
- }
- .table>tbody>tr>td>a {
- color: rgba(33, 104, 251, 1);
- font-weight: 500;
- font-size: 14px;
- }
- .table>tbody>tr>td>a+a {
- margin-left: 14px;
- }
- /* 操作按钮 */
- .table .btn-detail {
- height: 30px;
- border-width: 1px;
- border-radius: 4px;
- padding-top: 5px;
- padding-right: 8px;
- padding-bottom: 5px;
- padding-left: 8px;
- color: rgba(255, 116, 41, 1);
- border: 1px solid rgba(255, 116, 41, 1);
- font-family: Source Han Sans SC;
- font-weight: 500;
- font-size: 14px;
- line-height: 20px;
- }
- /* 翻页 */
- .pagination-box {
- /* text-align: right; */
- }
- .pagination {
- margin: 10px auto 10px;
- }
- .pagination>li>a,
- .pagination>li>span {
- color: rgba(33, 104, 251, 1);
- }
- .pagination>.active>a,
- .pagination>.active>a:focus,
- .pagination>.active>a:hover,
- .pagination>.active>span,
- .pagination>.active>span:focus,
- .pagination>.active>span:hover {
- background-color: rgba(33, 104, 251, 1);
- border-color: rgba(33, 104, 251, 1);
- }
- .pagination>li:first-child {
- display: inline-block;
- padding: 7px 0 7px 12px;
- background-color: transparent !important;
- border: unset;
- color: rgba(33, 104, 251, 1);
- pointer-events: none;
- }
- /* 底部 */
- .tips {
- margin: 12px auto 57px;
- color: rgba(143, 149, 159, 1);
- font-size: 13px;
- line-height: 20px;
- }
- @media (max-width: 768px) {
- .release-app2>.row {
- margin: 0;
- }
- .app-details .details-top {
- padding: 0.32rem;
- }
- .details-top .p1{
- font-size: 0.28rem;
- line-height: 0.40rem;
- }
- #hotApp_box {
- margin: 0;
- display: block;
- }
- .download-details {
- padding: 0.20rem 0.32rem 0.60rem;
- }
- .flex-left {
- width: 100%;
- }
- .flex-right {
- width: 100%;
- }
- .qrcode_img {
- width: 2.66rem;
- height: 2.66rem;
- margin: 0 auto;
- }
- .qrcode_url_tips {
- font-size: 0.28rem;
- line-height: 0.34rem;
- margin: 0.20rem 0;
- }
- .qrcode_url_input_box {
- margin-bottom: 0.4rem;
- }
- .qrcode_url_input_box input {
- height: 0.64rem;
- line-height: 0.64rem;
- padding: 0 0.24rem;
- font-size: 0.28rem;
- }
- .qrcode_url_input_box input::placeholder {
- font-size: 0.28rem;
- }
- .generate_btn_box {
- margin-top: 0;
- }
- .generate_qrcode_btn {
- width: 100%;
- height: 0.68rem;
- border-radius: 0.08rem;
- font-size: 0.32rem;
- line-height: 0.68rem;
- padding: 0;
- }
- #hotApp-qrcode-downBtn:active:focus,
- #hotApp-qrcode-downBtn:hover,
- .generate_qrcode_btn:active:focus,
- .generate_qrcode_btn:hover {
- background: rgba(33, 104, 251, 1);
- color: rgba(255, 255, 255, 1);
- }
- .qrcode_show_box {
- margin-bottom: 0.2rem;
- margin-top: 0.48rem;
- text-align: center;
- }
- .qrcode_url_box { margin-bottom: 20px; }
- .qrcode_url_tips {margin-bottom: 0.20rem;}
- .qrcode_url_input {
- width: 100%;
- padding: 10px;
- border-radius: 4px;
- }
- .qrcode_function {
- margin: 0 auto;
- }
- .down_btnbox {
- padding-left: 0;
- }
- #hotApp-qrcode-downBtn {
- width: 100%;
- height: 0.68rem;
- border-radius: 0.08rem;
- font-size: 0.32rem;
- line-height: 0.68rem;
- }
- .down_qrcode_box {
- width: 100%;
- }
- /* 标签页样式 */
- .tabs {
- margin: 0;
- padding: 0 0.32rem;
- }
- .tabs .nav-tabs>li>a {
- padding: 0.24rem 0.04rem;
- margin-right: 0.48rem;
- font-size: 0.30rem;
- line-height: 0.40rem;
- }
- /* 通用表格设置 */
- .table {
- margin-bottom: 0;
- }
- .table>tbody>tr>th {
- height: 0.72rem;
- font-size: 0.28rem;
- line-height: 0.36rem;
- }
- .table>tbody>tr>td {
- padding: 0.2rem 0.30rem!important;
- height: 1.36rem;
- font-size: 0.28rem;
- line-height: 0.32rem;
- }
- .table>tfoot>tr>td {
- padding: 0 0.30rem !important;
- }
- .table>tbody>tr>td>a {
- font-size: 0.28rem;
- }
- .table>tbody>tr>td>a+a {
- margin-left: 0.28rem;
- }
- /* 操作按钮 */
- .table .btn-detail {
- height: 0.60rem;
- border-radius: 0.08rem;
- padding-top: 0.10rem;
- padding-right: 0.16rem;
- padding-bottom: 0.10rem;
- padding-left: 0.16rem;
- font-size: 0.28rem;
- line-height: 0.40rem;
- }
- /* 翻页 */
- .pagination {
- margin: 0.20rem auto 0.20rem;
- }
- .pagination>li:first-child {
- padding: 0.14rem 0 0.14rem 0.24rem;
- }
- /* 底部 */
- .release-app2 .warn-prompt-wrap {
- padding-bottom: unset;
- margin-top: 0;
- margin-bottom: 1.46rem;
- }
- .tips {
- margin: 0.24rem auto 0.48rem;
- color: rgba(143, 149, 159, 1);
- font-weight: 400;
- font-size: 0.24rem;
- line-height: 0.40rem;
- }
- }
- </style>
-
- <div class="release-app-wrap">
- <div class="container">
- <div class="release-app2">
- <div class="crumbs">
- <a href="/index/apps">我的应用</a>
- <span>/</span>
- <a href="/index/apps">应用列表</a>
- <span>/</span>
- 外部链接合并
- </div>
- <div class="row clearfix">
- <div class="col-sm-2">
- <aside class="aside-left">
- <ul>
- <li title="上传应用" class="<?php echo ($this->module == 'publish' || $this->module == 'publish_update') ? 'active' : '' ?>">
- <a href="/index/publish/<?php echo $this->action ?>"> <span class="iconfont icon-upload1"></span>上传应用</a>
- </li>
- <li title="应用列表" class="<?php echo $this->module == 'apps' ? 'active' : '' ?>">
- <a href="/index/apps/<?php echo $this->action ?>"><span class="iconfont icon-41"></span>应用列表</a>
- </li>
- <li title="绑定域名" class="<?php echo $this->module == 'domain' ? 'active' : '' ?>">
- <a href="/index/domain/<?php echo $this->action ?>"><span class="iconfont icon-liulanqi"></span>绑定域名</a>
- </li>
- <li title="外部链接合并" class="<?php echo $this->module == 'combine' ? 'active' : '' ?>">
- <a href="/index/combine/<?php echo $this->action ?>"><span class="iconfont icon-erweima"></span>外部链接合并</a>
- </li>
- <!-- <li title="合并记录" class="<?php echo $this->module == 'jilu' ? 'active' : '' ?>">
- <a href="/index/jilu/<?php echo $this->action ?>"><span class="iconfont icon-jilu"></span>合并记录</a>
- </li> -->
- </ul>
- </aside>
- </div>
- <div class="col-sm-10">
- <div class="aside-right">
- <div class="app-details app-details2">
- <div class="details-top clearfix">
- <b class="p1">外部链接合并</b>
- <div class="p1">
- 设置提示:本功能可将外部的ios链接或安卓链接,来和本站的链接进行合并到一起使用,
- <br class="hidden-xs">
- 以便更好的管理不同平台链接的使用,可生成二维码和短链接。
- </div>
- </div>
- <div style="height: 10px; background: rgb(242, 242, 245)"></div>
- <div class="tabs">
- <ul class="nav nav-tabs" role="tablist">
- <li role="presentation" class="active">
- <a href="?tab=combine" aria-controls="tab-combine" role="tab">链接合并</a>
- </li>
- <li role="presentation" class="">
- <a href="?tab=record" aria-controls="tab-record" role="tab">合并记录</a>
- </li>
- </ul>
- </div>
- <div class="download-details">
- <!-- 链接合并表单 -->
- <div id="tab-combine" class="generate_qrcode_box tab-content <?php echo (SafeRequest("tab", "get") != 'record') ? 'active' : ''; ?>">
- <div class="row" id="hotApp_box">
- <div class="flex-left">
- <div class="qrcode_url_box">
- <div class="qrcode_url_tips">
- <b class="os_name">iOS系统</b>
- </div>
- <div class="qrcode_url_input_box">
- <input type="text" placeholder="请输入苹果应用下载地址" id="ios_url" class="form-control qrcode_url_input">
- </div>
- </div>
- <div class="qrcode_url_box">
- <div class="qrcode_url_tips">
- <b class="os_name">安卓系统</b>
- </div>
- <div class="qrcode_url_input_box">
- <input type="text" id="android_url" class="form-control qrcode_url_input" placeholder="请输入安卓系统应用下载地址">
- </div>
- </div>
- <div class="qrcode_url_box" id="shortUrlha" style="display:none">
- <div class="qrcode_url_tips">
- <b class="os_name">短连接地址</b>
- </div>
- <div class="qrcode_url_input_box">
- <input type="text" id="shortUrlh" class="form-control qrcode_url_input" placeholder="">
- </div>
- </div>
- <div class="alert alert-success" style="display: none;">
- <span class="txt"></span>
- </div>
- <div class="alert alert-danger" style="display: none;">
- <span class="txt"></span>
- </div>
- <div class="generate_btn_box">
- <a class="btn generate_qrcode_btn">
- 生成二维码
- </a>
- </div>
- </div>
- <div class="flex-right">
- <div class="qrcode_show_box">
- <img class="qrcode_img hidden-xs" src="/img/qrcode_no.png">
- <img class="qrcode_img visible-xs" src="/img/qrcode_no_m.png">
- </div>
- <div class="qrcode_function clearfix row">
- <input type="hidden" name="" class="qrcode_key" value="">
- <input type="hidden" name="" class="shortUrl" value="">
- <input type="hidden" name="download_url" id="download_url" value="<?php echo $_SERVER['HTTP_HOST']; ?>/index/combine/download?qrcode_path=">
- <input type="hidden" name="more_down_url" id="more_down_url" value="<?php echo $_SERVER['HTTP_HOST']; ?>/index/combine/downloadQrCode?qrcode_path=">
- <input type="hidden" name="" class="qrcode_path" value="">
- <div class="down_btnbox">
- <div class="btn-group down_qrcode_box">
- <a href="javascript:qrcodeDown();" style="width:100%" class="btn btn-default down_qrcode_btn" id="hotApp-qrcode-downBtn" data-downurl="" >下载二维码</a>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <!-- 合并记录表格 -->
- <div id="tab-record" class="tab-content <?php echo (SafeRequest("tab", "get") == 'record') ? 'active' : ''; ?>">
- <div class="table-responsive">
- <table class="table">
- <tbody>
- <tr>
- <th>ID</th>
- <th>安卓地址</th>
- <th>IOS地址</th>
- <th>短链接</th>
- <th>添加时间</th>
- <th>操作</th>
- </tr>
- <?php if(!empty($result) && $count > 0): ?>
- <?php foreach($result as $item): ?>
- <tr>
- <td><div><?php echo $item['id']; ?></div></td>
- <td><div><?php echo htmlspecialchars($item['android']); ?></div></td>
- <td><div><?php echo htmlspecialchars($item['ios']); ?></div></td>
- <td><div><?php echo htmlspecialchars($item['link']); ?></div></td>
- <td><div style="min-width: 135px;"><?php echo date('Y-m-d H:i:s', $item['ctime']); ?></div></td>
- <td>
- <!-- <div><a href="<?php echo $item['link']; ?>" target="_blank" class="btn-detail">查看</a></div> -->
- <div><a href="#" style="color: #FF7429;border-color:#FF7429;font-size: 12px" class="btn-del app-bloder-btn" data-id="<?php echo htmlspecialchars($item['id']); ?>">删除</a></div>
- </td>
- </tr>
- <?php endforeach; ?>
- <?php else: ?>
- <tr>
- <td colspan="6" class="text-center">暂无记录</td>
- </tr>
- <?php endif; ?>
- </tbody>
- </table>
- <!-- <?php
- if ($count == 0) {
- ?>
- <div class="text-center no-content">
- <img src="/static/index/image/invoice-1.png" alt="">
- <p class="color-333 mt10">
- 暂无任何数据
- </p>
- </div>
- <?php
- }
- ?> -->
- </div>
- <div class="pagination-box">
- <?php echo getRender($result, $page); ?>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div class="warn-prompt-wrap clearfix">
- <dl class="clearfix fr warn-prompt-1 tips">
- <!-- <dd> -->
- 提示:请您确认您合并的二维码,符合
- 《<a href="/index/about/specification" target="_blank" class="color-hover">审核规范</a>》,如违反规范,APP将做删除处理,屡次合并二维码将被封禁账号。
- <br>根据最新审核规范,不接受如下APP在平台进行合并二维码:色情类、直播类、金融类、区块链虚拟币等。如已合并,将做删除处理。
- <!-- </dd> -->
- </dl>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <script>
- // 页面加载时清理不必要的cookie
- $(document).ready(function() {
- console.log('页面加载完成!');
- cleanUnnecessaryCookies();
-
- // 检查jQuery是否加载
- if (typeof $ !== 'undefined') {
- console.log('jQuery已加载');
- } else {
- console.log('jQuery未加载!');
- }
-
- // 检查按钮是否存在
- if ($('#hotApp_box .generate_qrcode_btn').length > 0) {
- console.log('生成二维码按钮已找到');
- } else {
- console.log('生成二维码按钮未找到!');
- }
-
- // Tab切换功能
- $('.nav-tabs a').on('click', function(e) {
- e.preventDefault();
- var target = $(this).attr('href').replace('?tab=', '');
-
- // 获取当前URL参数
- var currentUrl = new URL(window.location);
- var currentPage = currentUrl.searchParams.get('page');
-
- // 构建新的URL
- var newUrl = '/index/combine/index';
- if (target === 'record') {
- newUrl += '?tab=record';
- if (currentPage) {
- newUrl += '&page=' + currentPage;
- }
- } else {
- newUrl += '?tab=combine';
- }
-
- // 跳转到新URL
- window.location.href = newUrl;
- });
-
- // 根据URL参数设置初始tab状态
- var urlParams = new URLSearchParams(window.location.search);
- var tabParam = urlParams.get('tab');
-
- if (tabParam === 'record') {
- $('.nav-tabs li').removeClass('active');
- $('.nav-tabs a[href="?tab=record"]').parent().addClass('active');
- $('.tab-content').removeClass('active');
- $('#tab-record').addClass('active');
- } else {
- $('.nav-tabs li').removeClass('active');
- $('.nav-tabs a[href="?tab=combine"]').parent().addClass('active');
- $('.tab-content').removeClass('active');
- $('#tab-combine').addClass('active');
- }
- });
-
- function qrcodeDown() {
- var qrcode_path = $('.qrcode_path').val();
- if (qrcode_path == '') {
- alert("请先生成二维码!");
- return false;
- } else {
- window.open(qrcode_path);
- }
- }
-
- // 绑定生成二维码按钮事件
- $('#hotApp_box .generate_qrcode_btn').on('click', function() {
- console.log('按钮被点击了!');
- var $btn = $(this);
- var ios_url = $('#ios_url').val();
- var android_url = $('#android_url').val();
-
- console.log('iOS URL:', ios_url);
- console.log('Android URL:', android_url);
-
- $btn.button('loading');
-
- if(!ios_url){
- alert('请输入IOS地址');
- $btn.button('reset');
- return false;
- }
- if(!android_url){
- alert('请输入安卓地址');
- $btn.button('reset');
- return false;
- }
-
- // 清理不必要的cookie
- cleanUnnecessaryCookies();
-
- console.log('开始发送AJAX请求...');
- $.ajax({
- type: "POST",
- url: "/index/combine/down",
- data: "ios_url=" + encodeURIComponent(ios_url) + "&android_url=" + encodeURIComponent(android_url),
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- headers: {
- "X-Requested-With": "XMLHttpRequest",
- "Accept": "application/json, text/javascript, */*; q=0.01"
- },
- success: function(ret) {
- console.log('AJAX成功响应:', ret);
- $btn.button('reset');
- if (ret.status == 1) {
- $('.qrcode_img').attr("src", ret.qrcode_path);
- $('#shortUrlh').val(ret.shortUrl);
- $('#shortUrlha').show();
- $('.qrcode_path').val(ret.qrcode_path);
- $('.shortUrl').val(ret.shortUrl);
- } else {
- alert(ret.msg || '生成失败!');
- }
- },
- error: function(err) {
- console.log('AJAX错误:', err);
- $btn.button('reset');
- alert('请求失败,请重试!');
- }
- });
- });
-
- function cleanUnnecessaryCookies() {
- // 定义需要保留的cookie
- var keepCookies = ['PHPSESSID', 'in_userid', 'in_username', 'in_userpassword'];
-
- // 获取所有cookie
- var cookies = document.cookie.split(';');
-
- // 清理不必要的cookie
- for (var i = 0; i < cookies.length; i++) {
- var cookie = cookies[i].trim();
- var cookieName = cookie.split('=')[0];
-
- // 如果cookie不在保留列表中,则删除
- if (keepCookies.indexOf(cookieName) === -1) {
- document.cookie = cookieName + '=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';
- console.log('已删除cookie: ' + cookieName);
- }
- }
- }
- $('.btn-del').click(function(){
- var id = $(this).attr('data-id');
- $.ajax({
- type: "POST",
- url: "/index/combine/del",
- data: {
- id: id
- },
- dataType: "json",
- contentType: "application/x-www-form-urlencoded; charset=UTF-8",
- headers: {
- "X-Requested-With": "XMLHttpRequest",
- "Accept": "application/json, text/javascript, */*; q=0.01"
- },
- success: function(ret) {
- console.log('AJAX成功响应:', ret);
- if(ret.status == 'error'){
- alert('删除失败');
- return
- }
- alert('删除成功');
- setTimeout(function(){
- window.location.reload();
- }, 2000);
- // window.location.reload();
- },
- error: function(err) {
- console.log('AJAX错误:', err);
- $btn.button('reset');
- alert('请求失败,请重试!');
- }
- });
- });
- </script>
-
- <?php $this->footer(); ?>
- </body>
- </html>
- <?php
- }
- function del(){
- $id = SafeRequest("id", "post");
- if(empty($id)){
- echo json_encode(array("status"=>"error","msg"=>"参数错误"));die;
- }
- $res = db("combine")->where("userid", $this->userid)->where('id', $id)->delete();
- if(!$res){
- echo json_encode(array("status"=>"error","msg"=>"删除失败"));die;
- }
- echo json_encode(array("status"=>"success","msg"=>"删除成功"));
- }
-
- function down()
- {
- // 生产环境应该关闭错误显示
- if (defined('ENVIRONMENT') && ENVIRONMENT === 'production') {
- ini_set('display_errors', 0);
- ini_set('display_startup_errors', 0);
- error_reporting(0);
- } else {
- ini_set('display_errors', 1);
- ini_set('display_startup_errors', 1);
- error_reporting(E_ALL);
- }
-
- error_log("=== down() 方法开始执行 ===");
-
- // 设置session配置
- if (!session_id()) {
- session_set_cookie_params(0, '/', '', false, true);
- session_start();
- }
-
- // 设置AJAX响应头
- header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
- header("Cache-Control: no-store, no-cache, must-revalidate");
- header("Pragma: no-cache");
- header("Content-type: application/json; charset=utf-8");
-
- error_log("响应头已设置");
-
- // 检查用户登录状态
- error_log("检查用户登录状态: " . ($this->userlogined ? "已登录" : "未登录"));
- if (!$this->userlogined) {
- error_log("用户未登录,返回错误");
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "请先登录后再操作!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
-
- $_var_3 = SafeRequest("ios_url");
- $_var_4 = SafeRequest("android_url");
- error_log("接收到的参数 - ios_url: " . $_var_3 . ", android_url: " . $_var_4);
-
- if (!$_var_3) {
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "请输入iOS地址!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
- if (!$_var_4) {
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "请输入Android地址!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
-
- // 验证URL格式和安全性
- if (!$this->isValidUrl($_var_3)) {
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "iOS地址格式无效!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
-
- if (!$this->isValidUrl($_var_4)) {
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "Android地址格式无效!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
-
- // 生成短链接
- $_var_5 = $this->generateShortUrl();
- error_log("生成的短链接: " . $_var_5);
-
- // 生成短链接URL
- $short_url = "http://" . $_SERVER['HTTP_HOST'] . "/" . $_var_5;
- error_log("生成的短链接URL: " . $short_url);
-
- // 生成二维码图片路径
- $qrcode_url = "http://" . $_SERVER['HTTP_HOST'] . "/qrcode?link=" . urlencode($short_url);
- error_log("生成的二维码URL: " . $qrcode_url);
-
- // 保存到数据库 - 按照指定格式
- $insert_data = [
- "userid" => $this->userid,
- "username" => $this->username,
- "android" => $_var_4, // android字段存储android_url
- "ios" => $_var_3, // ios字段存储ios_url
- "link" => $short_url, // link字段存储短链接URL
- "short" => $_var_5, // short字段存储短链接标识符
- "ctime" => time()
- ];
- error_log("插入数据: " . json_encode($insert_data));
-
- try {
- $_var_7 = db("combine")->insertGetId($insert_data);
- error_log("数据库插入结果: " . $_var_7);
- } catch (Exception $e) {
- error_log("数据库错误: " . $e->getMessage());
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "数据库操作失败,请稍后重试!",
- "shortUrl" => ""
- ];
- echo json_encode($response);
- exit;
- }
- if ($_var_7) {
- // 使用新的返回格式
- $response = [
- "qrcode_path" => $qrcode_url,
- "status" => 1,
- "msg" => "success",
- "shortUrl" => $short_url // 返回完整的短链接URL
- ];
- error_log("成功响应: " . json_encode($response));
- echo json_encode($response);
- } else {
- $response = [
- "qrcode_path" => "",
- "status" => 0,
- "msg" => "生成失败!",
- "shortUrl" => ""
- ];
- error_log("失败响应: " . json_encode($response));
- echo json_encode($response);
- }
- error_log("=== down() 方法执行完成 ===");
- exit;
- }
-
- function download()
- {
- $_var_8 = SafeRequest("qrcode_path");
- if (!$_var_8) {
- reJSON("参数错误!", 404);
- }
-
- // 修复路径遍历漏洞
- $qrcode_path = $_var_8;
-
- // 验证路径格式,只允许字母数字和基本符号
- if (!preg_match('/^[a-zA-Z0-9\/\-_\.]+$/', $qrcode_path)) {
- reJSON("无效的文件路径!", 403);
- }
-
- // 确保路径在允许的目录内
- $allowed_dirs = ['/uploads/qrcode/', '/qrcode/'];
- $is_allowed = false;
- foreach ($allowed_dirs as $dir) {
- if (strpos($qrcode_path, $dir) === 0) {
- $is_allowed = true;
- break;
- }
- }
-
- if (!$is_allowed) {
- reJSON("访问被拒绝!", 403);
- }
-
- $file_path = $_SERVER['DOCUMENT_ROOT'] . $qrcode_path;
-
- // 防止目录遍历
- $real_path = realpath($file_path);
- $doc_root = realpath($_SERVER['DOCUMENT_ROOT']);
-
- if ($real_path === false || strpos($real_path, $doc_root) !== 0) {
- reJSON("文件不存在!", 404);
- }
-
- if (file_exists($file_path)) {
- // 验证文件类型
- $finfo = finfo_open(FILEINFO_MIME_TYPE);
- $mime_type = finfo_file($finfo, $file_path);
- finfo_close($finfo);
-
- if ($mime_type !== 'image/png' && $mime_type !== 'image/jpeg' && $mime_type !== 'image/gif') {
- reJSON("不支持的文件类型!", 403);
- }
-
- header('Content-Type: ' . $mime_type);
- header('Content-Disposition: attachment; filename="qrcode.png"');
- readfile($file_path);
- exit;
- } else {
- reJSON("文件不存在!", 404);
- }
- }
-
- private function generateShortUrl()
- {
- $chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
- $short_url = '';
-
- // 使用更安全的随机数生成方法
- if (function_exists('random_bytes')) {
- $random_bytes = random_bytes(6);
- for ($i = 0; $i < 6; $i++) {
- $short_url .= $chars[ord($random_bytes[$i]) % strlen($chars)];
- }
- } elseif (function_exists('openssl_random_pseudo_bytes')) {
- $random_bytes = openssl_random_pseudo_bytes(6);
- for ($i = 0; $i < 6; $i++) {
- $short_url .= $chars[ord($random_bytes[$i]) % strlen($chars)];
- }
- } else {
- // 降级到rand(),但增加熵
- for ($i = 0; $i < 6; $i++) {
- $short_url .= $chars[rand(0, strlen($chars) - 1)];
- }
- }
-
- return $short_url; // 只返回短链接标识符,不包含域名
- }
-
- private function generateQrcodeImage($url)
- {
- $qrcode_path = '/uploads/qrcode/' . md5($url) . '.png';
- return $qrcode_path;
- }
- private function isValidUrl($url)
- {
- // 基本URL格式验证
- if (!filter_var($url, FILTER_VALIDATE_URL)) {
- return false;
- }
-
- // 解析URL
- $parsed_url = parse_url($url);
- if (!$parsed_url || !isset($parsed_url['scheme']) || !isset($parsed_url['host'])) {
- return false;
- }
-
- // 只允许HTTP和HTTPS协议
- if (!in_array($parsed_url['scheme'], ['http', 'https'])) {
- return false;
- }
-
- // 检查是否为私有IP地址(防止SSRF)
- $host = $parsed_url['host'];
- $ip = gethostbyname($host);
-
- if ($ip && $ip !== $host) {
- // 检查是否为私有IP
- if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) {
- // 这是公网IP,允许
- } else {
- // 这是私有IP或保留IP,拒绝
- return false;
- }
- }
-
- // 检查URL长度限制
- if (strlen($url) > 2048) {
- return false;
- }
-
- return true;
- }
- }
|