sign1.js 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. function reset_sign_confirm() {
  2. $.layer({
  3. shade: [0],
  4. area: ["auto", "auto"],
  5. dialog: {
  6. msg: "确定要重置签名吗?",
  7. btns: 2,
  8. type: 4,
  9. btn: ["确定", "取消"],
  10. yes: function () {
  11. reset_sign();
  12. },
  13. no: function () {
  14. layer.msg("已取消重置", 1, 0);
  15. }
  16. }
  17. });
  18. }
  19. function reset_sign() {
  20. return sign();
  21. $.get('/index/ajax_sign/reset', {aid: in_id}, function (ret) {
  22. if (ret.code == -1) {
  23. layer.msg("请先登录后再操作!", 3, 11);
  24. } else if (ret.code == -2) {
  25. layer.msg("应用不存在或已被删除!", 3, 11);
  26. } else if (ret.code == -3) {
  27. layer.msg("您不能重置别人的应用!", 3, 8);
  28. } else if (ret.code == -4) {
  29. layer.msg("该应用未在进行签名!", 3, 8);
  30. } else if (ret.code == 1) {
  31. location.reload();
  32. } else {
  33. layer.msg("出现未知错误!", 3, 8);
  34. }
  35. }, 'json');
  36. }
  37. function sign_confirm() {
  38. $.layer({
  39. shade: [0],
  40. area: ["auto", "auto"],
  41. dialog: {
  42. //msg: '<font color="#000fff">签名将会去除下列文件名注入的签名锁 <br>功能性动态库请勿使用下列文件名注入<br>否则您注入的动态库将失效!<br> sign.data <br> sign.dylib <br> embedded.dylib<br> embedded.png <br> XXGamePlugin <br>如已注入以上名称的动态库请取消签名 <br>并修改功能文件注入名称后重新上传ipa <br>再重新签名!<br><br>确定要开始签名吗?</font>',
  43. msg: '确定要开始签名吗?',
  44. btns: 2,
  45. type: 4,
  46. btn: ["确定", "取消"],
  47. yes: function () {
  48. sign(1);
  49. },
  50. no: function () {
  51. layer.msg("已取消签名", 1, 0);
  52. }
  53. }
  54. });
  55. }
  56. function sign() {
  57. if (remote > 0) {
  58. //layer.msg("不支持云存储签名!", 3, 8);
  59. //return false;
  60. }
  61. $.get('/index/ajax_sign/sign', {aid: in_id}, function (ret) {
  62. if (ret.code == -1) {
  63. layer.msg("请先登录后再操作!", 3, 8);
  64. } else if (ret.code == -2) {
  65. layer.msg("应用不存在或已被删除!", 3, 8);
  66. } else if (ret.code == -22) {
  67. layer.msg("ipa包异常,请重新上传应用!", 3, 8);
  68. } else if (ret.code == -3) {
  69. layer.msg("您不能签名别人的应用!", 3, 8);
  70. } else if (ret.code == -4) {
  71. layer.msg("不能签名Android应用!", 3, 8);
  72. } else if (ret.code == -5) {
  73. layer.msg("该应用未开通企业签名!", 3, 8);
  74. } else if (ret.code == -6) {
  75. layer.msg("该应用补签名额不足!", 3, 8);
  76. } else if (ret.code == -7) {
  77. layer.msg("该应用正在进行签名!", 3, 8);
  78. } else if (ret.data) {
  79. if (IN_SIGNMETHOD == 1) {
  80. localStorage.setItem('signlog_id', ret.data.id);
  81. api_sign()
  82. } else {
  83. location.reload();
  84. }
  85. }
  86. }, 'json')
  87. }
  88. function api_sign() {
  89. return $.get(oauth.api + '/open/apps/sign', {aid: oauth.api_aid, secret: oauth.secret, end_time}, function (ret) {
  90. if (ret.msg) layer.msg(ret.msg, 3, 8);
  91. if (ret.data) {
  92. localStorage.setItem('api_signlog_id', ret.data.id);
  93. location.reload();
  94. }
  95. }, 'json');
  96. }
  97. function listen() {
  98. if (IN_SIGNMETHOD == 1) {
  99. return listen_api();
  100. }
  101. $.get('/index/ajax_sign/listen', {aid: in_id}, function (ret) {
  102. if (ret.code == -2) {
  103. $("#_listen").text("签名失败!");
  104. } else if (ret.code == -1) {
  105. $("#_listen").text("解析失败");
  106. } else if (ret.code == 1) {
  107. $("#_listen").text("准备中");
  108. } else if (ret.code == 2) {
  109. $("#_listen").text("正在解析");
  110. } else if (ret.code == 3) {
  111. $("#_listen").text("正在签名");
  112. } else if (ret.code == 4) {
  113. $("#_listen").text("正在打包");
  114. } else if (ret.code == 5) {
  115. $("#_listen").text('签名完成');
  116. location.reload();
  117. }
  118. }, 'json');
  119. }
  120. function listen_api() {
  121. var api_signlog_id = localStorage.getItem('api_signlog_id');
  122. if (api_signlog_id)
  123. $.get(oauth.api + '/open/apps/signStatus', {aid: oauth.api_aid, secret: oauth.secret}, function (ret) {
  124. var signlog_id = localStorage.getItem('signlog_id');
  125. if (signlog_id)
  126. $.get('/index/ajax_sign/saveStatus', {aid: in_id, in_status: ret.code}, function () {
  127. if (ret.code == -2) {
  128. $("#_listen").text("签名失败");
  129. location.reload();
  130. } else if (ret.code == -1) {
  131. $("#_listen").text("解析失败");
  132. location.reload();
  133. } else if (ret.code == 1) {
  134. $("#_listen").text("准备中");
  135. } else if (ret.code == 2) {
  136. $("#_listen").text("正在解析");
  137. } else if (ret.code == 3) {
  138. $("#_listen").text("正在签名");
  139. } else if (ret.code == 4) {
  140. $("#_listen").text("正在打包");
  141. } else if (ret.code == 5) {
  142. $("#_listen").text('签名完成');
  143. location.reload();
  144. }
  145. }, 'json');
  146. }, 'json');
  147. }
  148. function download() {
  149. if (IN_SIGNMETHOD == 1) {
  150. return download_api();
  151. }
  152. $.get('/index/ajax_sign/download', {aid: in_id}, function (ret) {
  153. if (ret.code == -1) {
  154. layer.msg("请先登录后再操作!", 3, 11);
  155. } else if (ret.code == -2) {
  156. layer.msg("应用不存在或已被删除!", 3, 11);
  157. } else if (ret.code == -3) {
  158. layer.msg("您不能下载别人的应用!", 3, 8);
  159. } else if (ret.code == -4) {
  160. layer.msg("该应用暂未完成签名!", 3, 8);
  161. } else if (ret.data.url) {
  162. location.href = ret.data.url;
  163. }
  164. }, 'json');
  165. }
  166. function download_api() {
  167. location.href = oauth.api + '/open/download?aid=' + oauth.api_aid
  168. }
  169. function purchase(key) {
  170. $.get('/index/ajax_sign/purchase', {aid: in_id, key}, function (ret) {
  171. if (ret.code == -1) {
  172. layer.msg("请先登录后再操作!", 3, 11);
  173. } else if (ret.code == -2) {
  174. layer.msg("应用不存在或已被删除!", 3, 11);
  175. } else if (ret.code == -3) {
  176. layer.msg("密钥不正确或已被使用!", 3, 8);
  177. } else if (ret.code == 1) {
  178. location.reload();
  179. }
  180. }, 'json');
  181. }
  182. function tishi() {
  183. alert('签名开始后请勿切换到其他页面或刷新\n否则可能签名失败,请耐心等待!');
  184. }
  185. function tishi1() {
  186. alert('签名将会去除下列文件名注入的签名锁 \n功能性动态库请勿使用下列文件名注入\n否则您注入的动态库将失效!\n sign.data \n sign.dylib \n embedded.dylib\n embedded.png \n XXGamePlugin \n如已注入以上名称的动态库请取消签名 \n并修改功能文件注入名称后重新上传ipa \n再重新签名!');
  187. }
  188. function change(type) {
  189. var inre = $("#in_replace").val();
  190. if (type == 1) {
  191. $('#check').html('<input type="text" class="col-sm-9 linkform-control" value="*.*|*" id="in_replace" style="display:none;" readonly="true">');
  192. }
  193. if (inre == '*.*|*') {
  194. $('#check').html('<input type="text" class="col-sm-9 link" placeholder="指定特殊签名文件,默认留空!多文件以 | 隔开" id="in_replace"><br><br>');
  195. }
  196. }