Commit 6eb65ef8 authored by houdong's avatar houdong

有奖赛加钱包

parent 841f2d45
......@@ -1217,7 +1217,57 @@ class IndexAction extends IdentityAction {
}
public function jiang(){
$userId = $this->user['userID'];
$userName = $this->user['userName'];
$wallet=M('Wallet')->where(['user_id'=>$userId])->find();
$this->assign('wallet',$wallet);
$dsStatus=[];
$ids = D('Group')->getGroupCache($userId);
//中金大赛
$bmData=M('Zhongjin')->where(['user_id'=>$userId])->order('add_time desc')->find();
$dsStatus['zjStatus']=$bmData['status']==1?1:0;
//炼股赛
$dsStatus['qmStatus']=in_array(PRIZE_GROUP_2021,$ids)?1:0;
//初级小白
$bmData=M('Baoming')->where(['user_id'=>$userId,'status'=>['in',[1,6]],'group_id'=>NIU_BAI_ID])->find();
$dsStatus['nbStatus']=empty($bmData)?0:1;
//黑马特训营
$bmData=M('Baoming')->where(['user_id'=>$userId,'status'=>['in',[1,6]],'group_id'=>NIU_STRONG_ID])->find();
$dsStatus['hmStatus']=empty($bmData)?0:1;
//横盘突破
$bmData=M('Baoming')->where(['user_id'=>$userId,'status'=>['in',[1,6]],'group_id'=>HPTP_ID])->find();
$dsStatus['hpStatus']=empty($bmData)?0:1;
//获奖心得
$where = ['think' => ['exp', 'is not null and think != ""']];
$thinks = M('PktopUserphb')->where($where)->order('month desc')->limit(10)->select();
$this->assign('thinks',$thinks);
$this->assign('weixin', 'cofool001');
$this->assign('weixinUrl', 'https://eturl.cn/Rhq2wA?is_head=1');
//参赛总人数
$where=['group_id' => ['in',[ZHONGJIN_GROUP,PRIZE_GROUP_2021,NIU_BAI_ID,NIU_STRONG_ID,HPTP_ID]]];
$userNum = M('Group')->where($where)->cache(true,60*5)->sum('member_quantity');
$this->assign('userNum',$userNum);
$this->display();
}
//手机号登录
public function telLogin(){
$mobile = I('mobile', '');
$smsCode = I('smsCode', '');
$return=D('Passport')->telLogin($mobile,$smsCode,80);
if($return['status']==2){
$this->ajaxReturn($return);
}
$this->ajaxReturn(['status' =>1]);
}
}
......
......@@ -113,10 +113,7 @@ class PublicAction extends Action {
$this->ajaxReturn(array('status'=>0,'info'=>'','userType'=>$userType));
}
}
$this->ajaxReturn(array(
'status'=>1,
'info'=>'短信发送异常,请联系客服人员'
));
$this->ajaxReturn(['status'=>1,'info'=>'短信发送异常,请联系客服人员']);
}
}
......
......@@ -7,14 +7,12 @@ class PassportModel extends Model{
public $tableName = '';
public $config = '';
function __construct()
{
function __construct() {
//parent::__construct();
$this->config = C('AUTH_CONFIG');
}
function authUrl($flag,$act='login',$gourl='',$parse='')
{
function authUrl($flag,$act='login',$gourl='',$parse='') {
if(!$this->checkFlag($flag)) return false;
$_SESSION['state'] = $state = md5(uniqid(rand(), TRUE)); //CSRF protection
$parse = $parse.($parse ? '&':'').($gourl ? "gourl=$gourl" : '');
......@@ -45,8 +43,7 @@ class PassportModel extends Model{
header("Location:$login_url");
}
function checkFlag($flag)
{
function checkFlag($flag) {
if (!$flag||!in_array($flag,array('qq','sina'))) {
$this->errorMsg = array('error_code'=>'0001','error'=>'参数错误',);
return FALSE;
......@@ -54,8 +51,7 @@ class PassportModel extends Model{
return true;
}
function getInfo($flag)
{
function getInfo($flag) {
if(!$this->checkFlag($flag)) return false;
//if($_REQUEST['state'] != $_SESSION['state']){//csrf为了保证传入传出一致,安全考虑需保留
// exit("The state does not match. You may be a victim of CSRF.");
......@@ -66,8 +62,7 @@ class PassportModel extends Model{
return $data;
}
function sinaProcess()
{
function sinaProcess() {
Vendor('Oauth.sina','','.class.php');
//用户未授权
if(!$_SESSION['sina_access_token']){
......@@ -102,8 +97,8 @@ class PassportModel extends Model{
unset($info);
return $result;
}
function qqProcess()
{
function qqProcess() {
Vendor('Oauth.qq','','.class.php');
$qc = new Oauth($this->config['qq']);
......@@ -159,8 +154,6 @@ class PassportModel extends Model{
unset($info);
return $result;
}
function isNick($nick) {
$strlen = Misc::strLength($nick);
......@@ -178,9 +171,70 @@ class PassportModel extends Model{
* @access public
* @return str
*/
function error()
{
function error() {
return $this->errorMsg;
}
//报名大赛
public function telLogin($mobile,$smsCode,$smsType=44){
if (!$smsCode) {
return ['status' =>2, 'info' => '请输入手机验证码!'];
}
$map=['mobile'=>$mobile,'code'=>$smsCode,'type'=>$smsType,'add_time'=>['gt',NOW_TIME-1800]];
$row = M('Sms')->where($map)->find();
if(empty($row)){
$this->ajaxReturn(array('status'=>2,'info'=>'验证码失效或者错误!'));
}
$ucUser = uc_get_user(['token' => $mobile]);
//没有该用户,开始注册,status0有该用户,111表示用户不存在
if($ucUser['status']==111){
$ucData=$this->userReg($mobile);
if(!$ucData['user_id']){
return ['status' => 2, 'info' => '注册失败'];
}
}else{
$ucData=$ucUser['data'];
}
$userId=$ucData['user_id'];
$userName=$ucData['user_name'];
$this->setLogin(['userID'=>$userId,'userName'=>$userName]);
uc_user_synlogin(['userId'=>$userId,'userName'=>$userName,'webId'=>$ucData['web_id']]);
return ['status' => 1,'info'=>'登录成功','userId'=>$userId,'userName'=>$userName];
}
//注册
public function userReg($mobile){
$userName = randUsername('股神',$mobile);
$password = substr(md5($userName), 18);
$regData=['userName'=>$userName,'password'=>$password,'ip'=>get_client_ip(),
'mobile'=>$mobile,'mobile_status'=>1,'psourse' =>'www','sourse' =>'zcguanfang'];
$uc = uc_user_register($regData);
//status0是注册成功
if ($uc['status']) {
return (['status' =>2, 'info' => '注册失败!']);
}
//注册成功
$ucData = $uc['data'];
$info = ['user_id'=>$ucData['user_id'],'user_name'=>$ucData['user_name'],'mobile'=>$mobile,'mobile_status'=>1];
return $info;
}
public function setLogin($userInfo){
//清空cookie
cookie('_userID', $userInfo['userID']);
cookie('_userName',$userInfo['userName']);
cookie('_nick',$userInfo['nick']);
cookie('_auth',null);
cookie('_auth', think_encrypt($userInfo['userName']."\t".$userInfo['userID']."\t".$userInfo['nick']),86400*30);
}
}
?>
\ No newline at end of file
......@@ -18,9 +18,7 @@
</head>
<body>
<div class="new-index-container">
<div class="i-banner">
<p class="cs-num">· 152121人参赛 ·</p>
</div>
<div class="i-banner"><p class="cs-num">· {$userNum}人参赛 ·</p> </div>
<div class="new-main-cont">
<div class="data-cont marginB20">
<div class="new-data marginB50">
......@@ -31,9 +29,9 @@
<tr class="num-tr">
<td class="first-d">14000</td>
<empty name="wallet">
<td class="second-d no">钱包未开启</td>
<td class="second-d no">钱包未开启</td>
<else/>
<td class="second-d">{$wallet.money}</td>
<td class="second-d">{$wallet.money}</td>
</empty>
</tr>
......@@ -285,27 +283,25 @@
<span class="t-pop-close" ><img src="__PUBLIC__/Home/images/g2020/trade-close.png" alt=""></span>
</div>
<div class="course-check-pop pops dialog-pop" style="display: none;" id="popLogin">
<span class="t-pop-close"><img src="__PUBLIC__/Home/images/g2020/trade-close.png" alt=""></span>
<div class="pop-main">
<div class="main-logo">
<img class="logo" src="__PUBLIC__/Home/images/group/logo.png" alt="">
<p class="logo-tip">欢迎您使用叩富简投</p>
</div>
<div class="form-info-box">
<div class="form-info-input">
<input type="tel" class="phone-input" placeholder="请输入手机号" maxlength="11" id="mobile">
</div>
<div class="form-info-input">
<input type="tel" class="code-input" placeholder="请输入短信验证码" maxlength="6" id="smsCode">
<span class="part-line">|</span><input type="button" class="code-btn" id="sendSmsCode" value="获取验证码">
</div>
<input class="form-info-btn" type="button" id="submitLogin" value="立即登录/注册">
</div>
</div>
</div>
<include file="newPop" />
</body>
<script>
$(function(){
$(".baoming").click(function () {
if('{$user.userID}'==''){
$(".mask").show();
$("#popLogin").show();
}else{
location.href=$(this).attr('url');
}
});
//输入手机号验证码后提交 telLogin
});
//获奖感言滚动显示
var area =$('.message-block')[0];
var con1 =$('.message-block-ul')[0];
......
......@@ -474,7 +474,8 @@
// });
//点击底部的更多大赛
$('.showMoreDs').click(function(){
$('.en-li').eq(3).click();
// $('.en-li').eq(3).click();
location.href='{:M_URL}/Match/jiang';
})
//页面最上面的li标签切换
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment