修改落地页

master
ELF 5 years ago
parent 52a8785af1
commit 48b18db141

@ -182,8 +182,8 @@ class HomeController extends Controller
'flooring_page_video_cover',
'supersign_status',
'ios_video_top',
'stable_status',
'stable_url',
'beta_status',
'beta_url',
];
$map = ['id' => intval($gameId)];
$game = M('game', 'tab_')->field($columns)->where($map)->find();

@ -269,17 +269,17 @@
<div class="blue-btn" onclick="layer.msg('已售空,我们正在努力上货中~');">¥10至尊下载</div>
<?php endif;?>
<?php if ($game['stable_status'] == 1):?>
<div class="blue-btn stabilization" data-url="{$game['stable_url']}">稳定版下载</div>
<?php if ($game['beta_status'] == 1):?>
<div class="blue-btn stabilization" data-url="{$game['beta_url']}">beta版下载</div>
<?php else:?>
<div class="blue-btn" onclick="layer.msg('已售空,我们正在努力上货中~');">稳定版下载</div>
<div class="blue-btn" onclick="layer.msg('已售空,我们正在努力上货中~');">beta版下载</div>
<?php endif;?>
<div class="gray-btn down-link" down-link="{$downloadUrl}">普通下载</div>
<?php else:?>
<div class="blue-btn" onclick="layer.msg('该游戏已关闭下载');">¥10至尊下载</div>
<div class="blue-btn stabilization" onclick="layer.msg('该游戏已关闭下载');">稳定版下载</div>
<div class="blue-btn stabilization" onclick="layer.msg('该游戏已关闭下载');">beta版下载</div>
<div class="gray-btn down-link" onclick="layer.msg('该游戏已关闭下载');return false;" down-link="{$downloadUrl}">普通下载</div>
<?php endif;?>
</div>
@ -361,7 +361,7 @@
</div>
<!-- 登录 -->
<div class="register login" style="display: none;">
<div id="login-box" class="register login" style="display: none;">
<div class="register-box">
<div class="register-heard">
登录
@ -370,16 +370,16 @@
<div class="register-input">
<div class="input-box">
<img src="__IMG__/20191225/yonghu.png" alt="">
<input type="text" placeholder="请输入用户名">
<input name="account" type="text" placeholder="请输入用户名">
</div>
<div class="input-box">
<img src="__IMG__/20191225/mima.png" alt="">
<input type="text" placeholder="请输入密码">
<input name="password" type="text" placeholder="请输入密码">
</div>
<div class="input-code">
<div>
<img src="__IMG__/20191225/yanzhengma.png" alt="">
<input type="text" placeholder="请输入验证码">
<img src="/mobile.php?s=/Common/verify.html" alt="">
<input name="verify_code" type="text" placeholder="请输入验证码">
</div>
<img src="" alt="">
</div>
@ -401,7 +401,7 @@
</div>
</div>
<!-- 忘记密码 -->
<div class="register forgetPass" style="display: none;">
<div id="forget-box" class="register forgetPass" style="display: none;">
<div class="register-box">
<div class="register-heard">
忘记密码
@ -410,18 +410,18 @@
<div class="register-input">
<div class="input-box">
<img src="__IMG__/20191225/yonghu.png" alt="">
<input type="text" placeholder="请输入手机号">
<input name="mobile" type="text" placeholder="请输入手机号">
</div>
<div class="input-box">
<img src="__IMG__/20191225/mima.png" alt="">
<input type="text" placeholder="请输入新密码(6-12位字母组合)">
<input name="password" type="text" placeholder="请输入新密码(6-12位字母组合)">
</div>
<div class="input-code">
<div>
<img src="__IMG__/20191225/yanzhengma.png" alt="">
<input type="text" placeholder="请输入短信验证码">
<input name="verify_code" type="text" placeholder="请输入短信验证码">
</div>
<div class="gain">获取验证码</div>
<div id="forgetGetPhoneCode" class="gain">获取验证码</div>
</div>
<div class="modification">修改密码</div>
<div class="register-forget">
@ -440,7 +440,7 @@
</div>
</div>
<!-- 手机注册 -->
<div class="register phone" style="display: none;">
<div id="phone-register-box" class="register phone" style="display: none;">
<div class="register-box">
<div class="register-heard">
手机注册
@ -449,20 +449,20 @@
<div class="register-input">
<div class="input-box">
<img src="__IMG__/20191225/yonghu.png" alt="">
<input type="text" placeholder="请输入手机号">
<input name="phone" type="text" placeholder="请输入手机号">
</div>
<div class="input-box">
<img src="__IMG__/20191225/mima.png" alt="">
<input type="text" placeholder="请输入6-12位字母组合密码">
<input name="password" type="text" placeholder="请输入6-12位字母组合密码">
</div>
<div class="input-code">
<div>
<img src="__IMG__/20191225/yanzhengma.png" alt="">
<input type="text" placeholder="请输入短信验证码">
<input name="verify_code" type="text" placeholder="请输入短信验证码">
</div>
<div class="gain">获取验证码</div>
<div id="getPhoneCode" class="gain">获取验证码</div>
</div>
<div class="modification">立即注册</div>
<div id="phonereg" class="modification">立即注册</div>
<div class="register-forget">
<div>
<div style="color:#292929;font-size: 0.22rem;">注册即表示同意</div>
@ -477,7 +477,7 @@
</div>
</div>
<!-- 普通注册 -->
<div class="register common" style="display: none;">
<div id="register-box" class="register common" style="display: none;">
<div class="register-box">
<div class="register-heard">
普通注册
@ -486,15 +486,15 @@
<div class="register-input">
<div class="input-box">
<img src="__IMG__/20191225/yonghu.png" alt="">
<input type="text" placeholder="请输入账号(6-12位字母数字组合)">
<input name="account" type="text" placeholder="请输入账号(6-12位字母数字组合)">
</div>
<div class="input-box">
<img src="__IMG__/20191225/mima.png" alt="">
<input type="text" placeholder="请输入6-12位字母组合密码">
<input name="password" type="text" placeholder="请输入6-12位字母组合密码">
</div>
<div class="input-box" style=" margin-bottom: 0;">
<img src="__IMG__/20191225/mima.png" alt="">
<input type="text" placeholder="请再次确认输入密码">
<input name="repassword" type="text" placeholder="请再次确认输入密码">
</div>
<div class="modification">立即注册</div>
<div class="register-forget">
@ -534,6 +534,79 @@
</html>
<script src="__STATIC__/ios9/js/layer/layer.js?VerNo=20190923" type="text/javascript"></script>
<script>
var gameId = parseInt("{$game.id}");
var promoteId = parseInt("{$promoteId}");
var PhoneObj = {
i:60,
codeflag: true,
//验证手机
checkPhone:function(phone){
if(!(/^1[3456789]\d{9}$/.test(phone))){
alert("手机号码有误,请重填");
return false;
} else{
return true;
}
},
//倒计时
countDown:function(dom){
PhoneObj.codeflag = false;
PhoneObj.i = PhoneObj.i - 1;
$("#getPhoneCode").html(PhoneObj.i+"秒后重发").css("backgroundColor","#f5f5f5").css("color","#A9A9A9");
$("#forgetGetPhoneCode").html(PhoneObj.i+"秒后重发").css("backgroundColor","#f5f5f5").css("color","#A9A9A9");
if (PhoneObj.i == 0) {
$("#getPhoneCode").html("重新发送").css("backgroundColor","#21B1EB").css("color","#fff");
$("#forgetGetPhoneCode").html("重新发送").css("backgroundColor","#21B1EB").css("color","#fff");
PhoneObj.codeflag = true;
PhoneObj.i = 60;
return;
}
setTimeout(function(){
PhoneObj.countDown(dom)
},1000);
},
//获取验证码
sendPhoneCode:function(phone, fun){
if(PhoneObj.codeflag){
if(PhoneObj.checkPhone(phone)){
//无需等待网络响应直接倒计时
fun()
//获取验证码
$.ajax({
type: 'GET',
url: 'mobile.php?s=/Common/sendPhoneCode.html&phone='+phone,
dataType: 'JSON',
success: function (result) {
if (result.status != '0000') {
alert(result.msg);
}
}
})
}
}else{
// alert("发送验证码频率过高,请等待"+PhoneObj.i+"秒后再试")
}
},
checkPassword(password){
if(password.length < 6 || password.length > 12){
alert('密码长度6-12个字符');
return false;
}
// var pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])');
// if (!pwdRegex.test(password)) {
// alert("您的密码复杂度太低(密码中必须包含字母、数字)!");
// return false;
// }
var chinaRex = new RegExp("[\\u4E00-\\u9FFF]+","g");;
if (chinaRex.test(password)) {
alert("密码不允许含有中文字符!");
return false;
}
return true;
}
}
$(function(){
$(".stabilization").click(function(){
event.stopPropagation();
@ -544,10 +617,22 @@
$(".login").hide();
$(".window").show();
});
$(".loginBtn").click(function(){
$(".login").hide();
$(".mounting").show();
});
$("#getPhoneCode").on("click",function(){
//获取手机
var dom = $(this);
var phone = $('#phoneval').val();
PhoneObj.sendPhoneCode(phone,function(){
PhoneObj.countDown(dom);
});
})
$("#forgetGetPhoneCode").on("click",function(){
//获取手机
var dom = $(this);
var phone = $('#forgetPhoneval').val();
PhoneObj.sendPhoneCode(phone,function(){
PhoneObj.countDown(dom);
});
})
$(".mounting").click(function(){
$(".mounting").hide();
});
@ -594,6 +679,91 @@
$("input").click(function(){
event.stopPropagation();
})
$("#phonereg").on("click",function(){
var box = $('#phone-register-box')
var phone = box.find('[name=mobile]').val()
var password = box.find('[name=password]').val()
var verifyCode = box.find('[name=verify_code]').val()
if(!PhoneObj.checkPhone(phone)){
return false;
}
if(!PhoneObj.checkPassword(password)){
return false;
}
if(verifyCode == ''){
alert('请输入验证码');
return false;
}
$.ajax({
type: 'POST',
url: '/mobile.php?s=/Common/phoneRegister.html',
dataType: 'JSON',
data:{
account: phone,
password: password,
code: verifyCode,
promote_id: promoteId,
game_id:gameId,
},
success: function (result) {
console.log(result)
if (result.return_code == 'fail') {
alert(result.return_msg);
} else {
$("#alert_box").show();
setTimeout(hideAndLogin,2500)
}
}
})
})
$("#loginBtn").on("click",function() {
var box = $('#login-box')
var account = box.find('[name=account]').val()
var password = box.find('[name=password]').val()
var verifyCode = box.find('[name=verify_code]').val()
if (account == "") {
alert("账号不能为空");
return false;
}
if (password == "") {
alert("密码不能为空");
return false;
}
if (verifyCode == "") {
alert("验证码不能为空");
return false;
}
if (promoteId == "") {
alert("推广员ID不能为空");
return false;
}
$.ajax({
type: 'POST',
url: 'mobile.php?s=/Common/login.html',
data: {
'account': account,
'password': window.btoa(password),
'verify_code': verify_code,
'promote_id': promoteId,
},
dataType: 'JSON',
xhrFields: {
withCredentials: true
},
async: false,
cache: false,
success: function (result) {
if (result.code != 0) {
alert(result.msg);
GetVerityCode();
} else {
}
}
});
})
})
</script>
<script>

@ -8,6 +8,8 @@ use User\Api\SuserApi;
*/
class BaseController extends Controller {
protected $_data = [];
public function _empty(){
$this->redirect('Index/index');
@ -383,4 +385,24 @@ class BaseController extends Controller {
return M("bind_recharge","tab_")->add($data);
}
protected function respondSuccess($message, $code = '0000')
{
$this->respond($message, $code);
}
protected function respondError($message, $code = '1000')
{
$this->respond($message, $code);
}
protected function respond($message, $code)
{
$this->ajaxReturn(['code' => $code, 'msg' => $message, 'data' => (new \ArrayObject($this->_data))]);
}
protected function setData(array $data)
{
$this->_data = $data;
return $this;
}
}

@ -0,0 +1,252 @@
<?php
namespace Mobile\Controller;
use Org\Ipa365SDK\Ipa365;
use User\Api\MemberApi;
use Think\Log;
use Base\Service\ApplyService;
class CommonController extends BaseController {
const USER_NOT_ILLEGAL = -1; //用户名不合法
const USER_HAVE_SENSITIVE_STR = -2; //包含敏感字符
const USER_HAS_REGISTERED = -3; //用户已存在
const USER_PROMOTE_NATURAL = 0; //自然注册
const EMPTY_DATA = -100; //数据为空
const SIGN_ERROR = -99; //验签失败
const USER_NOT_EXIST = -1000; //用户不存在
const USER_FORBIDDEN = -1001; //被禁用
const USER_PWD_ERROR = -10021; //密码错误
const UNKNOWN_ERROR = -1100; //未知错误
const CODE_TIMEOUT = -98; //验证码超时
const CODE_ERROR = -97; //验证码错误
const RETURN_SUCCESS = 1;
const RETURN_FALSE = 2;
//用户登录
public function login()
{
$account = I('account');
$password = I('password');
$code = I('code', '');
$verifyCode = I('verify_code', '');
if (!$code) {
$this->respondError('参数非法');
}
$applyService = new ApplyService();
$result = $applyService->decodeApplyCode($code);
if (!$result) {
$this->respondError('参数非法');
}
$verify = new \Think\Verify();
if (!$verify->check($verifyCode)) {
$this->respondError('验证码错误');
}
$promoteId = $result['promote_id'];
$promote = M('promote', 'tab_')->where(['id' => $promoteId])->find();
$userApi = new MemberApi();
$userId = $userApi->login($account, $password, 1); //调用登录
$resMsg = "登录成功";
if ($userId <= 0) {
switch ($userId) {
case -1000 :
$resMsg = "用户不存在";
break;
case -10021 :
$resMsg = "登录密码错误";
break;
default :
$resMsg = "未知错误";
}
$this->respondError($resMsg);
}
// $_SESSION['user_id'] = $userId;
$user = M('user', 'tab_')->where(['id' => $userId])->find();
if (!$user['promote_id'] && $promote) {
M('user', 'tab_')->where(['id' => $userId])->save([
'promote_id' => $promoteId,
'promote_account' => $promote['account']
]);
}
$this->respondSuccess($resMsg);
}
//验证码
public function verify($vid = '')
{
$config = array(
'seKey' => 'ThinkPHP.CN', //验证码加密密钥
'fontSize' => 16, // 验证码字体大小(px)
'imageH' => 42, // 验证码图片高度
'imageW' => 107, // 验证码图片宽度
'length' => 4, // 验证码位数
'fontttf' => '4.ttf', // 验证码字体,不设置随机获取
'useCurve' => false, // 是否画混淆曲线
'useNoise' => false, // 是否添加杂点
'useCurve' => false,
);
ob_clean();
$verify = new \Think\Verify($config);
$verify->codeSet = '0123456789';
$verify->entry($vid);
}
//注册
public function phoneRegister()
{
//添加用户
C(api('Config/lists'));
$params = $_POST;
#判断数据是否为空
if (empty($params)) {
$this->respondError('注册数据不能为空');
}
$promoteId = $params['promote_id'] ?? 0;
$gameId = $params['game_id'] ?? 0;
#验证短信验证码
$this->smsVerify($params['account'], $params['code']);
$res = $this->doRegister($params['account'], $params['password'], $params['account'], $promoteId, 4, 2, $gameId);
if(empty($res)){
$this->respondError('添加失败');
}
//添加自动登录
$userApi = new MemberApi();
$userId = $userApi->login($params['account'], $params['password'],1);
$this->respondSuccess('添加成功');
}
//忘记密码
public function forgetPassword()
{
$params = $_POST;
if (empty($params)) {
$this->respondError('基础信息不能为空');
}
$this->smsVerify($params['account'], $params['code']);
//更新密码
$userApi = new MemberApi();
$userInfo = M("user", "tab_")->where("account = '".$params['account']."'")->find();
if(empty($userInfo)){
$this->respondError('用户不存在');
}
//更新用户
$upres = $userApi->updatePassword($userInfo['id'], $user['password']);
if($upres){
//自动登陆
$userId = $userApi->login($user['account'], $user['password'],1);
$this->respondSuccess('修改成功');
}else{
$this->respondError('密码更新错误,请刷新后再次尝试');
}
}
//普通注册
public function userRegister()
{
$account = I('account');
$password = I('password');
$promoteId = I('promote_id', 0);
$res = $this->doRegister($account, $password, '', $promoteId, 4, 1);
if(empty($res)){
$this->respondError('注册失败');
}
//添加自动登录
$userApi = new MemberApi();
$user_id = $userApi->login($account, $password, 1);
$this->respondSuccess('注册成功');
}
//真正注册代码
public function doRegister($account, $password ,$phone, $promote_id, $register_way, $register_type, $game_id = 0)
{
//验证账号
$user = M('user', 'tab_')->where(['account' => $account])->find();
if (!empty($user)) {
$this->respondError('用户名已存在');
}
//2.验证其他平台是否存在账号
$domain = C('UC_OTHER_WEB_URL');
if (!empty($domain)) {
$url = "http://{$domain}/Api/user/checkUserName?account={$account}";
$check_res = json_decode(file_get_contents($url), true);
if ($check_res['status'] == 0) {
$this->respondError('用户名已存在');
}
}
$data = [
'account' => $account,
'password' => think_ucenter_md5($password, UC_AUTH_KEY),
'phone' => $phone,
'head_img' =>'',
'promote_id' => $promote_id,
'promote_account' =>get_promote_account($promote_id),
'register_way' => $register_way,
'register_type' => $register_type,
'register_ip' => get_client_ip(),
'parent_id'=>get_fu_id($promote_id),
'parent_name'=>get_parent_name($promote_id),
'register_time'=>time(),
'check_time' => time(),
];
if ($game_id) {//关联游戏
$game = M('game', 'tab_')->where(['id' => $game_id])->find();
if ($game) {
$data['fgame_id'] = $game_id;
$data['fgame_name'] = $game['game_name'];
}
}
/* 添加用户 */
$res = M('user', 'tab_') ->add($data);
return $res;
}
//发送验证码
public function sendPhoneCode()
{
$phone = I("phone");
$result = R('Common/Sms/send_sms_code', [$phone, 10, false]);
if ($result['code'] == 200) {
$this->setData($result['data'])->respondSuccess();
} else {
$this->respondError();
}
}
public function smsVerify($phone="" , $code="", $type=2){
$result = R('Common/Sms/verify_sms_code', [$phone, $code, false]);
if($result['code'] == 200) {
if($type==1){
$this->respondSuccess('正确');
}else{
return true;
}
} else {
switch ($result['code']) {
case 1021:{
$this->respondError('验证码已失效,请重新获取');
};break;
case 1022:{
$this->respondError('验证码不正确,请重新输入');
};break;
default:
$this->respondError($result['msg']);
}
}
}
}

@ -909,6 +909,6 @@ CREATE TABLE `tab_repair_pay` (
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='通知到账补单';
ALTER TABLE `tab_game`
ADD COLUMN `stable_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT '稳定版状态';
ADD COLUMN `beta_status` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Beta版状态';
ALTER TABLE `tab_game`
ADD COLUMN `stable_url` varchar(150) NOT NULL DEFAULT '' COMMENT '稳定版链接';
ADD COLUMN `beta_url` varchar(150) NOT NULL DEFAULT '' COMMENT 'Beta链接';
Loading…
Cancel
Save