Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

希望能增加获取回复数据的方法 #929

Closed
chenhaizano opened this issue Sep 17, 2017 · 4 comments
Closed

希望能增加获取回复数据的方法 #929

chenhaizano opened this issue Sep 17, 2017 · 4 comments

Comments

@chenhaizano
Copy link
Contributor

需求

接收消息后进行回复消息,需要保存回复的消息数据,用于日志查询

Guard 增加获取回复数据的方法

比如

protected function buildReply($to, $from, $message)
{
    $base = [
        'ToUserName' => $to,
        'FromUserName' => $from,
        'CreateTime' => time(),
        'MsgType' => is_array($message) ? current($message)->getType() : $message->getType(),
    ];

    $transformer = new Transformer();

+    $this->reply = array_merge($base, $transformer->transform($message));

    return XML::build($this->reply);
}
+public function getReply() {
+    return $this->reply;
+}
@overtrue
Copy link
Collaborator

回复啥是你自己决定的啊,你自己回复前记一下不就得了

@chenhaizano
Copy link
Contributor Author

主要是格式,既然buildReply方法有这个拼接,外层再去拼接有点不专业

@overtrue
Copy link
Collaborator

overtrue commented Sep 18, 2017

...
$response = $server->serve();

\Log::info($response->getContents());

@chenhaizano
Copy link
Contributor Author

chenhaizano commented Sep 18, 2017

@overtrue 好吧。我知道这个。只能再to array一次

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants