56短信网致力于为您提供专业的短信接口和短信插件服务,如果您在接入接口的时候,遇到什么问题,可以联系我们的技术人员帮您解决,也可以由我们技术人员来帮您完成短信接口的调试。
以下是pigcms 短信接口和短信key在调用的时候核心代码,由于版本不一样,我们只对核心代码做了修改, 如果您根据以下方式修改之后,仍然不可以用,可以联系我们技术人员,由技术人员来帮您完成调试。
首先找到如下文件:Lib\ORG\Sms.class.php
public function sendSms($token, $content='',$mobile='', $send_time='', $charset='utf-8',$id_code = '') {
$companyid=0;
if(!(strpos($token,'_') === FALSE)){
$sarr=explode('_',$token);
$token=$sarr[0];
$companyid=intval($sarr[1]);
}
if (!$mobile){
$companyWhere=array();
$companyWhere['token']=$token;
if ($companyid){
$companyWhere['id']=$companyid;
}
$company=M('Company')->where($companyWhere)->find();
$mobile=$company['mp'];
}
//
$thisWxUser=M('Wxuser')->where(array('token'=>Sms::_safe_replace($token)))->find();
$thisUser=M('Users')->where(array('id'=>$thisWxUser['uid']))->find();
if ($token=='admin'){
$thisUser=array('id'=>0);
$thisWxUser=array('uid'=>0,'token'=>$this->token);
}
//短信发送状态
if(is_array($mobile)){
$mobile = implode(",", $mobile);
}
$content = Sms::_safe_replace($content);
$data = array(
'username' => C('sms_user'),
'userpwd' =>C('sms_key'),
'sendcontent' => $content,
'handtel'=>$mobile,
'comid'=>61,
'smsnumber'=>10690,
'sendtime'=>'',
);
$post = '';
foreach($data as $k=>$v) {
$post .= $k.'='.$v.'&';
}
//短信URL地址
$smsapi_senturl="http://jiekou.56dxw.com/sms/HttpInterface.aspx";
//$uid=C('uid');
//$pwd=C('pwd');
$uid =C('sms_user');
$pwd =C('sms_key') ;
$mobileids=C('mobileids');
$return=Sms::send_SMS($smsapi_senturl,$uid,$pwd,$mobile,$content,$mobileids);
$arr = explode('&',$return);
$sta=explode("=",$arr[1]);
$this->statuscode = $sta[1];
//增加到本地数据库
$row=array('uid'=>$thisUser['id'],'token'=>$thisWxUser['token'],'time'=>time(),'mp'=>$mobile,'text'=>$content,'status'=>$this->statuscode,'price'=>C('sms_price'));
M('Sms_record')->add($row);
if (intval($this->statuscode)==100&&$token!='admin'){
M('Users')->where(array('id'=>$thisWxUser['uid']))->setDec('smscount');
}
//end
//print_r($return);
//exit;
return $return;
//}
}