chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
152
crmeb/basic/BaseMessage.php
Normal file
152
crmeb/basic/BaseMessage.php
Normal file
@@ -0,0 +1,152 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace crmeb\basic;
|
||||
|
||||
use think\facade\Config;
|
||||
|
||||
abstract class BaseMessage extends BaseStorage
|
||||
{
|
||||
/**
|
||||
* 模板id
|
||||
* @var array
|
||||
*/
|
||||
protected $templateIds = [];
|
||||
|
||||
/**
|
||||
* openId
|
||||
* @var string
|
||||
*/
|
||||
protected $openId;
|
||||
|
||||
/**
|
||||
* 跳转链接
|
||||
* @var string
|
||||
*/
|
||||
protected $toUrl;
|
||||
|
||||
/**
|
||||
* 颜色
|
||||
* @var string
|
||||
*/
|
||||
protected $color;
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
* @param array $config
|
||||
* @return mixed|void
|
||||
*/
|
||||
protected function initialize(array $config)
|
||||
{
|
||||
$this->templateIds = Config::get($this->configFile . '.stores.' . $this->name . '.template_id', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否记录日志
|
||||
* @return mixed
|
||||
*/
|
||||
public function isLog()
|
||||
{
|
||||
$isLog = Config::get($this->configFile . 'isLog', false);
|
||||
return Config::get($this->configFile . '.stores.' . $this->name . '.isLog', $isLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模板id
|
||||
* @return array
|
||||
*/
|
||||
public function getTemplateId()
|
||||
{
|
||||
return $this->templateIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* openid
|
||||
* @param string $openId
|
||||
* @return $this
|
||||
*/
|
||||
public function to(string $openId)
|
||||
{
|
||||
$this->openId = $openId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 跳转路径
|
||||
* @param string $url
|
||||
* @return $this
|
||||
*/
|
||||
public function url(string $url)
|
||||
{
|
||||
$this->toUrl = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置背景颜色
|
||||
* @param string $color
|
||||
* @return $this
|
||||
*/
|
||||
public function color(?string $color)
|
||||
{
|
||||
$this->color = $color;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取模板code
|
||||
* @param string $templateId
|
||||
* @return null
|
||||
*/
|
||||
protected function getTemplateCode(string $templateId)
|
||||
{
|
||||
return $this->templateIds[$templateId] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 恢复默认值
|
||||
*/
|
||||
protected function clear()
|
||||
{
|
||||
$this->openId = null;
|
||||
$this->toUrl = null;
|
||||
$this->color = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
* @param string $templateId
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function send(string $templateId, array $data = []);
|
||||
|
||||
/**
|
||||
* 添加模板
|
||||
* @param string $shortId
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function add(string $shortId);
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
* @param string $templateId
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function delete(string $templateId);
|
||||
|
||||
/**
|
||||
* 获取所有模板
|
||||
* @return mixed
|
||||
*/
|
||||
abstract public function list();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user