Merge remote-tracking branch 'origin/dev' into dev

master
liuweiwen 5 years ago
commit 4f96c4728d

@ -241,6 +241,7 @@ class FinancePromoteController extends AdminController
foreach($senddata as $k=>$v){
if(empty($v['company_name'])) $v['company_name']= "万盟天下科技";
if(empty($v['promote_account'])) $v['promote_account']= "官方渠道";
if(!array_key_exists('cash_count',$v)) $v['cash_count']=0;
if(!array_key_exists('balance_coin_count',$v)) $v['balance_coin_count']=0;
if(!array_key_exists('bind_coin_count',$v)) $v['bind_coin_count']=0;

@ -810,7 +810,8 @@ class PayChannelController extends ThinkController
if (!empty($_REQUEST['user_account'])) {
$map['user_account'] = array('like',"{$_REQUEST['user_account']}%");
}
$map['pay_status'] = $coinMap['tab_deposit.pay_status'] = 1;
$map['pay_way'] = array('egt',1);
$model = $_REQUEST['model']?$_REQUEST['model']:'spend';
$data = [];
@ -833,6 +834,12 @@ class PayChannelController extends ThinkController
}
$coinMap = $map;
$coinMap['tab_deposit.pay_status'] = 1;
$coinMap['tab_deposit.pay_way'] = $map['pay_way'];
unset($coinMap['pay_status']);
unset($coinMap['pay_way']);
if ($map['pay_time']) {
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
unset($coinMap['pay_time']);
@ -924,6 +931,9 @@ class PayChannelController extends ThinkController
$map['game_id'] = $_REQUEST['game_id'];
}
$map['tab_game_supersign.pay_status'] = $map['pay_status'];
unset($map['pay_status']);
$data = M('game_supersign','tab_')
->field("order_id as pay_order_number,trade_id as order_number,account as user_account,pay_time,game_name,pay_price as cost,pay_price as pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_game_supersign.user_id=tab_test_white_list.user_id')
@ -959,7 +969,7 @@ class PayChannelController extends ThinkController
->order('tab_game_supersign.id DESC')
->count();
$field = "pay_price as cost,sum(pay_price) as pay_amount,pay_way";
$field = "sum(pay_price) as cost,sum(pay_price) as pay_amount,pay_way";
} elseif($model == 'deposit') {
$map['pay_source'] = 0;
if ($map['pay_time']) {
@ -1000,7 +1010,7 @@ class PayChannelController extends ThinkController
->order('tab_deposit.id DESC')
->count();
$field = "pay_amount as cost,sum(pay_amount) as pay_amount,pay_way";
$field = "sum(pay_amount) as cost,sum(pay_amount) as pay_amount,pay_way";
}
$sumAllData = M($model,'tab_')
@ -1099,6 +1109,8 @@ class PayChannelController extends ThinkController
$map['user_account'] = array('like',"{$_REQUEST['user_account']}%");
}
$map['pay_status'] = $coinMap['tab_deposit.pay_status'] = 1;
$map['pay_way'] = array('egt',1);
$model = $_REQUEST['model']?$_REQUEST['model']:'spend';
$data = [];
@ -1141,6 +1153,13 @@ class PayChannelController extends ThinkController
$coinMap = $map;
$coinMap['tab_deposit.pay_status'] = 1;
$coinMap['tab_deposit.pay_way'] = $map['pay_way'];
unset($coinMap['pay_status']);
unset($coinMap['pay_way']);
if($map['pay_time']) {
$coinMap['tab_deposit.create_time'] = $map['pay_time'];
unset($coinMap['pay_time']);
@ -1254,6 +1273,9 @@ class PayChannelController extends ThinkController
$map['game_id'] = $_REQUEST['game_id'];
}
$map['tab_game_supersign.pay_status'] = $map['pay_status'];
unset($map['pay_status']);
$accessNum = M('game_supersign','tab_')
->field("order_id as pay_order_number,trade_id as order_number,account as user_account,pay_time,game_name,pay_price as cost,pay_price as pay_amount,pay_way as pay_type,pay_way")
->join('inner join tab_test_white_list on tab_game_supersign.user_id=tab_test_white_list.user_id')

@ -169,10 +169,10 @@
<!-- onclick="showWindow({$data.game_id})"-->
{$data['pay_amount']}</td>
<td >{$data['platform_coin']}</td>
<td ><a href="{:U('PayChannel/testDetail',array_merge(array('game_id'=>$data['game_id'],'game_name'=>$data['game_name']),I('get.')))}" style="display:block;">{$data['test_coin']}</a></td>
<td ><a href="{:U('PayChannel/testDetail',array_merge(array('game_id'=>$data['game_id'],'game_name'=>$data['game_name']),I('get.'),['p'=>1]))}" style="display:block;">{$data['test_coin']}</a></td>
<td >{$data['sum']}</td>
<td >
<a href="{:U('PayChannel/gameDetail',array_merge(array('game_id'=>$data['game_id'],'game_name'=>$data['game_name'].'游戏'),I('get.')))}" >订单查看</a>
<a href="{:U('PayChannel/gameDetail',array_merge(array('game_id'=>$data['game_id'],'game_name'=>$data['game_name'].'游戏'),I('get.'),['p'=>1]))}" >订单查看</a>
</td>
</tr>
</volist>
@ -180,20 +180,20 @@
<td><span>超级签</span></td>
<td ><span><if condition="$superSignData.pay_amount neq ''">{$superSignData['pay_amount']}<else/>0</if></span></td>
<td>0</td>
<td><span><a href="{:U('PayChannel/testDetail',array_merge(array('model'=>'game_supersign','game_name'=>'超级签'),I('get.')))}" style="display:block;"><if condition="$superSignData.test_coin neq ''">{$superSignData.test_coin}<else/>0</if></a></span></td>
<td><span><a href="{:U('PayChannel/testDetail',array_merge(array('model'=>'game_supersign','game_name'=>'超级签'),I('get.'),['p'=>1]))}" style="display:block;"><if condition="$superSignData.test_coin neq ''">{$superSignData.test_coin}<else/>0</if></a></span></td>
<td><if condition="$superSignData.pay_amount neq ''">{$superSignData['sum']}<else/>0</if></td>
<td>
<a href="{:U('SuperStatistical/index',array_merge(array('model'=>'game_supersign','game_name'=>'超级签'),I('get.')))}" >订单查看</a>
<a href="{:U('SuperStatistical/index',array_merge(array('model'=>'game_supersign','game_name'=>'超级签'),I('get.'),['p'=>1]))}" >订单查看</a>
</td>
</tr>
<tr>
<td><span>官网</span></td>
<td >{$offcialData['pay_amount']}</td>
<td>0</td>
<td><a href="{:U('PayChannel/testDetail',array_merge(array('model'=>'deposit','game_name'=>'官网'),I('get.')))}" style="display:block;"><if condition="$offcialData.test_coin neq ''">{$offcialData.test_coin}<else/>0</if></a></td>
<td><a href="{:U('PayChannel/testDetail',array_merge(array('model'=>'deposit','game_name'=>'官网'),I('get.'),['p'=>1]))}" style="display:block;"><if condition="$offcialData.test_coin neq ''">{$offcialData.test_coin}<else/>0</if></a></td>
<td><if condition="$offcialData.pay_amount neq ''">{$offcialData['sum']}<else/>0</if></td>
<td>
<a href="{:U('PayChannel/gameDetail',array_merge(array('id'=>21,'model'=>'deposit','game_name'=>'官网'),I('get.')))}" >订单查看</a>
<a href="{:U('PayChannel/gameDetail',array_merge(array('id'=>21,'model'=>'deposit','game_name'=>'官网'),I('get.'),['p'=>1]))}" >订单查看</a>
</td>
</tr>
<tr>
@ -203,7 +203,7 @@
<td>0</td>
<td><if condition="$spreadData['pay_amount'] neq ''">{$spreadData['sum']}<else/>0</if></td>
<td>
<a href="{:U('PayChannel/gameDetail',array_merge(array('id'=>21,'model'=>'coin_pay_order','game_name'=>'推广后台'),I('get.')))}" >订单查看</a>
<a href="{:U('PayChannel/gameDetail',array_merge(array('id'=>21,'model'=>'coin_pay_order','game_name'=>'推广后台'),I('get.'),['p'=>1]))}" >订单查看</a>
</td>
</tr>
<tr>

@ -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,21 +370,21 @@
<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="password" placeholder="请输入密码">
</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>
<img src="" alt="">
<img id="verifyCode" src="/mobile.php?s=/Common/verify.html" alt="">
</div>
<div class="register-btn">
<div class="loginBtn">登录</div>
<div id="loginBtn" class="loginBtn">登录</div>
<div class="enroll">注册</div>
</div>
<div class="register-forget" style="width: 4.6rem;">
@ -394,14 +394,14 @@
</div>
<div>
<img src="__IMG__/20191225/kefu.png" alt="">
<span>联系客服</span>
<span class="service_qq">联系客服</span>
</div>
</div>
</div>
</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,20 +410,20 @@
<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="password" 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 id="modify-password" class="modification">修改密码</div>
<div class="register-forget">
<div>
<div>
@ -433,14 +433,14 @@
</div>
<div>
<img src="__IMG__/20191225/kefu.png" alt="">
<span>联系客服</span>
<span class="service_qq">联系客服</span>
</div>
</div>
</div>
</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="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="password" 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="mobile-reg" 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,17 +486,17 @@
<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="password" 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="password" placeholder="请再次确认输入密码">
</div>
<div class="modification">立即注册</div>
<div id="normal-reg" class="modification">立即注册</div>
<div class="register-forget">
<div>
<div style="color:#292929;font-size: 0.22rem;">注册即表示同意</div>
@ -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 = $('#phone-register-box').find('[name=mobile]').val();
PhoneObj.sendPhoneCode(phone,function(){
PhoneObj.countDown(dom);
});
})
$("#forgetGetPhoneCode").on("click",function(){
//获取手机
var dom = $(this);
var phone = $('#forget-box').find('[name=mobile]').val();
PhoneObj.sendPhoneCode(phone,function(){
PhoneObj.countDown(dom);
});
})
$(".mounting").click(function(){
$(".mounting").hide();
});
@ -594,6 +679,191 @@
$("input").click(function(){
event.stopPropagation();
})
$(".service_qq").on("click",function(){
window.location.href = 'mqqwpa://im/chat?chat_type=wpa&uin={$serviceQQ}&version=1&src_type=web&web_src=oicqzone.com';
})
$('#verifyCode').on({
click: function () {
GetVerityCode()
}
})
function GetVerityCode() {
//刷新验证码
$("#verifyCode").attr("src", "/mobile.php?s=/Common/verify.html&id=" + Math.random());
}
$("#mobile-reg").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': verifyCode,
'promote_id': promoteId,
},
dataType: 'JSON',
xhrFields: {
withCredentials: true
},
async: false,
cache: false,
success: function (result) {
if (result.code != 0) {
alert(result.msg);
GetVerityCode();
} else {
}
}
});
})
//普通注册
$("#normal-reg").on("click", function(){
var box = $('#register-box')
var account = box.find('[name=account]').val()
var password = box.find('[name=password]').val()
var repassword = box.find('[name=repassword]').val()
var verifyCode = box.find('[name=verify_code]').val()
var pwdRegex = new RegExp('(?=.*[0-9])(?=.*[a-zA-Z])');
if(account.length < 6 || account.length > 15){
alert('账号长度必须是6-15位');
return false;
}
if (!pwdRegex.test(account)) {
alert("账号必须是6-15位字母数字组合");
return false;
}
if(password.length < 6 || password.length > 12){
alert('密码长度6-12个字符');
return false;
}
if(password != repassword){
alert('两次密码不一样');
return false;
}
$.ajax({
type: 'POST',
url: 'mobile.php?s=/Common/userRegister.html',
dataType: 'JSON',
data:{
account: account,
password: password,
promote_id: promoteId
},
success: function (result) {
if (result.return_code == 'fail') {
alert(result.return_msg);
} else {
//成功
$("#alert_box").show();
setTimeout(hideAndLogin,2500)
// alert("注册并登陆成功");
// window.location.href = "mobile.php?s=/Ssg/index.html"
}
}
})
})
//忘记密码
$("#modify-password").on("click",function(){
var box = $('#forget-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/forgetPassword.html',
dataType: 'JSON',
data:{
account: phone,
password: password,
verify_code: verifyCode
},
success: function (result) {
console.log(result)
if (result.return_code == 'fail') {
alert(result.return_msg);
} else {
$("#alert_content").html("密码修改成功,系统将在三秒后自动登录");
$("#alert_box").show();
setTimeout(hideAndLogin,2500)
}
}
})
})
})
</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,246 @@
<?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');
$verifyCode = I('verify_code', '');
$promoteId = I('promote_id', 0);
if (!$promoteId) {
$this->respondError('参数非法');
}
$verify = new \Think\Verify();
if (!$verify->check($verifyCode)) {
$this->respondError('验证码错误');
}
$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['verify_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['verify_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