|
@@ -3,26 +3,58 @@
|
|
use Illuminate\Support\Facades\Facade;
|
|
use Illuminate\Support\Facades\Facade;
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 短信发送
|
|
|
|
- *
|
|
|
|
- * @method static array sendSms($desMobile,$content,$sign) 发送短信
|
|
|
|
- * @method static int|array surplus() 发送短信
|
|
|
|
- *
|
|
|
|
- * @see \App\Servers\Sms\GuoDu
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
|
|
+ * 验证码模型
|
|
|
|
+ *
|
|
|
|
+ * @author 刘相欣
|
|
*/
|
|
*/
|
|
-class GuoDu extends Facade
|
|
|
|
-{
|
|
|
|
|
|
+class GuoDu {
|
|
|
|
+
|
|
|
|
+ // 已开通的帐号名称
|
|
|
|
+ private $operId ='dfwyyz';
|
|
|
|
+ //与帐号名称对应的密码
|
|
|
|
+ private $operPass ='VTfTSYzX';
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * Get the registered name of the component.
|
|
|
|
- *
|
|
|
|
- * @return string
|
|
|
|
|
|
+ * 发送短信
|
|
|
|
+ * @param string $desMobile 接收手机号码
|
|
|
|
+ * @param string $content 短信内容
|
|
|
|
+ * @param string $sign 签名
|
|
|
|
+ *
|
|
|
|
+ * @return array
|
|
|
|
+ *
|
|
|
|
+ */
|
|
|
|
+ public function sendSms($desMobile,$content,$sign){
|
|
|
|
+ // 发送
|
|
|
|
+ $result = Curl::to('http://qxtsms.guodulink.net/QxtSms/QxtFirewall')->withData([
|
|
|
|
+ 'OperID'=>$this->operId,
|
|
|
|
+ 'OperPass'=>$this->operPass,
|
|
|
|
+ 'DesMobile'=>$desMobile,
|
|
|
|
+ 'Content'=>'【'.$sign.'】'.$content,
|
|
|
|
+ 'Content code'=>1
|
|
|
|
+ ])->post();
|
|
|
|
+ //如果没有返回值
|
|
|
|
+ if( !$result ) return['error'=>'国都侧未正确返回格式'];
|
|
|
|
+ // XML格式转PHP数组
|
|
|
|
+ $result = simplexml_load_string($result);
|
|
|
|
+ $result = json_decode(json_encode($result),true);
|
|
|
|
+ // 返回结果
|
|
|
|
+ return $result;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询余额
|
|
|
|
+ *
|
|
|
|
+ * @return array|int
|
|
|
|
+ *
|
|
*/
|
|
*/
|
|
- protected static function getFacadeAccessor()
|
|
|
|
- {
|
|
|
|
- return '\App\Servers\Aliyun\Sms';
|
|
|
|
|
|
+ public function surplus(){
|
|
|
|
+ // 查询
|
|
|
|
+ $result = Curl::to('http://124.251.7.68:8100/QxtSms_surplus/surplus')->withData(['OperID'=>$this->operId,'OperPass'=>$this->operPass])->get();
|
|
|
|
+ //如果没有返回值
|
|
|
|
+ if( !$result ) return['error'=>'国都侧未正确返回格式'];
|
|
|
|
+ // 返回结果
|
|
|
|
+ return $result;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
-?>
|
|
|