master
sunke 5 years ago
parent ae4ca9020b
commit a29365fed8

@ -14,6 +14,7 @@ use OT\DataDictionary;
use User\Api\PromoteApi; use User\Api\PromoteApi;
use Home\Controller\DownController; use Home\Controller\DownController;
use Base\Tool\TaskClient;
/** /**
* 前台首页控制器 * 前台首页控制器
@ -74,6 +75,12 @@ class IndexController extends HomeController
$map['account'] = $account; $map['account'] = $account;
$data['last_login_time'] = time(); $data['last_login_time'] = time();
M("promote", "tab_")->where($map)->save($data); 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'))); $this->ajaxReturn(array("status" => 1, "msg" => "登录成功", 'url' => U('Promote/index')));
} else { } else {
$msg = ""; $msg = "";
@ -99,6 +106,25 @@ class IndexController extends HomeController
} }
} }
public function doPhoneLogin($mobile = null, $verify = null) {
if (!$this->checksafecode($mobile, $verify)) {
$this->error('验证码错误');
}
$promote = M('promote', 'tab_')->where([
'login_phone' => $mobile,
])->find();
if($promote) {
$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);
setcookie('login_phone', $mobile, time() + 3600 * 10000, $_SERVER["HTTP_HOST"]);
$this->success('登录成功!', U('Promote/index'));
}
}
/* public function register() /* public function register()
{ {
if (IS_POST) { if (IS_POST) {
@ -291,4 +317,41 @@ class IndexController extends HomeController
$Promote->logout(); $Promote->logout();
redirect(U('Index/index')); 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; namespace Home\Controller;
use Think\Controller; use Think\Controller;
use Base\Repository\PromoteRepository; use Base\Repository\PromoteRepository;
use Base\Tool\TaskClient;
/** /**
* 扩展控制器 * 扩展控制器
@ -559,4 +560,71 @@ class SafeController extends BaseController{
$this->ajaxReturn(['code'=>0000,'mes'=>'删除成功']); $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($mobile = null, $verify = null) {
if (IS_POST) {
/* 检测验证码 TODO: */
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>
<div class="form-group ff clearfix"> <div class="form-group ff clearfix">
<label class="tabbtn"><input type="checkbox" name="remm" id="remember" ><i></i><span>记住账号</span></label> <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> --> <!-- <a target="_blank" href="{:U('forget')}" class="forget_password right" ><span>忘记密码?</span></a> -->
</div> </div>
<div > <div >

@ -0,0 +1,267 @@
<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"><input type="submit" id="sendtelCode" class="btn btn_primary" value="发送验证码" style="width:130px;margin-left:20px" title="" target-form="paw_info"> </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('login')}",
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) {
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>

@ -0,0 +1,265 @@
<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="password" class="input txt" name="code" id="code" style="width:230px" placeholder="请输入短信验证码">
<span id="confirm_password_tip"></span>
<input type="submit" id="sendtelCode" class="tj btn ajax-post" value="发送验证码" style="width:130px;margin-left:20px" title="" target-form="paw_info">
</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() {
alert('vdvd')
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) {
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>
Loading…
Cancel
Save