Merge branch 'feature/loginInfo' of wmtx/platform into release

手机验证码登录推广后台
master
廖金灵 4 years ago committed by Gogs
commit c4ec5753f0

@ -80,6 +80,10 @@ class PromoteModel extends Model{
}
}
public function login_phone($user) {
$this->autoLogin($user);
}

@ -14,6 +14,7 @@ use OT\DataDictionary;
use User\Api\PromoteApi;
use Home\Controller\DownController;
use Base\Tool\TaskClient;
/**
* 前台首页控制器
@ -74,6 +75,12 @@ class IndexController extends HomeController
$map['account'] = $account;
$data['last_login_time'] = time();
M("promote", "tab_")->where($map)->save($data);
$loginrecord['promote_id'] = get_pid();
$loginrecord['account'] = $_POST['account'];
$loginrecord['client_ip'] = $_SERVER['REMOTE_ADDR'];
$loginrecord['login_type'] = 1;
$loginrecord['create_time'] = time();
M("promote_login_record", "tab_")->add($loginrecord);
$this->ajaxReturn(array("status" => 1, "msg" => "登录成功", 'url' => U('Promote/index')));
} else {
$msg = "";
@ -99,6 +106,34 @@ class IndexController extends HomeController
}
}
public function doPhoneLogin() {
$mobile = $_POST['login_phone'];
$verify = $_POST['code'];
if (!$this->checksafecode($mobile, $verify)) {
$this->error('验证码错误');
}
$promote = M('promote', 'tab_')->where([
'login_phone' => $mobile,
])->find();
if($promote) {
$loginrecord['promote_id'] = $promote['id'];
$loginrecord['account'] = $promote['account'];
$loginrecord['client_ip'] = $_SERVER['REMOTE_ADDR'];
$loginrecord['login_type'] = 2;
$loginrecord['create_time'] = time();
M("promote_login_record", "tab_")->add($loginrecord);
setcookie('login_phone', $mobile, time() + 3600 * 10000, $_SERVER["HTTP_HOST"]);
$promote1 = new PromoteApi();
$result = $promote1->login_phone($promote['account']);
if ($result) {
$this->ajaxReturn(array("status" => 1, "msg" => "登录成功", 'url' => U('Promote/index')));
}
}else {
$this->error('此电话未注册,登录失败');
}
}
/* public function register()
{
if (IS_POST) {
@ -291,4 +326,41 @@ class IndexController extends HomeController
$Promote->logout();
redirect(U('Index/index'));
}
public function phoneLogin() {
$this->display();
}
/**
* 发动手机验证码
*/
public function telsafecode($phone = '', $delay = 10, $flag = true)
{
$taskClient = new TaskClient();
$result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
$data['msg'] = $result['message'];
echo json_encode($data);
exit;
}
/**
* 手机安全码验证
*/
public function checksafecode($phone, $code)
{
$taskClient = new TaskClient();
$result = $taskClient->checkSms($phone, $code);
$data = [];
if ($result && $result['code'] == TaskClient::SUCCESS) {
return true;
} else {
return false;
}
}
}

@ -9,6 +9,7 @@
namespace Home\Controller;
use Think\Controller;
use Base\Repository\PromoteRepository;
use Base\Tool\TaskClient;
/**
* 扩展控制器
@ -18,12 +19,19 @@ class SafeController extends BaseController{
public function setSafeIndex() {
$id = get_pid();
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd')->find();
if(empty($safePwd['second_pwd'])) {
return $this->display();
}else {
return $this->display("verifySafePwd");
}
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd, level, login_phone')->find();
if(!empty($safePwd['login_phone'])) {
$this->assign('login_phone', $safePwd['login_phone']);
}
if ($safePwd['level'] != 1) {
return $this->error('非会长无法更改');
}
return $this->display();
// if(empty($safePwd['second_pwd'])) {
// return $this->display();
// }else {
// return $this->display("verifySafePwd");
// }
}
@ -77,30 +85,36 @@ class SafeController extends BaseController{
}
public function modifyPwdIndex() {
$id = get_pid();
$promote = M('promote', 'tab_')->where(['id' => $id])->find();
if(!empty($promote['login_phone'])) {
$this->assign('login_phone', $promote['login_phone']);
}
if($_POST) {
$oldpwd = $_POST['oldpwd'];
$safepwd = $_POST['safepwd'];
if(empty($oldpwd)) {
$this->error("旧密码不能为空");
if ($promote['level'] != 1) {
return $this->error('修改失败,非会长无法修改!');
}
//$oldpwd = $_POST['oldpwd'];
$safepwd = $_POST['safepwd'];
// if(empty($oldpwd)) {
// $this->error("旧密码不能为空");
// }
if(empty($safepwd)) {
$this->error("安全密码不能为空");
}
$id = get_pid();
$safePwd = M('promote','tab_')->where(['id'=>$id])->field('second_pwd')->find();
if($safePwd['second_pwd'] == $this->think_ucenter_md5($oldpwd, UC_AUTH_KEY)){
$data['second_pwd'] = $this->think_ucenter_md5($safepwd, UC_AUTH_KEY);
$updateRs = M("promote","tab_")->where(['id'=>$id])->save($data);
if($updateRs) {
$this->success("修改成功");
}else {
$this->error("修改失败,请重新操作");
}
if (!$this->checksafecode($promote['login_phone'], $_POST['code'])) {
return $this->error('验证码错误');
}
else {
$this->error('旧密码错误,请确认');
$id = get_pid();
$data['second_pwd'] = $this->think_ucenter_md5($safepwd, UC_AUTH_KEY);
$updateRs = M("promote","tab_")->where(['id'=>$id])->save($data);
if($updateRs) {
$this->success("修改成功");
}else {
$this->error("修改失败,请重新操作");
}
}
$this->display();
}
@ -559,4 +573,72 @@ class SafeController extends BaseController{
$this->ajaxReturn(['code'=>0000,'mes'=>'删除成功']);
}
}
public function bindTel() {
$id = get_pid();
$promote = M('promote', 'tab_')->where(['id' => $id])->find();
if(!empty($promote['login_phone'])) {
$this->assign('login_phone', $promote['login_phone']);
}
return $this->display();
}
/**
* 发动手机验证码
*/
public function telsafecode($phone = '', $delay = 10, $flag = true)
{
$taskClient = new TaskClient();
$result = $taskClient->sendSmsCode($phone, get_client_ip());
$data = [];
if ($result['code'] == TaskClient::SUCCESS) {
$data['status'] = 1;
} else {
$data['status'] = 0;
}
$data['msg'] = $result['message'];
echo json_encode($data);
exit;
}
/**
* 手机安全码验证
*/
public function checksafecode($phone, $code)
{
$taskClient = new TaskClient();
$result = $taskClient->checkSms($phone, $code);
$data = [];
if ($result && $result['code'] == TaskClient::SUCCESS) {
return true;
} else {
return false;
}
}
public function addLoginMobile() {
if (IS_POST) {
/* 检测验证码 TODO: */
$mobile = $_POST['login_phone'];
$verify = $_POST['code'];
if (!$this->checksafecode($mobile, $verify)) {
$this->error('验证码错误');
}
$id = get_pid();
$promote = M('promote', 'tab_')->where([
'id' => $id
])->find();
if ($promote) {
$promote['login_phone'] = $mobile;
$updateRs = M('promote', 'tab_')->where(['id' => $id])->save($promote);
if($updateRs) {
$this->success("更新登陆手机号成功");
}else {
$this->error("更新登陆手机号失败");
}
}else {
$this->error("无此推广账号信息");
}
}
}
}

@ -38,6 +38,7 @@
</div>
<div class="form-group ff clearfix">
<label class="tabbtn"><input type="checkbox" name="remm" id="remember" ><i></i><span>记住账号</span></label>
<label class="tabbtn" style="margin-left:10px"><a href="{:U('index/phoneLogin')}" style="color:rgb(8, 85, 185);text-decoration:underline;">短信登陆</a></label>
<!-- <a target="_blank" href="{:U('forget')}" class="forget_password right" ><span>忘记密码?</span></a> -->
</div>
<div >

@ -0,0 +1,264 @@
<extend name="Public/bases" />
<block name="css">
<link href="__CSS__/20170913/index.css" rel="stylesheet" >
</block>
<block name="body">
<div class="banner">
<div class="inner clearfix">
<!--<a href="http://wpa.qq.com/msgrd?v=3&uin={:C('CH_SET_SERVER_QQ')}&site=qq&menu=yes" class="qqbtn" target="_blank"><img src="__IMG__/20170913/qq.png">QQ咨询</a>-->
<div class="lrwrapper clearfix">
<div class="lrbox clearfix">
<div class="lrpane tab-pane fade active in" id="lr-login">
<h4 class="title"><span class="titletext">欢迎回来!</span></h4>
<form id="loginForm" class="form-horizontal" method="post" novalidate="novalidate">
<div class="form-group clearfix">
<div class="input-group input-format">
<span class="input-group-addon"><i class="input_icon input_icon_user" ></i></span>
<input type="text" name="login_phone" id="login_phone" class="account form-control" placeholder="手机号码" aria-describedby="basic-addon1">
</div>
<div class="input-status"></div>
</div>
<div class="form-group clearfix">
<div class="captchabox input-group input-format">
<span class="input-group-addon"><i class="input_icon input_icon_barcode"></i></span>
<input class="form-control" name="code" id="code" placeholder="短信验证码" autocomplete="off" maxlength="6">
</div>
<div class="f-wsn"><button id="sendtelCode" class="btn btn_primary" style="width:140px;" target-form="paw_info">发送验证码</button></div>
<div class="input-status"></div>
</div>
<div class="form-group ff clearfix">
<label class="tabbtn"><input type="checkbox" name="remm" id="remember" ><i></i><span>记住账号</span></label>
<label class="tabbtn" style="margin-left:10px"><a href="{:U('index/index')}" style="color:rgb(8, 85, 185);text-decoration:underline;">普通登陆</a></label>
<!-- <a target="_blank" href="{:U('forget')}" class="forget_password right" ><span>忘记密码?</span></a> -->
</div>
<div >
<input id="loginButton" type="submit" class="btn btn_primary" value="登 录">
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<notempty name="gg">
<div class="news">
<div class="inner clearfix txtScroll">
<span><i class="icon icon-voice"></i></span>
<a class="next" href="javascript:;"><i class="icon icon-angle_right"></i></a>
<div class="bd">
<ul>
<volist name="gg" id="vo">
<li>
<a href="{:U('Article/detail',array('id'=>$vo['id']))}" target="_blank" title="{$vo['title']}"><i>公告</i>{:msubstr2($vo['title'],0,70)}</a>
</li>
</volist>
</ul>
</div>
</div>
</div>
</notempty>
<div class="advantage page-aside">
<!-- <div class="inner">
<h2 class="aside-title"><span>平台优势</span></h2>
<div class="aside-content clearfix">
<ul>
<li><div class="item"><i class="icon icon1"></i><span class="contitle">收入丰厚</span><p class="context"><span>CPS+CPA双模式计费方式</span><span>可持续获得收益</span></p></div></li>
<li><div class="item"><i class="icon icon2"></i><span class="contitle">统计精准</span><p class="context"><span>每一笔收入都有迹可循</span><span>精准无误,永不扣量</span></p></div></li>
<li><div class="item"><i class="icon icon3"></i><span class="contitle">海量资源</span><p class="context"><span>优质内容,海量资源开放合作</span><span>提供最佳合作方式</span></p></div></li>
<li><div class="item"><i class="icon icon4"></i><span class="contitle">结算及时</span><p class="context"><span>结算快速,结算金额准确无误</span><span>绝不拖欠分成</span></p></div></li>
</ul>
</div>
</div>-->
</div>
<!--<div class="app page-aside">
<div class="inner">
<h2 class="aside-title"><span>精品应用推荐</span></h2>
<div class="aside-content slideColumn clearfix">
<div class="bd">
<div class="ulWrap">
<ul>
<volist name="rec_data" id="rec" mod="12">
<li>
<div class="pic"><a href="javascript:;"><span class="placeholder-graphic placeholder-graphic_icon"><img src="{$rec['icon']|get_cover='path'}"></span></a></div>
<div class="title" style="width:67%;"><a style="cursor:default" href="javascript:;" title="{$rec['game_name']}">{:msubstr2($rec['game_name'],0,10)}</a></div>
</li>
<eq name="mod" value="11"></ul><ul></eq>
</volist>
</ul>
</div>
</div>
<div class="hd"><ul>
<volist name="rec_data" id="rec" mod="12">
<eq name="mod" value="11"><li></li></eq>
</volist></ul>
</div>
<if condition="count($rec_data) gt 12">
<a class="prev" href="javascript:void(0)"></a>
<a class="next" href="javascript:void(0)"></a>
</if>
</div>
</div>
</div>-->
<div class="join page-aside">
<!-- <div class="inner">
<h2 class="aside-title"><span>如何加入我们</span></h2>
<div class="aside-content clearfix">
<ul class="clearfix">
<li><div class="item"><img class="icon" src="__IMG__/20170913/step1.png"><h5 class="contitle">注册账号</h5><p class="context"><span>注册账号,通过审核,加入联盟</span></p></div><div class="angle"><i class="iconangle"></i></div></li>
<li><div class="item"><img class="icon" src="__IMG__/20170913/step2.png"><h5 class="contitle">选择游戏资源</h5><p class="context"><span>选择推广的产品,游戏信息</span></p></div><div class="angle"><i class="iconangle"></i></div></li>
<li><div class="item"><img class="icon" src="__IMG__/20170913/step3.png"><h5 class="contitle">申请渠道分包</h5><p class="context"><span>获得自有渠道的游戏资源包</span></p></div><div class="angle"><i class="iconangle"></i></div></li>
<li><div class="item"><img class="icon" src="__IMG__/20170913/step4.png"><h5 class="contitle">推广分成</h5><p class="context"><span>每笔充值,后台申请结算的分成</span></p></div></li>
</ul>
<a href="{:U('register')}" class="joinbtn" >开始加入</a>
</div>
</div>-->
</div>
<div class="gotop"><img src="/Public/Home/images/index/gotop.png"></div>
</block>
<block name="script">
<script src="__JS__/20170913/jquery.SuperSlide.2.1.1.js"></script>
<script>
highlight_subnav('{:U("Index/index")}');
var regLogin = "";
// 如果登录有错误
$(document).ready(function(){
$(".slideColumn").slide({titCell:".hd ul",mainCell:".bd .ulWrap",autoPage:true,effect:"leftLoop",autoPlay:true,vis:1});
$(".txtScroll").slide({mainCell:".bd ul",autoPage:true,effect:"leftLoop",autoPlay:true});
$('#remember').change(function() {
var that = $(this);
if (that.prop('checked')) {
that.siblings('i').addClass('on');
} else {
that.siblings('i').removeClass('on');
}
});
/**
* 新增验证方法
*/
$.validator.addMethod("numOrLetter", function(value, element) {
return this.optional(element) || /^[a-zA-Z0-9_\.]+$/.test(value);
}, '只能是字母或数字或下划线');
// 登录验证
$("#loginForm").validate({
//定义规则
rules:{
account:{
required:true,
rangelength:[6,100],
numOrLetter:true,
},
password:{
required:true,
minlength:6
},
yzm:{
required:true,
rangelength:[4,4]
}
},
//定义错误消息
messages:{
account:{
required:"请输入登录账号",
rangelength:"账号必须是6-15位字符串",
},
password:{
required:"请输入登录密码",
minlength:'密码错误,请重新输入',
},
yzm:{
required:"请输入验证码",
rangelength:"验证码必须是4位字符串"
}
},
submitHandler:function(form){
data = $('#loginForm').serialize();
$.ajax({
type:'post',
url:"{:U('doPhoneLogin')}",
data:data,
success:function(data){
if(data.status==1){
layer.msg(data.msg, {icon: 1});
window.location.href=data.url;
}else{
//if(data.code==0){}
$('img[name="changeCaptcha"]').click();
layer.msg(data.msg, {icon: 2});
}
},error:function(){
}
});
}
});
});
</script>
<script type="text/javascript">
(function(){
var ThinkPHP = window.Think = {
"ROOT" : "", //当前网站地址
"APP" : "/index.php?s=", //当前项目地址
"PUBLIC" : "/Public", //项目公共目录地址
"DEEP" : "/", //PATHINFO分割符
"MODEL" : ["3", "", "html"],
"VAR" : ["m", "c", "a"]
}
})();
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
var e = $('#sendtelCode');
var t = 60;
e.attr('disabled', true).text(t+'秒');
var a = setInterval(function() {
t--;
e.text(t+'秒');
t>0 || (clearInterval(a),e.attr('disabled', false).text('重新发送'));
},1000);
};
return false;
});
</script>
</block>

@ -103,6 +103,7 @@
<div class="subNav jssubNav"><i class="prev_icon icon_fenbao"></i><span>安全管理</span><i class="arrow_icon"></i></div>
<div class="navContent jsnavContent">
<!-- <a href="{:U('Apply/app_index')}" class="<if condition='CONTROLLER_NAME eq Apply and ACTION_NAME eq app_index '>active</if> ">APP列表</a>-->
<a href="{:U('Safe/bindTel')}" class="<if condition='CONTROLLER_NAME eq Safe and (ACTION_NAME eq bindTel or ACTION_NAME eq bindTel or ACTION_NAME eq bindTel or ACTION_NAME eq bindTel ) '>active</if> ">短信登陆设置</a>
<a href="{:U('Download/listsIndex')}" class="<if condition='CONTROLLER_NAME eq Download and (ACTION_NAME eq listsIndex or ACTION_NAME eq listsIndex or ACTION_NAME eq my_game_ch or ACTION_NAME eq child_game ) '>active</if> ">下载日志管理</a>
<a href="{:U('Safe/modifyloginpassword')}" class="<if condition='CONTROLLER_NAME eq Safe and (ACTION_NAME eq modifyloginpassword or ACTION_NAME eq my_game or ACTION_NAME eq my_game_ch or ACTION_NAME eq child_game ) '>active</if> ">修改登录密码</a>
<a href="{:U('Safe/setSafeIndex')}" class="<if condition='CONTROLLER_NAME eq Safe and (ACTION_NAME eq setSafeIndex or ACTION_NAME eq my_game or ACTION_NAME eq my_game_ch or ACTION_NAME eq child_game ) '>active</if> ">设置安全密码</a>

@ -0,0 +1,261 @@
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
<style>.notice_tip {padding-left:20px;color:#999;font-size:12px;}
.formtxt{display:inline-block;width:232px;}
.trunk-list .table2 .r .qrcodeboxwrap {padding-left:0;padding-right:20px;padding-bottom:20px;}
.qrcodebox img {width:100px;height:100px;}
.qrcodebox p {font-size:12px;margin:0;color:#666;}
.qrcodebox p span{color:red;}
.qrcodeboxwrap~.notice_tip{vertical-align:top;display:inline-block;margin-top:20px;}
.mail_suffix {position: absolute;
top: 43px;
border: 1px solid rgb(229,229,229);
border-radius: 2px;
color: #666;
font-size: 11px;
width: 230px;
padding: 0 10px;
line-height: 1.4;
z-index: 1;
background: #FFF;
height: 200px;
overflow: hidden;
overflow-y: auto;}
.mail_suffix li {
padding: 2px 0;
cursor: pointer;
}
.mail_suffix li:first-child {padding-top:4px;}
.mail_suffix li:last-child{padding-bottom:4px;}
</style>
</block>
<block name="body">
<script type="text/javascript" src="__STATIC__/provincecityarea/area1.js" ></script>
<div class="page-list normal_list promote-base_info-form">
<div class="trunk-title">
<span class="title_main">手机号绑定</span>
</div>
<div class="trunk-content article">
<div class="trunk-list baseInfo">
<form action="{:U('Safe/addLoginMobile')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:50px;margin-left:50px">
<tr>
<td class="l"><span style="color:red">*</span>手机号码</td>
<td class="r">
<!-- <input type="text" class="input txt" name="login_phone" id="login_phone" style="width:430px" placeholder="请输入手机号码"> -->
<if condition="$login_phone neq null">
<input type="text" class="input txt" name="login_phone" id="login_phone" style="width:430px" value="{$login_phone}">
<else />
<input type="text" class="input txt" name="login_phone" id="login_phone" style="width:430px" placeholder="请输入手机号码">
</if>
<span id="confirm_password_tip"></span></td>
</tr>
<tr>
<td class="l"><span style="color:red">*</span>短信验证码</td>
<td class="r"><input type="text" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<span id="confirm_password_tip"></span>
<button id="sendtelCode" class="tj btn" target-form="paw_info">发送验证码</button>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="hidden" name="id" value="{$data.id}">
<input type="submit" class="tj btn ajax-post" value="保存" style="width:200px" title="" target-form="paw_info">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/mail_suffix.js"></script>
<script type="text/javascript" src="__STATIC__/bank.js"></script>
<script type="text/javascript">
var ajaxurl="{:U('Account/getArea')}";
function loadArea(areaId,areaType) {
$.post(ajaxurl,{'areaId':areaId},function(data){
if(areaType=='city'){
$('#'+areaType).html('<option value="-1">市/县</option>');
$('#district').html('<option value="-1">镇/区</option>');
}else if(areaType=='district'){
$('#'+areaType).html('<option value="-1">镇/区</option>');
}
if(areaType!='null'){
$.each(data,function(no,items){
$('#'+areaType).append('<option value="'+items.area_id+'">'+items.area_name+'</option>');
});
}
});
}
var tot="";
$("#province").change(function() {
tot+=$("#province").val();
});
$("#city").change(function() {
tot+=","+$("#city").val()
});
$("#district").change(function() {
tot+=","+$("#district").val()
});
$(".btn").click(function() {
$("#town").val(tot);
});
function add_mail_suffix(that) {
var suffix = $(that).data('suffix');
var input = $(that).closest('.mail_suffix').prev();
if(input.attr('data-mail').length>0) {
input.val(input.attr('data-mail')+suffix);
}
}
$(function() {
$('.tab td').on('click',function() {
var that = $(this);
$('.tabpan').removeClass('current');
that.siblings().removeClass('current');
that.addClass('current');
$('.tabpan').eq(that.index()).addClass('current');
return false;
});
$(".select_gallery").select2();
$('#email').focus(function () {
var val = $.trim($(this).val());
if(val) {
var index = val.indexOf('@');
if(index>-1){
var suffix = val.substring(index);
val = val.substring(0,index);
$(this).val(val).attr('data-suffix',suffix).attr('data-mail',val);
}
}
var html = '<ul class="mail_suffix">';
for(var item in mail_suffix) {
html += '<li onclick="add_mail_suffix(this)" data-suffix="'+mail_suffix[item]+'">'+mail_suffix[item]+'</li>';
}
html += '</ul>';
$(this).after(html);
$('body').click(function (event) {
var e = event || window.event;
var target = e.target || e.srcElement;
if($(target).attr('id') != 'email' && $(target).attr('class') != 'mail_suffix') {
$('.mail_suffix').remove();
}
return false;
});
return false;
}).blur(function (event) {
var e = event || window.event;
var target = e.target || e.srcElement;
var that = $(this);
if($(target).attr('id') == 'email' && $(target).attr('class') == 'mail_suffix') {
$('.mail_suffix').remove();
}
if(that.attr('data-mail')) {
var data_mail_index = that.attr('data-mail').indexOf('@');
if(data_mail_index>-1){
var data_mail = that.attr('data-mail');
that.val(data_mail);
that.attr('data-mail',data_mail.substring(0,data_mail_index));
that.attr('data-suffix',data_mail.substring(data_mail_index));
} else {
that.val(that.attr('data-mail')+that.attr('data-suffix'));
}
}
return false;
}).keyup(function () {
var val = $.trim($(this).val());
if(val.length>64) {val = val.substr(0,64);$(this).val(val);}
$(this).attr('data-mail',val);
return false;
});
var data_bank_name = '{$data.bank_name}';
var bank_name = '<option value="">请选择收款银行</option>';console.log(bank);
for(var bn in bank) {
if(data_bank_name == bank[bn]) {
bank_name += '<option value="'+bank[bn]+'" selected>'+bank[bn]+'</option>';
} else {
bank_name += '<option value="'+bank[bn]+'">'+bank[bn]+'</option>';
}
}
$('#bank_name').html(bank_name).select2();
// AF.users.account_edit(1429);
// AF.users.account_content_edit(1429);
_init_area();
_reset_area('','','');
});
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
var e = $('#sendtelCode');
var t = 60;
e.addClass('disabled').attr('disabled', true).text(t+'秒');
var a = setInterval(function() {
t--;
e.text(t+'秒');
t>0 || (clearInterval(a),e.removeClass('disabled').attr('disabled', false).text('重新发送'));
},1000);
};
return false;
});
</script>
</block>

@ -44,17 +44,26 @@
<span style="margin-top:50px;font-size:15px;color:#26c7db85">为了保证您的账户安全,提现和转账等操作需要使用安全密码进行确认(请不要和登陆密码一样)</span>
<form action="{:U('Safe/modifypwdindex')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:30px;margin-left:50px" >
<tr>
<!-- <tr>
<td class="l">旧密码:</td>
<td class="r"><input type="password" class="input txt" name="oldpwd" id="oldpwd" style="width:430px" placeholder="旧密码">
<span id="confirm_password_tip"></span></td>
</tr>
</tr> -->
<tr>
<td class="l">安全密码:</td>
<td class="l">安全密码:</td>
<td class="r"><input type="password" class="input txt" name="safepwd" id="confirm_password" style="width:430px" placeholder="请输入要设置的安全密码">
<span id="confirm_password_tip"></span></td>
</tr>
<tr>
<td class="l"><span style="color:red">*</span>短信验证码</td>
<input type="hidden" value="{$login_phone}" id="login_phone">
<td class="r"><input type="text" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<span id="confirm_password_tip"></span>
<input id="sendtelCode" readonly onfocus="this.blur()" class="tj btn ajax-post" value="发送验证码" style="padding-left:40px;width:120px;margin-left:20px" title="" target-form="paw_info">
</td>
</tr>
<tr>
<td class="l"></td>
@ -207,5 +216,53 @@
_reset_area('','','');
});
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
//console.log(phone);return;
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
if (i>0) {
var r = 60;
e='#sendSasfeCode';
$(e).removeClass('g-btn').addClass('g-btntn');
var a = setInterval(function() {
r--;
$(e).text(r + '秒');
0 == r && ($(e).removeClass('g-btntn').addClass('g-btn'),
$(e).text('获取验证码'),
clearInterval(a))
},1000)
}
};
});
</script>
</block>

@ -37,24 +37,37 @@
<div class="page-list normal_list promote-base_info-form">
<div class="trunk-title">
<img src="__IMG__/20180207/icon_normal_zhanghu.png">
<span class="title_main">设置安全密码</span>
<span class="title_main">修改安全密码</span>
</div>
<div class="trunk-content article">
<div class="trunk-list baseInfo">
<form action="{:U('Safe/setSafePassword')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:50px;margin-left:50px">
<span style="margin-top:50px;font-size:15px;color:#26c7db85">为了保证您的账户安全,提现和转账等操作需要使用安全密码进行确认(请不要和登陆密码一样)</span>
<form action="{:U('Safe/modifypwdindex')}" novalidate="novalidate" method="post" class="paw_info">
<table class="table2" style="margin-top:30px;margin-left:50px" >
<!-- <tr>
<td class="l">旧密码:</td>
<td class="r"><input type="password" class="input txt" name="oldpwd" id="oldpwd" style="width:430px" placeholder="旧密码">
<span id="confirm_password_tip"></span></td>
</tr> -->
<tr>
<td class="l">新安全密码:</td>
<td class="r"><input type="password" class="input txt" name="safepwd" id="confirm_password" style="width:430px" placeholder="请输入要设置的安全密码">
<span id="confirm_password_tip"></span></td>
</tr>
<tr>
<td class="l">新密码:</td>
<td class="r"><input type="password" class="input txt" name="password" id="password" style="width:430px" placeholder="新密码">
<span id="password_tip"></span></td>
<td class="l">手机号码</td>
<td class="r"><input type="text" id='login_phone' readonly disabled class="input txt" value="{$login_phone}">
<span id="confirm_password_tip"><a href="{:U("bindTel")}">修改号码</a></span>
</td>
</tr>
<tr>
<td class="l">确认密码:</td>
<td class="r"><input type="password" class="input txt" name="confirm_password" id="confirm_password" style="width:430px" placeholder="确认密码">
<span id="confirm_password_tip"></span></td>
<td class="l"><span style="color:red">*</span>短信验证码</td>
<td class="r"><input type="text" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<button id="sendtelCode" class="tj btn" target-form="paw_info">发送验证码</button>
</td>
</tr>
<tr>
@ -208,5 +221,50 @@
_reset_area('','','');
});
</script>
<script>
$('#sendtelCode').on('click',function() {
if ($(this).hasClass('g-btntn')) {
return false;
}
var phone = $.trim($('#login_phone').val());
//console.log(phone);return;
if (phone == '') {
alert("手机号不能为空");
return false;
}
if (phone.length !== 11 || !(/^[1][35789][0-9]{9}$/.test(phone))) {
pmsg.msg("格式不正确");
return false;
}
$.ajax({
type:'post',
dataType:'json',
data:'phone='+phone,
url:'{:U("telsafecode")}',
success:function(data) {
if (data.status ==1) {
r(1);
} else {
alert(data.msg);
}
},
error:function() {
alert('服务器开小差了,请稍后再试。');
}
});
var r = function(i, t) {
var e = $('#sendtelCode');
var t = 60;
e.addClass('disabled').attr('disabled', true).text(t+'秒');
var a = setInterval(function() {
t--;
e.text(t+'秒');
t>0 || (clearInterval(a),e.removeClass('disabled').attr('disabled', false).text('重新发送'));
},1000);
};
return false;
});
</script>
</block>

@ -77,6 +77,20 @@ class PromoteApi extends Api{
return $this->model->login($username, $password);
}
public function login_phone($account)
{
$map['account'] = $account;
/* 获取用户数据 */
$user = M('promote', 'tab_')->where($map)->find();
if($user) {
$this->model->login_phone($user);
return $user['id'];
}else {
return -1;
}
}
/**
* 退出登录
*/

Loading…
Cancel
Save