作者 anyv
1 个管道 的构建 通过 耗费 1 秒

5

... ... @@ -305,6 +305,7 @@ class PersonalcenterController extends WeChatBaseController{
for( $i=0; $i<6; $i++ ) {
$key .= $pattern[mt_rand(0, 9)];
}
session('code',$key);
$rand_name = "验证码:".$key."【学考无忧】";
$phone = $_POST['phone'];
$data = array(
... ... @@ -315,7 +316,6 @@ class PersonalcenterController extends WeChatBaseController{
);
$sendAPI->data = $data;//初始化数据包
$return = $sendAPI->sendSMS('POST');//GET or POST
dump($return);die;
if($return){
return true;
}else{
... ... @@ -324,6 +324,32 @@ class PersonalcenterController extends WeChatBaseController{
}
/**
* 添加审核信息
*/
public function add_audit(){
$code = session('code');
if($code == $_POST['code']){
$data['name'] = $_POST['name'];
$data['phone'] = $_POST['phone'];
$data['id_number'] = $_POST['id_num'];
$data['img_front'] = $_POST['img0'];
$data['img_back'] = $_POST['img1'];
$data['create_time'] = time();
$data['uid'] = cmf_get_current_user_id();
$inser = Db::name('sale_audit') -> insert($data);
if($inser){
Db::name('my_user') -> where('uid',$data['uid']) -> update(['status'=>5]);
return 1;
}else{
return 2;
}
}else{
return 3;
}
}
... ...
... ... @@ -26,7 +26,7 @@
姓名
</div>
<div class="log_two_input_contant">
<input type="text" placeholder="请输入姓名" />
<input type="text" placeholder="请输入姓名" id="name" />
</div>
</div>
<div class="log_two_input_one">
... ... @@ -34,7 +34,7 @@
手机号
</div>
<div class="log_two_input_contant">
<input style="width:3rem" type="text" placeholder="请输入手机号" maxlength="11" name="phone" />
<input style="width:3rem" type="text" placeholder="请输入手机号" maxlength="11" name="phone" id="phone" />
</div>
<div class="log_two_input_btn">
<input type="button" class="btn" id="code" value="获取验证码" onclick="codeButton()">
... ... @@ -45,7 +45,7 @@
输入验证码
</div>
<div class="log_two_input_contant">
<input type="text" placeholder="请输入验证码" />
<input type="text" placeholder="请输入验证码" id="mycode" />
</div>
</div>
<div class="log_two_input_one">
... ... @@ -53,7 +53,7 @@
身份证号
</div>
<div class="log_two_input_contant">
<input type="text" placeholder="请输入身份证号" />
<input type="text" placeholder="请输入身份证号" id="id_num" />
</div>
</div>
</div>
... ... @@ -99,12 +99,44 @@
</div>
</div>
<!-- 保存 -->
<div class="log_two_bottom_btn">
<a href="log_first.html">保存</a>
<div class="log_two_bottom_btn" onclick="auditadd()">
保存
</div>
<script src="__TMPL__/public/assets/js/jquery.js"></script>
<script src="__TMPL__/public/assets/js/base.js"></script>
<script>
/**
*保存提交审核信息
*/
function auditadd(){
if($('#name').val() == ''){
alert('姓名不能为空');
}else if($('#phone').val() == ''){
alert('手机号不能为空');
}else if($('#mycode').val() == ''){
alert('验证码不能为空');
}else if($('#id_num').val() == ''){
alert('身份证号不能为空');
}else{
name = $('#name').val();
phone = $('#phone').val();
code = $('#mycode').val();
id_num = $('#id_num').val();
img0 = $('#img0')[0].src;
img1 = $('#img1')[0].src;
$.post("{:url('Personalcenter/add_audit')}",{name:name,phone:phone,code:code,id_num:id_num,img0:img0,img1:img1},function(data){
if(data == 3){
alert('验证码错误');
}else if(data == 2){
alert('提交失败');
}else if(data == 1){
window.location.href = "{:url('Personalcenter/personal_center')}";
}
});
}
}
</script>
<script>
// 上传图片
function addImg(file) {
console.log(file.files);
... ... @@ -141,25 +173,29 @@
//短信验证码
function codeButton() {
phone = $("input[name='phone']").val();
$.post("{:url('Personalcenter/send_message')}",{phone:phone},function(data){
if(data){
var code = $("#code");
code.attr("disabled", "disabled");
setTimeout(function() {
code.css("opacity", "0.8");
}, 1000)
var time = 60;
var set = setInterval(function() {
code.val("(" + --time + ")秒后重新获取");
}, 1000);
setTimeout(function() {
code.attr("disabled", false).val("重新获取验证码");
clearInterval(set);
}, 60000);
}else{
alert('发送失败!');
}
});
if(phone == ''){
alert('手机号不能为空');
}else{
$.post("{:url('Personalcenter/send_message')}",{phone:phone},function(data){
if(data){
var code = $("#code");
code.attr("disabled", "disabled");
setTimeout(function() {
code.css("opacity", "0.8");
}, 1000)
var time = 60;
var set = setInterval(function() {
code.val("(" + --time + ")秒后重新获取");
}, 1000);
setTimeout(function() {
code.attr("disabled", false).val("重新获取验证码");
clearInterval(set);
}, 60000);
}else{
alert('发送失败!');
}
});
}
}
</script>
... ...