forked from Hanson/vbot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* get请求设置超时 * 增加了ShareFactory,增加了File类型、Content工具类 * 优化console输出 * 修改消息存储方式 * 修复群组接收文件
- Loading branch information
Showing
13 changed files
with
193 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Created by PhpStorm. | ||
* User: Hanson | ||
* Date: 2017/1/15 | ||
* Time: 12:29 | ||
*/ | ||
|
||
namespace Hanson\Vbot\Message\Entity; | ||
|
||
use Hanson\Vbot\Message\MediaInterface; | ||
use Hanson\Vbot\Message\MessageInterface; | ||
use Hanson\Vbot\Message\UploadAble; | ||
use Hanson\Vbot\Support\FileManager; | ||
|
||
class File extends Message implements MessageInterface, MediaInterface | ||
{ | ||
|
||
use UploadAble; | ||
|
||
public $title; | ||
|
||
static $folder = 'file'; | ||
|
||
public function __construct($msg) | ||
{ | ||
parent::__construct($msg); | ||
|
||
$this->make(); | ||
} | ||
|
||
public function make() | ||
{ | ||
$array = (array)simplexml_load_string($this->msg['Content'], 'SimpleXMLElement', LIBXML_NOCDATA); | ||
|
||
$info = (array)$array['appmsg']; | ||
|
||
$this->title = $info['title']; | ||
|
||
$this->download(); | ||
} | ||
|
||
public function download() | ||
{ | ||
$url = server()->fileUri . '/webwxgetmedia'; | ||
$content = http()->get($url, [ | ||
'sender' => $this->msg['FromUserName'], | ||
'mediaid' => $this->msg['MediaId'], | ||
'filename' => $this->msg['FileName'], | ||
'fromuser' => myself()->username, | ||
'pass_ticket' => server()->passTicket, | ||
'webwx_data_ticket' => static::getTicket() | ||
]); | ||
FileManager::download($this->msg['FileName'], $content, static::$folder); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.