想要调用城通网盘的开放api写一个引导注册的页面,但总是注册不成功(返回错误代码503)或者干脆没有反应,有没有大佬帮看看哪里出错了?
这是城通的开放文档相关页面
引导注册获取分成接口 - Powered by MinDoc
引导注册获取分成接口-
https://openapi.ctfile.com/docs/ctfile-user-api/ctfile-user-api-1cgva0759eqkc
这是我的代码
<html>
<head>
<title>免费注册-城通网盘-50TB超大网盘</title>
<link rel="stylesheet" href="//static.ctfile.com/min/g=c1?v=20190802" />
<link rel="stylesheet" href="//static.ctfile.com/min/g=c2?v=20190802" />
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<!-- 调用城通api,来自城通开放文档:https://openapi.ctfile.com/docs/ctfile-user-api/ctfile-user-api-1cglhkmunab04 -->
<main id="content" role="main">
<!-- Register Form -->
<div class="container space-1 space-md-3">
<form id="ctreg" class="js-validate w-md-75 w-lg-50 mx-md-auto" method="post">
<input type="hidden" name="ref_uid" id="dataRef" value="28273672">
<input type="hidden" name="linker" value="28273672">
<input type="hidden" name="task" value="register">
<!-- Title -->
<div class="mb-7">
<h1 class="h3 text-primary font-weight-normal mb-0">欢迎免费注册 <span
class="font-weight-semi-bold">城通网盘</span></h1>
<p>立即免费注册一个帐号,体验强大的城通网盘。</p>
</div>
<!-- End Title -->
<div id="register-error" class="d-none alert alert-warning" role="alert">
</div>
<div id="register-success" class="d-none alert alert-success" role="alert">
</div>
<!-- Form Group -->
<div class="js-form-message form-group">
<label class="form-label" for="signinSrEmail">邮箱</label>
<input type="email" class="form-control" name="email" id="signinSrEmail" placeholder="邮箱"
value="" aria-label="邮箱" required data-msg="请输入您的注册邮箱。"
data-error-class="u-has-error" data-success-class="u-has-success">
</div>
<!-- End Form Group -->
<!-- Form Group -->
<div class="js-form-message form-group">
<label class="form-label" for="signinSrPassword">
<span class="d-flex justify-content-between align-items-center">
密码
</span>
</label>
<input type="password" class="form-control" name="password" id="signinSrPassword" placeholder="输入密码"
value="" autocomplete="new-password" aria-label="输入密码"
required data-msg="请输入密码。" data-error-class="u-has-error" data-success-class="u-has-success">
</div>
<!-- End Form Group -->
<div class="d-block d-lg-flex">
<div class="js-form-message form-group">
<label class="form-label" for="signinSrCaptcha">验证码</label>
<input type="text" class="form-control" name="captcha" id="signinSrCaptcha" placeholder="四位验证码"
value="" aria-label="四位验证码" required
data-msg="请输入四位验证码。" data-error-class="u-has-error" data-success-class="u-has-success">
</div>
<div class="mt-2 ml-md-5 ml-0 mb-3 mb-md-0">
<img id="vfcode" src="https://webapi.ctfile.com/randcodeV2_login.php?r=0.04229437676295822" class=" border rounded"
onclick="changeimg()">
</div>
</div>
<!-- Checkbox -->
<div class="js-form-message mb-5">
<div class="custom-control custom-checkbox d-flex align-items-center text-muted">
<input type="checkbox" class="custom-control-input" id="termsCheckbox" name="termsCheckbox" required
data-msg="请确认同意服务条款和隐私政策。" data-error-class="u-has-error" data-success-class="u-has-success">
<label class="custom-control-label" for="termsCheckbox">
<small>
我同意
<a target="_blank" href="https://www.ctfile.com/p/terms-and-conditions">服务条款</a>和 <a target="_blank" href="https://www.ctfile.com/p/privacy">隐私政策</a>
</small>
</label>
</div>
</div>
<!-- End Checkbox -->
<!-- Button -->
<div class="col-7 col-sm-6 text-right">
<button type="submit" class="btn btn-primary transition-3d-hover" onclick="startreg()">注册</button>
</div>
</div>
<!-- End Button -->
</form>
</div>
<!-- End Register Form -->
<!-- JS Plugins Init. -->
<script>
function changeimg() {
document.getElementById('vfcode').src = 'https://webapi.ctfile.com/randcodeV2_login.php?' + Math.random();
}
</script>
<script>
function startreg() {
$.ajax({
//几个参数需要注意一下
type: "POST",//方法类型
dataType: "json",//预期服务器返回的数据类型
url: "https://webapi.ctfile.com/api.php?item=account&action=register" ,//url
data: $('#ctreg').serialize(),
success: function (result) {
console.log(result);//打印服务端返回的数据(调试用)
if (result.code == 200) {
alert("注册成功");
}
;
if (result.code == 503) {
alert("错误描述");
}
;
},
error : function() {
alert("异常!");
}
});
}
</script>
</body>
</html>