调整模板消息发送工具类

This commit is contained in:
liaofei 2019-11-28 18:39:29 +08:00
parent 0d8c4d7cb8
commit ae4a0e23c7

View File

@ -44,7 +44,7 @@ class Template
* @var array 'defaultData'=>[[],'array'] 生成的方法为 setDefaultData(array $value) * @var array 'defaultData'=>[[],'array'] 生成的方法为 setDefaultData(array $value)
*/ */
protected $propsRule = [ protected $propsRule = [
'defaultData' => '', 'defaultData' => [null, 'string'],
'templateCode' => [null, 'string'], 'templateCode' => [null, 'string'],
'templateData' => [[], 'array'], 'templateData' => [[], 'array'],
'templateUrl' => [null, 'callable', 'postpositionUrl'], 'templateUrl' => [null, 'callable', 'postpositionUrl'],
@ -52,7 +52,6 @@ class Template
'sendType' => [null, 'string'], 'sendType' => [null, 'string'],
'templateOpenId' => [null, 'string'], 'templateOpenId' => [null, 'string'],
'templateOpenId' => [null, 'string'], 'templateOpenId' => [null, 'string'],
'templateDefaultColor' => [null,'string'],
]; ];
/** /**
@ -117,9 +116,11 @@ class Template
* @param string $suffix * @param string $suffix
* @return string * @return string
*/ */
public function postpositionUrl(Url $url,string $suffix = '') public function postpositionUrl($url, string $suffix = '')
{ {
return $url->suffix($suffix)->domain(true)->build(); if($url instanceof Url)
$url = $url->suffix($suffix)->domain(true)->build();
return $url;
} }
/** /**