123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483 |
- <?php
- namespace app\admin;
- use MingYuanYun\AppStore\Client;
- class super_cert extends Base
- {
- public $loadingImg = "<img src=\"/static/pack/layer/theme/default/loading-2.gif\" width=\"15px\" style=\"position: relative;top: -2px;display: none;\">";
- public function initialize()
- {
- parent::initialize();
- $this->Administrator(3);
- if (in_array($this->action, ["index", "edit"])) {
- $this->header();
- }
- }
- public function __destruct()
- {
- if (in_array($this->action, ["index", "edit"])) {
- $this->footer();
- }
- }
- function index($map = [])
- {
- $this->search = SafeRequest("search", "get");
- $this->search && ($map[] = ["iss|tid|kid|username", "like", "%" . $this->search . "%"]);
- $this->type = SafeRequest("type", "get");
- is_numeric($this->type) && ($map[] = ["type", "=", $this->type]);
- $this->uid = SafeRequest("uid", "get");
- is_numeric($this->uid) && ($map[] = ["user_id", $this->uid ? "<>" : "=", 0]);
- $this->mapTime("create_time", true, $map);
- $_var_0 = SafeRequest("iss", "get");
- $_var_0 && ($map[] = ["iss", "=", $_var_0]);
- $_var_1 = SafeRequest("page", "get");
- $_var_2 = db("super_cert")->where($map)->order("id desc")->paginate(["page" => $_var_1]);
- $_var_3 = db("super_cert")->where($map)->sum("total_count");
- $_var_4 = db("super_cert")->where("limit_count", ">", 0)->where($map)->sum("limit_count");
- $_var_5 = $_var_2->items();
- $_var_6 = getRender($_var_2, $_var_1);
- $_var_7 = $_var_2->total();
- ?> <div class="container">
- <?php
-
- $this->searchForm("", "", function () {
- ?> <select name="uid" onchange="document.btnsearch.submit();">
- <option value="">全部证书</option>
- <option value="0" <?php echo is_numeric($this->uid) && $this->uid == "0" ? "selected=\"selected\"" : "";?>>
- 平台证书
- </option>
- <option value="1" <?php echo is_numeric($this->uid) && $this->uid == "1" ? "selected=\"selected\"" : "";?>>
- 用户证书
- </option>
- </select>
- <select name="type" onchange="document.btnsearch.submit();">
- <option value="">全部类型</option>
- <option value="0" <?php echo is_numeric($this->type) && $this->type == "0" ? "selected=\"selected\"" : "";?>>
- p8
- </option>
- <option value="1" <?php echo is_numeric($this->type) && $this->type == "1" ? "selected=\"selected\"" : "";?>>
- fastlane
- </option>
- </select>
- <?php
- }, function () {
- ?> <a href="https://appstoreconnect.apple.com/access/api" target="_blank"
- style="padding-left: 20px">获取P8证书</a>
- <?php
- });
- ?> <form name="form" method="post" action="?c=super_cert&a=allsave">
-
- <td> <a href="javascript:;" onclick="x_admin_show('添加证书','?c=super_cert&a=edit')"><input type="button" value="添加证书" class="layui-btn"></a></td>
- <table class="layui-table">
- <tr>
- <th class="partition">证书列表</th>
- <th class="partition" colspan="99">
- <span>总计(<?php echo $_var_7;?>)</span>
- <span>被封号(<?php echo db("super_cert")->where("status", -1)->count();?>)</span>
- <span>未启用(<?php echo db("super_cert")->where("status", 0)->count();?>)</span>
- <span>使用中(<?php echo db("super_cert")->where("status", 1)->count();?>)</span>
- <span>疑封号(<?php echo db("super_cert")->where("status", 401)->count();?>)</span>
- <span>无权限(<?php echo db("super_cert")->where("status", 403)->count();?>)</span>
- </th>
- </tr>
- <tr class="header">
-
- <th>ID</th>
- <th>用户</th>
- <th>Iss</th>
- <th>Kid</th>
- <th>Tid</th>
- <th>P8</th>
- <th>P12</th>
- <th>P12密码</th>
- <th>已使用(<?php echo $_var_3;?>)</th>
- <th>剩余(<?php echo $_var_4;?>)</th>
- <th>类型</th>
- <th>添加时间</th>
- <th>到期时间</th>
- <th>备注</th>
- <th>状态</th>
- <th colspan="5">操作</th>
- </tr>
- <?php
- if ($_var_7 == 0) {
- ?><tr> <td colspan="22" style="margin:auto;text-align:center" >暂无数据</td></tr><?php
- } else {
- foreach ($_var_5 as $_var_8) {
- $_var_9 = $_var_8["user_id"] < 1 ? "公用" : db("user")->where("in_userid", $_var_8["user_id"])->value("in_username");
- $_var_10 = db("ios_device")->where("cert_iss", $_var_8["iss"])->group("udid")->count();
- ?><tr class="hover">
- <td class="td25"><input class="checkbox" type="checkbox" name="in_id[]" id="in_id" value="<?php echo $_var_8["id"];?>"><?php echo $_var_8["id"];?></td>
- <td class="td29"><?php echo $_var_9;?></td>
- <td class="td29"><?php echo $_var_8["iss"];?></td>
- <td class="td29"><?php echo $_var_8["kid"];?></td>
- <td class="td29"><?php echo $_var_8["tid"];?></td>
- <td><a href="/download/cert/<?php echo bees_encrypt($_var_8["id"] . ".8." . time());?>">下载</a></td>
- <td><a href="/download/cert/<?php echo bees_encrypt($_var_8["id"] . ".12." . time());?>">下载</a></td>
- <td><?php echo $_var_8["p12_pwd"];?></td>
- <td class="td29"><?php echo $_var_8["total_count"];?></td>
- <td class="td29"><?php echo $_var_8["limit_count"];?></td>
- <td class="td29"><?php echo $_var_8["type"] ? "fastlane" : "p8";?></td>
- <td class="td29"><?php echo date("Y-m-d", $_var_8["create_time"]);?></td>
- <td class="td29"><?php echo date("Y-m-d", $_var_8["expirationDate"]);?></td>
- <td class="td29"><?php echo $_var_8["mark"];?></td>
- <td><div class="parentboard"><?php echo ["-1" => lightnum("被封号"), "0" => lightnum("未启用"), "1" => "使用中", "401" => lightnum("疑封号"), "403" => lightnum("无权限")][$_var_8["status"]];?> [<?php echo $_var_8["status"];?>] </div></td>
- <td>
- <?php echo $_var_10 ? "<a href=\"?c=ios_device&a=index&iss=" . $_var_8["iss"] . "\">查看设备(" . $_var_10 . ")</a>" : "";?><?php
- if ($_var_8["status"]) {
- ?><a href="javascript:;" class="act status_off<?php echo $_var_8["id"];?>" onclick="doAction('change_status',{id:<?php echo $_var_8["id"];?>,status:0},this)">停用<?php echo $this->loadingImg;?></a><?php
- } else {
- ?><a href="javascript:;" class="act status_on<?php echo $_var_8["id"];?>" onclick="doAction('change_status',{id:<?php echo $_var_8["id"];?>,status:1},this)">启用<?php echo $this->loadingImg;?></a><?php
- }
- ?><?php echo $_var_8["type"] ? "\r\n <a href=\"javascript:;\" class=\"act checkLogin" . $_var_8["id"] . "\" onclick=\"doAction('checkLogin',{id:" . $_var_8["id"] . "},this)\">登录校验" . $this->loadingImg . "</a>\r\n " : "";?>
-
- <a href="javascript:;" class="act update<?php echo $_var_8["id"];?>" onclick="doAction('update',{id:<?php echo $_var_8["id"];?>},this)">更新<?php echo $this->loadingImg;?></a>
- <a href="javascript:;" onclick="x_admin_show('编辑','?c=super_cert&a=edit&id=<?php echo $_var_8["id"];?>')" class="act">编辑</a>
-
- <a href="javascript:;" class="act del<?php echo $_var_8["id"];?>" onclick="doAction('del',{id:<?php echo $_var_8["id"];?>},this)">删除<?php echo $this->loadingImg;?></a>
- </td>
- </tr><?php
- }
- }
- ?></table><?php echo $_var_6;?> <table class="tb tb2">
- <tr>
- <td>
- <input type="checkbox" id="chkall" class="checkbox" onclick="CheckAll(this.form);"/>
- <label for="chkall">全选</label>
- <select id="in_allsave" name="in_allsave" onchange="all_save(this.form);">
- <option value="update">更新证书</option>
- <option value="status_on">启用证书</option>
- <option value="status_off">禁用证书</option>
- <option value="del">删除证书</option>
- </select>
- <input type="button" name="allsave" class="layui-btn" value="批量操作"
- onclick="doActionAll(this.form)"/>
- </td>
- </tr>
- </table>
- </form>
- </div>
- <script type="text/javascript" src="/xinadmin/js/xadmin.js"></script>
- <script>
- function doActionAll(form) {
- var checked = false;
- $('input[name="in_id[]"]:checked').each(function () {
- var val = $(this).val();
- var action = $('#in_allsave').val();
- $('a.' + action + val).trigger('click');
- checked = true;
- console.log(val, action, checked);
- });
- if (!checked) layer.msg('请选择要更新的证书');
- }
- function doAction(action, data, ts) {
- $(ts).find('img').show();
- if (action != 'del' || confirm('此操作不能恢复,确认删除吗?'))
- $.post('?c=super_cert&a=' + action, data, function (ret) {
- $(ts).find('img').hide();
- if (ret.msg) layer.msg(ret.msg, {time: 1500}, function () {
- if (ret.code == 200) {
- window.location.reload();
- }
- });
- }, 'json');
- }
- </script>
- <?php
- }
- function edit()
- {
- $_var_11 = SafeRequest("id", "get");
- $_var_12 = $_var_11 ? "编辑" : "新增";
- $_var_13 = db("super_cert")->where("id", $_var_11)->find();
- ?><div class="container"><?php
- $this->nav3();
- ?><table class="tb tb2">
- <form action="" method="post" name="form">
- <input type="hidden" name="id" value="<?php echo $_var_11;?>"/>
- <input type="hidden" name="hash" value="<?php echo $_COOKIE["in_adminpassword"];?>" />
- <tr><th colspan="15" class="partition"><?php echo $_var_12;?>目录</th></tr>
- <tr><td colspan="2" class="td27">iss:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" name="iss" value="<?php echo $_var_13["iss"];?>" placeholder="必须">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">kid:</td></tr>
- <tr><td class="vtop rowform">
- <input type="text" class="txt" name="kid" value="<?php echo $_var_13["kid"];?>" placeholder="p8模式必须">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">p8文件上传:</td></tr>
- <tr><td class="vtop rowform">
- <input type="file" class="txt" name="p8">
- </td>
- </tr>
- <tr><td colspan="2" class="td27">模式:</td></tr>
- <tr><td class="vtop rowform">
- <select name="type"><?php
- foreach (["p8"] as $_var_14 => $_var_15) {
- ?><option value="<?php echo $_var_14;?>" <?php echo $_var_13["type"] == $_var_14 ? "selected" : "";?>><?php echo $_var_15;?></option><?php
- }
- ?></select>
- </td>
- </tr>
- <tr><td colspan="2" class="td27">备注:</td></tr>
- <tr><td class="vtop rowform">
- <textarea rows="6" name="mark" class="tarea"><?php echo $_var_13["mark"];?></textarea>
- </td>
- </tr>
- <tr><td colspan="15">
- <div class="fixsel">
- <button type="button" class="btn" id="submit" >提交<?php echo $this->loadingImg;?></button>
- </div>
- </td></tr>
- </form>
- </table>
- </div>
- <script>
- $("#submit").click(function () {
- $(this).find('img').show();
- var data = new FormData($('form')[0]);
- console.log(data);
- $.ajax({
- url: '?c=super_cert&a=save',
- data: data,
- type: 'POST',
- processData: false,
- contentType: false,
- dataType: "json",
- success: function (ret) {
- $(this).find('img').hide();
- if (ret.msg) alert(ret.msg);
- if (ret.code == 200) {
- window.location.href = '?c=super_cert&a=index';
- }
- }
- })
- });
- </script>
- <?php
- }
- function save()
- {
- $_var_16 = intval(SafeRequest("id"));
- $_var_17 = SafeRequest("iss");
- $_var_18 = SafeRequest("type");
- $_var_19 = SafeRequest("kid");
- $_var_20 = SafeRequest("mark");
- $_var_21 = SafeRequest("username");
- $_var_22 = SafeRequest("password");
- $_var_23 = SafeRequest("mobile");
- $_var_24 = SafeRequest("sp_password");
- if (!$_var_17) {
- reJSON("请输入iss");
- }
- if (!$_var_16 && ($_var_25 = db("super_cert")->where("iss", $_var_17)->count())) {
- reJSON("该证书已存在");
- }
- if ($_var_18) {
- if (!$_var_21) {
- reJSON("fastlane模式,开发者账号必须填");
- }
- if (!$_var_22) {
- reJSON("fastlane模式,开发者密码必须填");
- }
- if (!$_var_23) {
- reJSON("fastlane模式,双重验证手机必须填");
- }
- if (!$_var_24) {
- reJSON("fastlane模式,专用密码必须填");
- }
- } else {
- if (!$_var_19) {
- reJSON("p8模式,kid必须填");
- }
- $_var_26 = IN_CERT_PATH . getCert($_var_17, $_var_19);
- if (!empty($_FILES["p8"]) && $_FILES["p8"]["size"]) {
- $_var_27 = $_FILES["p8"];
- $_var_28 = $_var_27["name"];
- $_var_29 = pathinfo($_var_28);
- $_var_30 = strtolower($_var_29["extension"]);
- if ($_var_30 != "p8") {
- reJSON("p8文件错误,请上传正确的格式的p8文件");
- }
- $_var_31 = IN_CERT_PATH . bees_encrypt($_var_17) . "/";
- if (!is_dir($_var_31)) {
- @mkdir($_var_31, 0777, true);
- }
- @move_uploaded_file($_FILES["p8"]["tmp_name"], $_var_26);
- }
- if (!is_file($_var_26)) {
- reJSON("p8文件错误,请上传正确的格式的p8文件");
- }
- }
- $_var_32 = ["iss" => $_var_17, "kid" => $_var_19, "p8_file" => getCert($_var_17, $_var_19), "p12_file" => getCert($_var_17, $_var_19, "p12"), "mark" => $_var_20, "type" => $_var_18, "username" => $_var_21, "password" => $_var_22, "mobile" => $_var_23, "sp_password" => $_var_24];
- if ($_var_16) {
- $_var_33 = db("super_cert")->where("id", $_var_16)->update($_var_32);
- } else {
- $_var_32 = array_merge($_var_32, ["user_id" => 0, "team_id" => "", "tid" => "", "p12_pwd" => "123456", "limit_count" => 100, "total_count" => 0, "create_time" => time(), "status" => 1]);
- $_var_34 = db("super_cert")->insertGetId($_var_32);
- if ($_var_34) {
- $_var_32["id"] = $_var_34;
- $this->apicert($_var_32);
- }
- }
- reJSON("提交成功", 200);
- }
- function update()
- {
- $_var_35 = SafeRequest("id") ?: $_var_35;
- $_var_36 = db("super_cert")->where("id", $_var_35)->find();
- if (!$_var_36) {
- reJSON("证书不存在!");
- }
- $this->apicert($_var_36);
- reJSON("更新成功", 200);
- }
- function apicert($_var_37)
- {
- $_var_38 = $_var_37["id"];
- $_var_39 = $_var_37["status"];
- if ($_var_37["type"]) {
- if (empty($_var_37["username"]) || empty($_var_37["password"]) || empty($_var_37["mobile"])) {
- reJSON($_var_37["id"] . "号证书信息遗漏,请联系管理员完善");
- }
- $_var_40 = "export LANG=\"en_US.UTF-8\";export LC_ALL=\"en_US.UTF-8\";export PATH=\"/root/.pyenv/shims:/root/.pyenv/bin:/usr/local/php/bin:/usr/local/nginx/sbin:/usr/local/mysql/bin:/usr/local/rvm/gems/ruby-2.6.5/bin:/usr/local/rvm/gems/ruby-2.6.5@global/bin:/usr/local/rvm/rubies/ruby-2.6.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin\";export GEM_HOME=\"/usr/local/rvm/gems/ruby-2.6.5\";export GEM_PATH=\"/usr/local/rvm/gems/ruby-2.6.5:/usr/local/rvm/gems/ruby-2.6.5@global\";export FASTLANE_USER=\"" . $_var_37["username"] . "\";export FASTLANE_PASSWORD=\"" . $_var_37["password"] . "\";export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=\"" . $_var_37["sp_password"] . "\";export SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER=\"+86 " . $_var_37["mobile"] . "\";export FASTLANE_SESSION='" . $_var_37["fastlane_session"] . "';cd " . IN_ROOT . "static/sign_tools/fastlane/;ruby saveCert.rb " . $_var_37["iss"] . " 1";
- exec($_var_40, $_var_41, $_var_42);
- creatdir(IN_TMP_PATH . "saveCert/");
- file_put_contents(IN_TMP_PATH . "saveCert/" . $_var_37["username"] . time() . ".txt", $_var_40);
- if (!empty($_var_41[0])) {
- $_var_43 = json_decode($_var_41[0], true);
- if (empty($_var_43) || !isset($_var_43["status"])) {
- reJSON("处理失败,未能正常获取响应内容");
- }
- if ($_var_43["status"] == 0) {
- reJSON("任务失败,消息提示:" . $_var_43["msg"]);
- }
- reJSON("处理成功");
- }
- reJSON("处理失败,提示:" . print_R($_var_41, true));
- }
- @certMoveToNew($_var_37);
- $_var_44 = $_var_37["iss"];
- $_var_45 = $_var_37["kid"];
- $_var_46 = ["iss" => $_var_44, "kid" => $_var_45, "secret" => IN_CERT_PATH . getCert($_var_44, $_var_45)];
- $_var_47 = new Client($_var_46);
- $_var_47->setHeaders(["Authorization" => "Bearer " . $_var_47->getToken()]);
- $_var_48 = $_var_47->api("certificates")->all(["filter[certificateType]" => "IOS_DISTRIBUTION"]);
- if (isset($_var_48["errors"][0]["status"])) {
- if (($_var_39 == 401 || $_var_39 == -1) && $_var_48["errors"][0]["status"] == 401) {
- $_var_42 = -1;
- } else {
- $_var_42 = $_var_48["errors"][0]["status"];
- }
- $_var_49 = db("super_cert")->where("id", $_var_38)->update(["status" => $_var_42]);
- reJSON($_var_48["errors"][0]["title"], 200);
- }
- if (count($_var_48["data"]) < 2) {
- $_var_50 = $_var_47->api("certificates")->reg();
- if ($_var_50["data"]) {
- $_var_48["data"][] = $_var_50["data"];
- }
- }
- $_var_51 = 0;
- $_var_52 = "";
- foreach (array_reverse($_var_48["data"]) as $_var_53 => $_var_37) {
- $_var_54 = IN_CERT_PATH . getCert($_var_44, $_var_45, "cer");
- file_put_contents($_var_54, base64_decode($_var_37["attributes"]["certificateContent"]));
- $_var_55 = 123456;
- $_var_56 = IN_CERT_PATH . "public/ios.key";
- exec("openssl x509 -in " . $_var_54 . " -inform DER -outform PEM -out " . IN_CERT_PATH . getCert($_var_44, $_var_45, "pem") . " 2>&1", $_var_41, $_var_57);
- file_put_contents(IN_TMP_PATH . "supercert_add_openssl.log", $_var_41);
- exec("openssl pkcs12 -export -inkey " . $_var_56 . " -in " . IN_CERT_PATH . getCert($_var_44, $_var_45, "pem") . " -out " . IN_CERT_PATH . getCert($_var_44, $_var_45, "p12") . " -passout pass:" . $_var_55, $_var_41, $_var_57);
- file_put_contents(IN_TMP_PATH . "supercert_add_openssl2.log", $_var_41);
- if (file_get_contents(IN_CERT_PATH . getCert($_var_44, $_var_45, "p12"))) {
- $_var_51 = $_var_37["id"];
- $_var_52 = $_var_37["attributes"]["expirationDate"];
- break 1;
- } else {
- $_var_47->api("certificates")->del($_var_37["id"]);
- }
- }
- if (!$_var_51) {
- reJSON("没有可使用的证书文件");
- }
- $_var_58 = $_var_47->api("device")->all(["limit" => 200]);
- if (isset($_var_58["data"])) {
- foreach ($_var_58["data"] as $_var_53 => $_var_59) {
- if (!db("ios_device")->where("udid", $_var_59["attributes"]["udid"])->where("cert_iss", $_var_44)->count()) {
- db("ios_device")->insert(["app_id" => 0, "udid" => $_var_59["attributes"]["udid"], "cert_iss" => $_var_44]);
- }
- }
- if ($_var_39 != 0) {
- $_var_60["status"] = 1;
- }
- $_var_60["tid"] = $_var_51;
- $_var_60["total_count"] = $_var_58["meta"]["paging"]["total"];
- $_var_60["limit_count"] = 100 - $_var_60["total_count"];
- $_var_60["expirationDate"] = $_var_52 ? strtotime($_var_52) : time();
- $_var_49 = db("super_cert")->where("id", $_var_38)->update($_var_60);
- }
- }
- function del()
- {
- $_var_61 = intval(SafeRequest("id"));
- $_var_62 = db("super_cert")->where("id", $_var_61)->find();
- $_var_63 = db("super_cert")->where("id", $_var_61)->delete();
- if ($_var_63) {
- @certMoveToNew($_var_62);
- @destroyDir(IN_CERT_PATH . bees_encrypt($_var_62["iss"]));
- db("ios_device")->where("cert_iss", $_var_62["iss"])->delete();
- }
- reJSON("删除成功", 200);
- }
- function change_status()
- {
- $_var_64 = intval(SafeRequest("id"));
- $_var_65 = intval(SafeRequest("status"));
- db("super_cert")->where("id", $_var_64)->update(["status" => $_var_65]);
- if ($_var_65) {
- $this->update($_var_64);
- }
- reJSON("修改成功", 200);
- }
- function checkLogin()
- {
- $_var_66 = intval(SafeRequest("id"));
- $_var_67 = db("super_cert")->where("id", $_var_66)->find();
- if (!$_var_67) {
- reJSON("证书不存在!");
- }
- if (empty($_var_67["username"]) || empty($_var_67["password"]) || empty($_var_67["mobile"])) {
- reJSON($_var_67["id"] . "号证书信息遗漏,请联系管理员完善");
- }
- $_var_68 = "export LANG=\"en_US.UTF-8\";export LC_ALL=\"en_US.UTF-8\";export PATH=\"/root/.pyenv/shims:/root/.pyenv/bin:/usr/local/php/bin:/usr/local/nginx/sbin:/usr/local/mysql/bin:/usr/local/rvm/gems/ruby-2.6.5/bin:/usr/local/rvm/gems/ruby-2.6.5@global/bin:/usr/local/rvm/rubies/ruby-2.6.5/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/rvm/bin:/root/bin\";export GEM_HOME=\"/usr/local/rvm/gems/ruby-2.6.5\";export GEM_PATH=\"/usr/local/rvm/gems/ruby-2.6.5:/usr/local/rvm/gems/ruby-2.6.5@global\";export FASTLANE_USER=\"" . $_var_67["username"] . "\";export FASTLANE_PASSWORD=\"" . $_var_67["password"] . "\";export FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD=\"" . $_var_67["sp_password"] . "\";export SPACESHIP_2FA_SMS_DEFAULT_PHONE_NUMBER=\"+86 " . $_var_67["mobile"] . "\";export FASTLANE_SESSION='" . $_var_67["fastlane_session"] . "';cd " . IN_ROOT . "static/sign_tools/fastlane/;";
- exec($_var_68 . "ruby checkLogin.rb", $_var_69, $_var_70);
- creatdir(IN_TMP_PATH . "checkLogin/");
- file_put_contents(IN_TMP_PATH . "checkLogin/" . $_var_67["username"] . time() . ".log", $_var_68 . "fastlane spaceauth;ruby checkLogin.rb");
- if (!empty($_var_69[0])) {
- $_var_71 = json_decode($_var_69[0], true);
- if (empty($_var_71) || !isset($_var_71["status"])) {
- reJSON("登录失败,未能正常获取响应内容");
- }
- if ($_var_71["status"] == 0) {
- reJSON("登录失败,消息提示:" . $_var_71["msg"]);
- }
- $_var_71["session"] = base64_decode($_var_71["session"]);
- if (empty($_var_71["session"])) {
- reJSON("未能获取session");
- }
- if (strpos($_var_71["session"], "---\\n- !ruby/object:") === false) {
- reJSON("session格式校验失败");
- }
- db("super_cert")->where("id", $_var_66)->update(["fastlane_session" => $_var_71["session"]]);
- reJSON("登录正常,session更新成功");
- }
- reJSON("登录失败,提示:" . print_r($_var_69, true));
- }
- }
|