where("in_id", $id)->find(); $user = db("user")->where("in_userid", $app["in_uid"])->find(); if (!$app["in_super"]) { $user["in_points"] >= $app["in_deduct"] || exit(header("location:" . getlink($id))); } $salt = md5($id . "|" . time() . "|" . rand(2, pow(2, 24))); db("salt")->insert(array("in_aid" => $id, "in_salt" => $salt, "in_time" => time())); $starttime = date("Y-m-d") . " 00:00:00"; $endtime = date("Y-m-d") . " 23:59:59"; if (!$ssid) { db("downhistory")->where("appid", $id)->where("addtime", ">", $starttime)->where("addtime", "<", $endtime)->inc("down")->update(); db("appid")->where("in_id", $id)->inc("in_downloads")->update(); if ($s != "s") { db("user")->where("in_userid", $app["in_uid"])->dec("in_points", $app["in_deduct"])->update(); aclog_save($app["in_uid"], $user["in_points"] - $app["in_deduct"], $user["in_points"], "in_points", "[" . $app["in_id"] . "]-" . $app["in_name"] . "-下载扣除"); } } if ($app["in_form"] == "iOS") { $site_url = "https://" . (IN_TZDOMAIN ?: $_SERVER["HTTP_HOST"]); if ($app["in_super"]) { if ($ssid) { $plist_path = db("super_sign")->where("id", $ssid)->value("plist_path"); if ($plist_path && is_file(IN_ROOT . $plist_path)) { $url = "itms-services://?action=download-manifest&url=" . $site_url . "/" . $plist_path; header("location:" . $url); } exit("下载链接已失效" . $plist_path); } else { $mc_url = "https://" . (IN_DOMAIN ?: $_SERVER["HTTP_HOST"]) . "/index/super_sign/mobileconfig?app_id=" . $id; $embedded1 = $site_url . "/data/cert/public/embedded1.mobileprovision"; header("location:" . $mc_url); } } else { if (substr($app["in_app"], -13) == ".mobileconfig") { db("salt")->where("in_salt", $salt)->delete(); header("location:" . getapp($id, 1)); } else { $plist = $site_url . IN_PATH . "source/pack/upload/install/ios.php/" . $salt . ".plist"; header("location:itms-services://?action=download-manifest&url=" . $plist); } } } else { if (IN_DENIED && getapp($id) == false) { header("location:" . IN_PATH . "source/pack/upload/install/proxy.php/" . $salt . ".apk"); } else { db("salt")->where("in_salt", $salt)->delete(); header("location:" . getapp($id, 1)); } }