一元云购系统短信发送BUG处理
某些版本的云购系统在接入互亿无线短信插件的时候,偶尔会出现短信提交不成功的情况,本文系统了修复该问题的方法:修改前请一定注意先备份代码
一、修复注册时手机第二次获取验证码无效的bug找到云购系统的 \system\modules\member\user.action.php 文件并找到代码if(!$member)_message("未知的来源!",WEB_PATH.'/register');在代码后台加入下面的代码$mobilecode_arr = explode("|",$member['mobilecode']);
if((time()-$mobilecode_arr)>120){
$member['mobilecode'] = '-1';
}
二、在云购系统中增加找回密码手机验证的功能1.执行sqlINSERT INTO`yungo`.`go_caches` (
`id` ,
`key` ,
`value`
)
VALUES (
NULL ,'template_mobile_find','您好,您现在正在找回密码,您的验证码是000000');
2.修改文件\system\funcs\send.fun.php找到代码function send_email_reg($email=null,$uid=null){在代码前加入下面的代码
/**
*发送手机找回密码短信
*mobile @用户手机号
* uid @用户的ID
*code @中奖码
*/
function send_mobile_shop_find($mobile=null,$mobile_code=null){
if(!$mobile_code)_message("发送手机找回密码短信,随机码不能为空!");
if(!$mobile)_message("发送手机找回密码短信,手机号码不能为空!");
$db=System::load_sys_class('model');
$template = $db->GetOne("select * from `@#_caches` where `key` = 'template_mobile_find'");
if(!$template){
$template = array();
$content ="您好,您现在正在找回密码,您的验证码是".$mobile_code;
}
if(empty($template['value'])){
$content ="您好,您现在正在找回密码,您的验证码是".$mobile_cod;
}else{
if(strpos($template['value'],"000000") == true){
$content= str_ireplace("000000",$code,$template['value']);
}else{
$content = $template['value'].$code;
}
}
return _sendmobile($mobile,$content);
}
3.修改文件\system\modules\member\finduser.action.php找到代码_sendmobile改成send_mobile_shop_find(共有两处)
4.修改文件\system\modules\member\finduser.action.php找到代码System::load_app_fun('my','go');在代码后面加入System::load_sys_fun('send');
5.修改文件\system\modules\member\finduser.action.php找到代码if($member['passcode']==-1){在代码前面加入下面的代码
$passcode_arr = explode("|",$member['passcode']);
if((time()-$passcode_arr)>120){
$member['passcode'] = '-1';
}
6.修改文件\system\modules\admin\tpl\template.mobile.tpl.php加入下面的代码 <tr>
<td width="150">用户找回密码短信模板:</td>
<td><textarea name="m_find_temp" style=" height:50px; width:450px" class="input-text"><?php echo $temp_find['value']; ?></textarea>
<font color="red">000000</font> 是发送的验证码!,请不要超过65个字,超过按照2条短信发送
</td>
</tr>
7.修改文件\system\modules\admin\template.action.php中的mobile_temp函数中加入下面的代码/*找回密码*/
$temp_find = $this->db->GetOne("select value from `@#_caches` where `key` = 'template_mobile_find' LIMIT 1");
$m_find_temp = $_POST['$m_find_temp'];
preg_match_all("/./us", $m_find_temp, $match_find);
if(count($match_find) >=75){
_message("找回密码短信模板不能超过75个字,请检查!");
}
$q_3 = $this->db->Query("UPDATE `@#_caches` SET `value`='$_POST' WHERE (`key`='template_mobile_find')");
8.修改文件\system\modules\admin\template.action.php修改代码if($q_1 && $q_2){ 改成 {if($q_1 && $q_2 && $q_3){
页:
[1]