123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- <?php
- namespace app\admin;
- class app_pack extends Base
- {
- public function initialize()
- {
- parent::initialize();
- $this->Administrator(4);
- $this->header();
- }
- public function __destruct()
- {
- $this->footer();
- }
- function del()
- {
-
- $_var_9 = intval(SafeRequest("id", "get"));
- // var_dump($_var_9);die;
- $_var_10 = db("app_pack")->where("id", $_var_9)->delete();
- $this->ShowMessage("恭喜您,删除成功!", "?c=app_pack", "infotitle2", 1000, 1);
- }
- function index($_var_0 = [])
- {
- $_var_1 = SafeRequest("page", "get");
- $this->search = SafeRequest("search", "get");
- $this->search && ($_var_0[] = ["name|url|bundle_id", "like", "%" . $this->search . "%"]);
- $this->type = SafeRequest("type", "get");
- is_numeric($this->type) && ($_var_0[] = ["type", "=", $this->type]);
- $this->mapTime("create_time", true, $_var_0);
- $_var_2 = db("app_pack")->where($_var_0)->json(["config"])->order("id desc")->paginate(["page" => $_var_1]);
- $_var_3 = $_var_2->items();
- $_var_4 = $_var_2->total();
- $_var_5 = getRender($_var_2, $_var_1);
- ?> <div class="container">
- <?php
- $this->nav3();
- $this->searchForm("", "", function () {
- ?> <select name="type" onchange="document.btnsearch.submit();">
- <option value="">全部类型</option>
- <?php
- foreach (["安卓", "苹果", "苹果免签"] as $_var_6 => $_var_7) {
- ?> <option value="<?php echo $_var_6;?>" <?php echo $this->type == $_var_6 ? "selected=\"selected\"" : "";?>>
- <?php echo $_var_7;?> </option>
- <?php
- }
- ?> </select>
- <?php
- });
- ?>
- <style type="text/css">
- .checkbox {
- height: 14px;
- position: relative;
- top: 0;
- width: 18px;
- height: 23px;
- line-height: 10px;
- border: 1px solid #d2d2d2;
- font-size: 12px;
- border-radius: 10px;
- background-color: #fff;
- -webkit-transition: .1s linear;
- transition: .1s linear;
- }
- a{
- text-decoration: none;
- }
- a:hover{ text-decoration:none}
- </style>
- <form name="form" method="post" action="?c=app_pack&a=allsave">
- <table class="tb tb2">
- <tr>
- <th class="partition">应用封装列表</th>
- </tr>
- </table>
- <xblock>
-
- <button class="layui-btn layui-btn-normal" value="批量操作" name="allsave"><i class="layui-icon layui-icon-delete"></i>批量删除</button>
- </xblock>
- <table class="layui-table">
- <thead>
- <tr>
- <th>
- <input type="checkbox" id="chkall" class="checkbox" onclick="CheckAll(this.form);"/>
-
- </th>
- <th>应用ID</th>
- <th>所属用户</th>
- <th>应用图标</th>
- <th>应用名称</th>
- <th>下载</th>
- <th>封装地址</th>
- <th>应用包名</th>
- <th>应用版本</th>
- <th>应用类型</th>
- <th>封装时间</th>
- <th>有效期</th>
- <th>操作</th>
- </tr>
- </thead>
- <?php
- if ($_var_4 == 0) {
- ?><tr> <td colspan="22" style="margin:auto;text-align:center" >暂无数据</td></tr><?php
- } else {
- if ($_var_3) {
- foreach ($_var_3 as $_var_8) {
- ?>
- <tr>
- <td><input class="checkbox" type="checkbox" name="in_id[]" id="in_id" value="<?php echo $_var_8["id"];?>"></td>
- <td><?php echo $_var_8["id"];?></td>
- <td><?php echo db("user")->where("in_userid", $_var_8["user_id"])->value("in_username");?></td>
- <td><img src="<?php echo $_var_8["icon"] ?: $_var_8["config"]["icon"];?>" onerror="this.src='static/index/image/<?php echo $_var_8["type"] ? "iOS" : "Android";?>.png'" width="25" height="25"/></a></td>
- <td><?php echo $_var_8["name"];?></a></td>
- <td><a class="layui-btn layui-btn-normal layui-btn-xs" href="<?php echo $_var_8["file"] ? "/data/attachment/pack/" . $_var_8["file"] : getapp($_var_8["app_id"], 1);?>" target="_blank" class="act">下载</a></td>
- <td><a href="<?php echo $_var_8["url"];?>" target="_blank"><?php echo $_var_8["url"];?></td>
- <td><?php echo $_var_8["bundle_id"];?></td>
- <td><?php echo $_var_8["version"];?></td>
- <td><?php echo $_var_8["type"] == 1 ? "iOS" : ($_var_8["type"] == 2 ? "iOS免签" : "Android");?></td>
- <td><?php echo date("Y-m-d H:i", $_var_8["create_time"]);?></td>
- <td><?php echo $_var_8["period"] > 0 ? date("Y-m-d H:i", $_var_8["period"]) : "永久";?></td>
- <td>
- <a class="layui-btn layui-btn-danger layui-btn-xs" style="cursor:pointer" onclick="del_msgyy('?c=app_pack&a=del&id=<?php echo $_var_8["id"];?>');"><i class="layui-icon layui-icon-delete"></i>删除</a>
- <?php
- if ($_var_8["period"] > 0) {
- ?><a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-xs" onclick="addTime(<?php echo $_var_8["id"];?>,<?php echo $_var_8["period"];?>)"><i class="layui-icon layui-icon-addition"></i>增加时间</a><?php
- }
- ?></td></tr><?php
- }
- }
- }
- ?> </table>
- <?php echo $this->render($_var_5);?> <table class="tb tb2">
- <tr>
-
- </tr>
- </table>
- </form>
- </div>
- <script>
- function addTime(id, period) {
- layer.prompt({title: '请输入增加的时长(天)'}, function (days, index) {
- layer.close(index);
- if (isNaN(days)) {
- return layer.msg(days + '不是有效的时间');
- }
- location.href = '?c=app_pack&a=addTime&id=' + id + '&days=' + days + '&period=' + period;
- });
- }
- </script>
- <?php
- }
- function addTime()
- {
- $_var_9 = SafeRequest("id", "get");
- $_var_10 = SafeRequest("days", "get");
- $_var_11 = SafeRequest("period", "get");
- $_var_12 = strtotime("+" . $_var_10 . " days", max($_var_11, time()));
- $_var_13 = db("app_pack")->where("id", "in", $_var_9)->update(["period" => $_var_12]);
- $_var_14 = date("Y-m-d", $_var_12);
- $this->ShowMessage("恭喜您,增加时间成功!到期时间:" . $_var_14, $_SERVER["HTTP_REFERER"], "infotitle2", 3000, 1);
- }
- function allsave()
- {
- if (!submitcheck("allsave")) {
- $this->ShowMessage("表单验证不符,无法提交!", $_SERVER["PHP_SELF"], "infotitle3", 3000, 1);
- }
- $_var_15 = RequestBox("in_id");
- $_var_16 = SafeRequest("in_allsave", "post");
- if ($_var_15 == 0) {
- $this->ShowMessage("批量操作失败,请先勾选要删除的应用!", $_SERVER["HTTP_REFERER"], "infotitle3", 3000, 1);
- } else {
- if ($_var_16 == 0) {
- $_var_17 = db("app_pack")->where("id", "in", $_var_15)->json(["config"])->select();
- foreach ($_var_17 as $_var_18 => $_var_19) {
- if ($_var_19["file"]) {
- @unlink(IN_ATTACHMENT_PATH . "pack/" . $_var_19["file"]);
- }
- if ($_var_19["icon"]) {
- @unlink(IN_ROOT . $_var_19["icon"]);
- }
- if ($_var_19["launch"]) {
- @unlink(IN_ROOT . $_var_19["launch"]);
- }
- if (isset($_var_19["config"]["icon"])) {
- @unlink(IN_ROOT . $_var_19["config"]["icon"]);
- }
- if (isset($_var_19["config"]["launch"])) {
- @unlink(IN_ROOT . $_var_19["config"]["launch"]);
- }
- }
- db("app_pack")->where("id", "in", $_var_15)->delete();
- $this->ShowMessage("恭喜您,应用批量删除成功!", $_SERVER["HTTP_REFERER"], "infotitle2", 3000, 1);
- }
- }
- }
- }
|