Commit 0240e722 authored by houdong's avatar houdong

有奖赛报名后即发短信

parent ac2178b4
...@@ -40,6 +40,7 @@ define('M2M_GROUP',24321); ...@@ -40,6 +40,7 @@ define('M2M_GROUP',24321);
define('ZHONGJIN_GROUP',24299); define('ZHONGJIN_GROUP',24299);
define('NIU_STRONG_ID',24323); define('NIU_STRONG_ID',24323);
define('NIU_SAN_ID',24326); define('NIU_SAN_ID',24326);
define('NIU_BAI_ID',24327);
return array( return array(
......
...@@ -236,7 +236,10 @@ class IndexAction extends IdentityAction { ...@@ -236,7 +236,10 @@ class IndexAction extends IdentityAction {
$password = I('password', ''); $password = I('password', '');
$referer = I('referer', ''); $referer = I('referer', '');
$groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$groupId))->find(); // $groupInfo=M('Group')->field('group_id,web_id,category,name,startTime,endTime')->where(array('group_id'=>$groupId))->find();
$groupInfo=M('Group a')->join('left join cofool_group_info b on a.group_id=b.group_id')
->field('a.group_id,a.web_id,a.category,a.name,startTime,endTime,wechat')->where(['a.group_id'=>$groupId])->find();
$bmContent='您正在报名全民争霸赛,请添加管理员微信加入【大赛高手交流群】,陪伴老师微信号:'.$groupInfo['wechat'];
//大赛是否结束 //大赛是否结束
$groupStatus=0; $groupStatus=0;
...@@ -337,6 +340,7 @@ class IndexAction extends IdentityAction { ...@@ -337,6 +340,7 @@ class IndexAction extends IdentityAction {
} }
//0成功,1失败 //0成功,1失败
if($joinRes['status']==0){ if($joinRes['status']==0){
D('Sms')->send(['mobile'=>$mobile,'content' =>$bmContent,'type'=>46],true,true);
$this->ajaxReturn(array('status' => 1, 'info' => '参赛成功!')); $this->ajaxReturn(array('status' => 1, 'info' => '参赛成功!'));
}else{ }else{
$this->ajaxReturn(array('status' => 0, 'info' =>$joinRes['error'],'joinStatus'=>$joinRes['joinStatus'])); $this->ajaxReturn(array('status' => 0, 'info' =>$joinRes['error'],'joinStatus'=>$joinRes['joinStatus']));
......
...@@ -430,7 +430,7 @@ class PkTopAction extends IdentityAction{ ...@@ -430,7 +430,7 @@ class PkTopAction extends IdentityAction{
// $cfrom=I('cfrom'); // $cfrom=I('cfrom');
// $place=$cfrom?$cfrom:I('hfrom'); // $place=$cfrom?$cfrom:I('hfrom');
$place=''; $place='';
$return=$this->joinUserGroup($ucData['user_id'],$ucData['user_name'],$this->GID,$inviterId,$referer,$place); $return=$this->joinUserGroup($ucData['user_id'],$ucData['user_name'],$this->GID,$inviterId,$referer,$place,$mobile);
$this->ajaxReturn($return); $this->ajaxReturn($return);
} }
...@@ -535,10 +535,14 @@ class PkTopAction extends IdentityAction{ ...@@ -535,10 +535,14 @@ class PkTopAction extends IdentityAction{
} }
//参加大赛 //参加大赛
public function joinUserGroup($userId,$userName,$groupId,$inviterId,$referer,$place){ public function joinUserGroup($userId,$userName,$groupId,$inviterId,$referer,$place,$mobile){
$field='group_id,name,question_privacy,reg_answer,type,web_id,capital,teamid,category,is_open'; // $field='group_id,name,question_privacy,reg_answer,type,web_id,capital,teamid,category,is_open';
$group =M('Group')->where(array('group_id'=>$groupId))->field($field)->find(); // $group =M('Group')->where(array('group_id'=>$groupId))->field($field)->find();
$field='a.group_id,a.name,question_privacy,reg_answer,a.type,a.web_id,a.capital,a.teamid,a.category,is_open,wechat';
$group=M('Group a')->join('left join cofool_group_info b on a.group_id=b.group_id')
->field($field)->where(['a.group_id'=>$groupId])->find();
$bmContent='您正在报名全民争霸赛,请添加管理员微信加入【大赛高手交流群】,陪伴老师微信号:'.$group['wechat'];
if($group['is_open']==0){ if($group['is_open']==0){
return array('status'=>0,'info'=>'当前大赛不允许加入!'); return array('status'=>0,'info'=>'当前大赛不允许加入!');
...@@ -596,6 +600,7 @@ class PkTopAction extends IdentityAction{ ...@@ -596,6 +600,7 @@ class PkTopAction extends IdentityAction{
M('userinfo', " ", C('DB_CONFIG_MNCG3'))->add($initData); M('userinfo', " ", C('DB_CONFIG_MNCG3'))->add($initData);
} }
D('Sms')->send(['mobile'=>$mobile,'content' =>$bmContent,'type'=>46],true,true);
return array('status'=>1,'info'=>'参赛成功','debug'=>$userId); return array('status'=>1,'info'=>'参赛成功','debug'=>$userId);
......
...@@ -38,7 +38,8 @@ class SmsModel extends Model{ ...@@ -38,7 +38,8 @@ class SmsModel extends Model{
file_put_contents($logFile,date('Y-m-d H:i:s').' '.$mobile.' content is:'.$content.PHP_EOL,FILE_APPEND); file_put_contents($logFile,date('Y-m-d H:i:s').' '.$mobile.' content is:'.$content.PHP_EOL,FILE_APPEND);
if(!preg_match('/^1([0-9]{9})/',$mobile)) { if(!preg_match('/^1([0-9]{9})/',$mobile)) {
exit('mobile phone error'); // exit('mobile phone error');
return false;
} }
$this->mobile = $mobile; $this->mobile = $mobile;
$this->type = $type; $this->type = $type;
......
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