123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- <?php
- namespace crmeb\basic;
- use think\facade\Config;
- abstract class BaseMessage extends BaseStorage
- {
-
- protected $templateIds = [];
-
- protected $openId;
-
- protected $toUrl;
-
- protected $color;
-
- protected function initialize(array $config)
- {
- $this->templateIds = Config::get($this->configFile . '.stores.' . $this->name . '.template_id', []);
- }
-
- public function isLog()
- {
- $isLog = Config::get($this->configFile . 'isLog', false);
- return Config::get($this->configFile . '.stores.' . $this->name . '.isLog', $isLog);
- }
-
- public function getTemplateId()
- {
- return $this->templateIds;
- }
-
- public function to(string $openId)
- {
- $this->openId = $openId;
- return $this;
- }
-
- public function url(string $url)
- {
- $this->toUrl = $url;
- return $this;
- }
-
- public function setColor(string $color)
- {
- $this->color = $color;
- return $this;
- }
-
- protected function getTemplateCode(string $templateId)
- {
- return $this->templateIds[$templateId] ?? null;
- }
-
- protected function clear()
- {
- $this->openId = null;
- $this->toUrl = null;
- $this->color = null;
- }
-
- abstract public function send(string $templateId, array $data = []);
-
- abstract public function add(string $shortId);
-
- abstract public function delete(string $templateId);
-
- abstract public function list();
- }
|