Commit 2fbee791 authored by houdong's avatar houdong

加注册来源

parent 9db746da
......@@ -10,10 +10,30 @@ class IndexAction extends IdentityAction {
'2021-07'=>'2021年7月','2021-06'=>'2021年6月','2021-05'=>'2021年5月','2021-04'=>'2021年4月'];
public $STATUS_TXT =['1'=>'未开赛','2'=>'进行中','3'=>'已结束'];
public function _initialize() {
parent::_initialize();
//手机访问跳转到m站对应的页面
if(isMobileRequest()){
$uriArray= parse_url($_SERVER['REQUEST_URI']);
$query=$uriArray['query'];
if(ACTION_NAME=='index'||ACTION_NAME=='win'||ACTION_NAME=='rule'){
header('location:/PkTop?viewPage=1&'.$query);
}
if(ACTION_NAME=='lucky'){
header('location:/PkTop?viewPage=2&'.$query);
}
if(ACTION_NAME=='phb'){
header('location:/PkTop?viewPage=3&'.$query);
}
if(ACTION_NAME=='moreDs'){
header('location:/PkTop?viewPage=4&'.$query);
}
}
}
public function index(){
$gid=I('gid',$this->GID);
$this->jumpToM(1,$gid);
// $this->jumpToM(1,$gid);
$userId = $this->user['userID'];
//名人堂数据的决赛名单,包括pk胜利者和月赛前10名者
......@@ -262,8 +282,11 @@ class IndexAction extends IdentityAction {
//页面输入的用户名改成昵称
$userName = randUsername('股神',$mobile);
$uc = uc_user_register(['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),
'mobile' => $mobile,'mobile_status' => 1,'sourse' =>'www','nick'=>$nick]);
$regData=['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),'mobile' => $mobile,
'mobile_status' => 1,'psourse' =>'www','sourse' =>'zcguanfang','nick'=>$nick];
$regData['sourse']=$inviterId?'zcyaoqing':'zcguanfang';
$uc = uc_user_register($regData);
// var_dump($uc);exit;
//status0是注册成功
if ($uc['status']) {
......@@ -370,9 +393,11 @@ class IndexAction extends IdentityAction {
// if($result['status']==122){
// $this->ajaxReturn(array('status' => 0, 'info' => '该用户名已存在,请更换!'));
// }
$regData=['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),
'mobile' => $mobile,'mobile_status' => 1,'psourse' =>'www','nick'=>$nick];
$regData['sourse']=$inviterId?'zcyaoqing':'zcguanfang';
$uc = uc_user_register(['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),
'mobile' => $mobile,'mobile_status' => 1,'sourse' =>'www','nick'=>$nick]);
$uc = uc_user_register($regData);
// var_dump($uc);exit;
//status0是注册成功
if ($uc['status']) {
......@@ -1032,7 +1057,7 @@ class IndexAction extends IdentityAction {
}
}
$key=md5('user_id='.$userId.'abcd4321');
$shareUrl=rtrim(C('M_URL'),'/').'/PkTop/myInvite?cfrom=pcInvitation&user_id='.$userId.'&key='.$key;
$shareUrl=rtrim(C('M_URL'),'/').'/PkTop/index?cfrom=pcInvitation&inviterId='.$userId.'&key='.$key;
$copyUrl=C('VIP_URL').'?cfrom=pcInvitation&inviterId='.$userId;
$return=array('guests'=>$guests,'guestNum'=>count($guests),'shareUrl'=>$shareUrl,'copyUrl'=>$copyUrl);
......@@ -1187,46 +1212,8 @@ class IndexAction extends IdentityAction {
}
}
// public function bmOtherGroup(){
// $userId = $this->user['userID'];
// $userName = $this->user['userName'];
// $mobile = I('mobile', '');
// $smsCode = I('smsCode', '');
// $gid =I('gid');
//
// if($gid==ZHONGJIN_GROUP){
// $this->joinZj();
// }
// if(in_array($gid,[M2M_GROUP,NIU_BAI_ID,NIU_SAN_ID,NIU_STRONG_ID])){
// $res=D('Niu')->joinNiu($mobile,$smsCode,$userId,$userName,$gid);
// }
// $this->ajaxReturn($res);
// }
//加入中金赛
// public function joinZj(){
// $groupId=ZHONGJIN_GROUP;
// $code_type = 38;
// //报名大赛
// $mobile = I('mobile', '');
// $smsCode = I('smsCode', '');
// $kaihuSource = I('kaihuSource', '');
// $kaihuSource=$kaihuSource?$kaihuSource:cookie('kaihuSource');
//
// //通过输入手机号报名,userId变为空
//// $userId=$mobile?0:$this->user['userID'];
// $userId=$this->user['userID'];
// $res=D('Niu')->joinZjBefore($mobile,$smsCode,$userId);
// if ($res['status']==2) {
// $this->ajaxReturn(['status' =>2, 'info' =>$res['info']]);
// }
// cookie('kaihuSource',$kaihuSource);
//
// $res=D('Niu')->joinZj($mobile,$userId,$kaihuSource);
//
// $info='您提交的信息正在审核,通过后将以短信方式通知您';
// $this->ajaxReturn(['status' => 1, 'joinStatus' =>$res[0],'userId'=>$userId,'debug'=>$res[1],'info'=>$info]);
// }
}
......
......@@ -393,7 +393,7 @@ class PkTopAction extends IdentityAction{
$ucUser = uc_get_user(['token' => $mobile]);
//没有该用户,开始注册,status0有该用户,111表示用户不存在
if($ucUser['status']==111){
$ucData=$this->reg2020($mobile);
$ucData=$this->reg2020($mobile,$inviterId);
}else{
$ucData=$ucUser['data'];
}
......@@ -506,11 +506,14 @@ class PkTopAction extends IdentityAction{
}
public function reg2020($mobile){
public function reg2020($mobile,$inviterId){
$username = randUsername('股神',$mobile);
$password = substr(md5($username), 18);
$uc = uc_user_register(array('userName' => $username, 'password' => $password, 'ip' => get_client_ip(),
'inviteFrom' => 'web', 'mobile' => $mobile,'mobile_status' => 1,'sourse' =>'3g'));
$regData=['userName' => $username, 'password' => $password, 'ip' => get_client_ip(),
'inviteFrom' => 'web', 'mobile' => $mobile,'mobile_status' => 1,'psourse' =>'m'];
$regData['sourse']=$inviterId?'zcyaoqing':'zcguanfang';
$uc = uc_user_register($regData);
// var_dump($uc);exit;
//status0是注册成功
if ($uc['status']) {
......@@ -1183,46 +1186,8 @@ class PkTopAction extends IdentityAction{
return 1;
}
public function bmOtherGroup(){
$userId = $this->user['userID'];
$userName = $this->user['userName'];
$mobile = I('mobile', '');
$smsCode = I('smsCode', '');
$gid =I('gid');
if($gid==ZHONGJIN_GROUP){
$this->joinZj();
}
// if($gid==PRIZE_GROUP_2021){
// $return=D('Niu')->joinVip($loginInfo,$mobile,$smsCode,$gid);
// }
if(in_array($gid,[M2M_GROUP,NIU_BAI_ID,NIU_SAN_ID,NIU_STRONG_ID])){
$return=D('Niu')->joinNiu($mobile,$smsCode,$userId,$userName,$gid);
$this->ajaxReturn($return);
}
// $this->ajaxReturn($res);
}
//加入大赛
public function joinZj($gid=ZHONGJIN_GROUP){
$code_type = 38;
$mfrom=I('mfrom',0);
$userId=$this->user['userID'];
//报名大赛
$mobile = I('mobile', '');
$smsCode = I('smsCode', '');
$kaihuSource = I('kaihuSource', '');
$kaihuSource=$kaihuSource?$kaihuSource:cookie('kaihuSource');
$res=D('Niu')->joinZjBefore($mobile,$smsCode,$userId);
if ($res['status']==2) {
$this->ajaxReturn(['status' =>2, 'info' =>$res['info']]);
}
$res=D('Niu')->joinZj($mobile,$userId,$kaihuSource);
$info='您提交的信息正在审核,通过后将以短信方式通知您';
$this->ajaxReturn(['status' => 1, 'joinStatus' =>$res[0],'userId'=>$userId,'debug'=>$res[0],'info'=>$info]);
}
public function dianjiLog(){
$gid=$this->GID;
......
......@@ -13,7 +13,7 @@ class NiuModel extends Model{
// NIU_SAN_ID=>[M_URL.'/Niusan',13],NIU_STRONG_ID=>[M_URL.'/Strong',15],
// ];
$MAP=[
ZHONGJIN_GROUP=>[WWW_URL.'/Zjds',1],
ZHONGJIN_GROUP=>[WWW_URL.'/Zjds',1],HUAXI_ID=>[M_URL.'/Huaxi',2],
GUOYUAN_ID=>[M_URL.'/Guoyuan',5],PRIZE_GROUP_2021=>['/',7],
NIU_BAI_ID=>[M_URL.'/Niubai',11],
NIU_STRONG_ID=>[M_URL.'/Strong',15],
......@@ -60,167 +60,7 @@ class NiuModel extends Model{
return $gList;
}
public function joinZjBefore($mobile,$smsCode,$userId){
$groupInfo=M('Group')->field('startTime,endTime')->where(['group_id'=>ZHONGJIN_GROUP])->find();
//1未开始,2是进行中,3已结束
$groupStatus=is_end($groupInfo['endTime'])?3:($groupInfo['startTime']>time()?1:2);
if ($groupStatus==3) {
return(['status' =>2, 'info' => '该大赛已经结束,不能报名!']);
}
//
if ($mobile) {
$map=['mobile'=>$mobile,'code'=>$smsCode,'type'=>38,'add_time'=>['gt',NOW_TIME-1800]];
$row = M('Sms')->where($map)->find();
if(empty($row)){
return(['status'=>2,'info'=>'验证码失效或者错误!']);
}
//如果该手机号的申请状态是未审核0和已通过1,应返回提示
$oldData1=M('Zhongjin')->where(['mobile'=>$mobile,'status'=>0])->count();
$oldData2=M('Zhongjin')->where(['mobile'=>$mobile,'status'=>1])->count();
}else{
//如果该手机号的申请状态是未审核0和已通过1,应返回提示
$oldData1=M('Zhongjin')->where(['user_id'=>$userId,'status'=>0])->count();
$oldData2=M('Zhongjin')->where(['user_id'=>$userId,'status'=>1])->count();
}
if ($oldData1) {
return(['status' =>2, 'info' => '您提交的信息正在审核中,请不要重复提交!']);
}
if ($oldData2) {
return(['status' =>2, 'info' => '您已经开过户,不能重复报名!']);
}
}
public function joinZj($mobile,$userId,$kaihuSource){
if($mobile){
$uc = uc_get_user(['token' => $mobile]);
$ucData=$uc['data'];
//没有该用户,开始注册,status0有该用户,111表示用户不存在
if($uc['status']==111){
$userName = randUsername('股神',$mobile);
$password = substr(md5($userName), 18);
$uc = uc_user_register(['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),
'mobile' => $mobile,'mobile_status' => 1,'sourse' =>'www']);
// var_dump($uc);exit;
//status0是注册成功
if ($uc['status']) {
$this->ajaxReturn(['status' => 0, 'info' => '注册失败!']);
}
//注册成功
$ucData = $uc['data'];
$userId=$ucData['user_id'];
$info = ['user_id'=>$userId,'user_name'=>$userName,'mobile'=>$mobile,'mobile_status'=>1];
$res = D('Userinfo')->_addUser($info);
if ($res <= 0) {
$this->ajaxReturn(['status' => 0, 'info' => '添加用户失败!']);
}
$debug='新注册';
M('Zhongjin')->add(['user_id'=>$userId,'user_name'=>$userName,'nick'=>$userName,'mobile'=>$mobile,
'add_time'=>time(),'source'=>$kaihuSource]);
$joinStatus=0;
}else{
$debug='老用户';
$bmData=M('Zhongjin')->where(['mobile'=>$mobile,'status'=>['in',[0,1]]])->find();
if(empty($bmData)){
M('Zhongjin')->add(['user_id'=>$ucData['user_id'],'user_name'=>$ucData['user_name'],'mobile'=>$mobile,
'nick'=>$ucData['nick'],'add_time'=>time(),'source'=>$kaihuSource]);
$joinStatus=0;
}else{
$joinStatus=empty($bmData)?-1:$bmData['status'];
}
}
//注册后用让其自动登录
require_once './uc_client_php/client.php';
$this->setLogin(['userID'=>$ucData['user_id'],'userName'=>$ucData['user_name']]);
//同步登陆
uc_user_synlogin(['userId'=>$ucData['user_id'],'userName'=>$ucData['user_name'],'nick'=>$ucData['nick']]);
}else{
$bmData=M('Zhongjin')->where(['user_id'=>$userId,'status'=>['in',[0,1]]])->find();
if(empty($bmData)){
$uc = uc_get_user(['userId' => $userId,'type'=>3]);
// var_dump($uc);exit;
if($uc['status']==0&&!empty($uc['data'])){
$ucData = $uc['data'];
}
M('Zhongjin')->add(['user_id'=>$userId,'user_name'=>$ucData['user_name'],'mobile'=>$ucData['mobile'],
'nick'=>$ucData['nick'],'add_time'=>time(),'source'=>$kaihuSource]);
$joinStatus=0;
}else{
$joinStatus=empty($bmData)?-1:$bmData['status'];
}
}
return [$joinStatus,$debug];
}
//加入大赛
public function joinNiu($mobile,$smsCode,$userId,$userName,$gid){
if($mobile){
if (!$smsCode) {
return (['status' =>2, 'info' => '请输入手机验证码!']);
}
// $smsType=$gid==M2M_GROUP?38:44;
$smsType=32;
// if (CS('tel:'. $mobile . ':'.$smsType) != $smsCode) {
// return(['status' => 2, 'info' => '对不起!手机验证码错误或已过期!']);
// }
$param = ['mobile'=>$mobile,'code'=>$smsCode,'type'=>$smsType];
if(D('Sms')->checkCode($param)){
}else{
return(['status' => 2, 'info' => '对不起!手机验证码错误或已过期!']);
}
$ucUser = uc_get_user(['token' => $mobile]);
//没有该用户,开始注册,status0有该用户,111表示用户不存在
if($ucUser['status']==111){
// $ucData=$this->reg2020($mobile);
$userName = randUsername('股神',$mobile);
$password = substr(md5($userName), 18);
$uc = uc_user_register(['userName' => $userName, 'password' => $password, 'ip' => get_client_ip(),
'mobile' => $mobile,'mobile_status' => 1,'sourse' =>'www']);
$ucData = $uc['data'];
// $userId=$ucData['user_id'];
}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']]);
}else{
// $userId = $this->user['userID'];
// $userName = $this->user['userName'];
$user_data = uc_get_user(['userId' => $userId,'type' => 3]);
$mobile = $user_data['data']['mobile'];
}
//后台审核才能加入大赛,申请中0,审核通过1,审核未通过2
$STATUS=['0'=>'报名参赛正在审核中','1'=>'登录成功','2'=>'报名参赛未通过审核'];
// if($gid==M2M_GROUP){
// $old=M('M2m')->where(['user_id'=>$userId])->find();
// if(empty($old)){
// M('M2m')->add(['user_id'=>$userId,'user_name'=>$userName,'mobile'=>$mobile,'add_time'=>time(),'status'=>0,'source'=>'m']);
// return(['status' => 1,'info'=>'报名申请已提交']);
// }else{
// return(['status' => 2,'info'=>$STATUS[$old['status']]]);
// }
// }
// if(in_array($gid,[NIU_BAI_ID,NIU_SAN_ID,NIU_STRONG_ID])){
$old=M('Baoming')->where(['user_id'=>$userId,'group_id'=>$gid])->find();
if(empty($old)){
M('Baoming')->add(['user_id'=>$userId,'user_name'=>$userName,'mobile'=>$mobile,'add_time'=>time(),'status'=>0,'source'=>'m','group_id'=>$gid]);
return(['status' => 1,'info'=>'报名申请已提交']);
}else{
return(['status' => 2,'info'=>$STATUS[$old['status']]]);
}
// }
}
public function setLogin($userInfo,$remember = 0){
cookie('_userID', $userInfo['userID']);
cookie('_userName',$userInfo['userName']);
......
......@@ -80,7 +80,7 @@
<!--<p class="msg-code">打开微信,扫一扫添加好友</p>-->
<!--<p class="msg-code">大赛管理员微信:<span class="red">{$weixin}</span></p>-->
<img class="code" src="__PUBLIC__/Home/images/2023ewm/vipDs.gif" alt="">
<img class="code" src="{$Think.const.IMAGE_URL}/2023ewm/vipDs.gif" alt="">
<p class="msg-code">打开微信,扫一扫添加大赛管理员企业微信</p>
</div>
......@@ -175,7 +175,7 @@
<img class="bg" src="__PUBLIC__/images/h5/g2020/open-code-blockBg.png" alt="">
<div class="code-cont" style="left:46%;">
<!--<img class="code" src="__PUBLIC__/Home/images/g2020/{$weixin}.jpg" alt="">-->
<img class="code" src="__PUBLIC__/Home/images/2023ewm/vipDs.gif" alt="">
<img class="code" src="{$Think.const.IMAGE_URL}/2023ewm/vipDs.gif" alt="">
<!--<p class="msg-code">打开微信,扫一扫添加好友</p>-->
<!--<p class="msg-code">大赛管理员微信:<span class="red">{$weixin}</span></p>-->
......
......@@ -51,7 +51,7 @@
<!--<p class="code-img"><img src="{$Think.const.IMAGE_URL}/uploads/camps/weixin/{$weixin}.jpg" alt=""></p>-->
<!--<p class="pop-sub1">复制微信号-打开微信-通讯录-添加好友</p>-->
<p class="code-img"><img src="__PUBLIC__/Home/images/2023ewm/vipDs.gif" alt=""></p>
<p class="code-img"><img src="{$Think.const.IMAGE_URL}/2023ewm/vipDs.gif" alt=""></p>
<p class="pop-sub1">打开微信,扫一扫添加大赛管理员企业微信</p>
<!--<p class="main-msg-code" style="text-align:center">学习顾问微信:<span class="red">{$weixin}</span>-->
......@@ -140,40 +140,9 @@
});
});
//加入其他的大赛
// $(".bmOtherGroupStep1__").click(function () {
// var gid=$(this).attr("gid");
// if('{$user.userID}'==''){
// $(".mask").show();
// $("#popBase").show();
// $(".bmOtherGroupStep2").attr('gid',gid);
// }else{
// $.post("/Index/bmOtherGroup",{gid:gid},function(data){
// if(data.status == 1){
// layer.alert(data.info, 1, function(){layer.close(location.reload());});
// }else{
// layer.alert(data.info, 8);
// return false;
// }
// });
// }
// });
//输入手机号,验证码后点击报名按钮
// $(".bmOtherGroupStep2").click(function () {
// var mobile=$(".base1").val();
// if(mobile==''){layer.msg('请输入手机号');return;}
// var smsCode=$(".base2").val();
// if(smsCode==''){layer.msg('请输入验证码');return;}
// $.post("/Index/bmOtherGroup",{mobile:mobile,smsCode:smsCode,gid:$(this).attr("gid")},function(data){
// if(data.status == 1){
// layer.alert(data.info, 1, function(){layer.close(location.reload());});
// }else{
// layer.alert(data.info, 8);
// return false;
// }
// });
// });
var clipboard = new Clipboard('.copyBtn');
clipboard.on('success', function(e) {layer.msg('复制链接成功',1,1);});
......
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