Beispiel #1
0
 /**
  * 生成用于回复的数据
  * @return array
  * @throws \Exception
  */
 public function buildForReply()
 {
     if (!method_exists($this, 'toReply')) {
         throw new \Exception(__CLASS__ . '未实现此方法:toReply()');
     }
     $base = array('ToUserName' => $this->to, 'FromUserName' => $this->from, 'CreateTime' => time(), 'MsgType' => $this->getDefaultMessageType());
     return XML::build(array_merge($base, $this->toReply()));
 }
Beispiel #2
0
 /**
  * 解析xml
  *
  * @throws Exception
  */
 public function parseInput()
 {
     $xml = $this->request->rawPostData();
     $input = XML::parse($xml);
     //消息加密处理
     if ($this->request->get('encrypt_type') == 'aes') {
         $this->encoding = true;
         $input = $this->decrypt($xml);
     }
     $this->input = $input;
 }