mirror of
https://github.com/rainerosion/DormitoryRepair.git
synced 2026-06-02 18:33:42 +08:00
53 lines
1.4 KiB
PHP
53 lines
1.4 KiB
PHP
<?PHP
|
|
require 'message.php';
|
|
class MESSAGEsend{
|
|
|
|
protected $appid='';
|
|
|
|
protected $appkey='';
|
|
|
|
protected $sign_type='';
|
|
|
|
protected $To=array();
|
|
|
|
protected $Content='';
|
|
|
|
|
|
function __construct($configs){
|
|
$this->appid=$configs['appid'];
|
|
$this->appkey=$configs['appkey'];
|
|
if(!empty($configs['sign_type'])){
|
|
$this->sign_type=$configs['sign_type'];
|
|
}
|
|
}
|
|
|
|
public function SetTo($address){
|
|
$this->To=trim($address);
|
|
}
|
|
|
|
|
|
public function SetContent($content){
|
|
$this->Content=$content;
|
|
}
|
|
|
|
public function AddVar($key,$val){
|
|
$this->Vars[$key]=$val;
|
|
}
|
|
|
|
public function buildRequest(){
|
|
$request=array();
|
|
$request['to']=$this->To;
|
|
$request['content']=$this->Content;
|
|
return $request;
|
|
}
|
|
public function send(){
|
|
$message_configs['appid']=$this->appid;
|
|
$message_configs['appkey']=$this->appkey;
|
|
if($this->sign_type!=''){
|
|
$message_configs['sign_type']=$this->sign_type;
|
|
}
|
|
$message=new message($message_configs);
|
|
return $message->send($this->buildRequest());
|
|
}
|
|
|
|
} |