init
- 框架初始化 - 安装插件 - 修复PHP8.4报错
This commit is contained in:
28
application/admin/model/shopro/wechat/Material.php
Normal file
28
application/admin/model/shopro/wechat/Material.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\wechat;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Material extends Common
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
protected $name = 'shopro_wechat_material';
|
||||
|
||||
protected $type = [
|
||||
'content' => 'json',
|
||||
];
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text'
|
||||
];
|
||||
|
||||
public function typeList()
|
||||
{
|
||||
return ['text' => '文字', 'link' => '链接'];
|
||||
}
|
||||
}
|
||||
31
application/admin/model/shopro/wechat/Menu.php
Normal file
31
application/admin/model/shopro/wechat/Menu.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\wechat;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Menu extends Common
|
||||
{
|
||||
protected $name = 'shopro_wechat_menu';
|
||||
|
||||
protected $type = [
|
||||
'rules' => 'json',
|
||||
'publishtime' => 'timestamp',
|
||||
];
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'status_text'
|
||||
];
|
||||
|
||||
/**
|
||||
* 状态列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function statusList()
|
||||
{
|
||||
return [0 => '未发布', 1 => '已发布'];
|
||||
}
|
||||
}
|
||||
63
application/admin/model/shopro/wechat/Reply.php
Normal file
63
application/admin/model/shopro/wechat/Reply.php
Normal file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\model\shopro\wechat;
|
||||
|
||||
use app\admin\model\shopro\Common;
|
||||
use traits\model\SoftDelete;
|
||||
|
||||
class Reply extends Common
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $deleteTime = 'deletetime';
|
||||
|
||||
protected $name = 'shopro_wechat_reply';
|
||||
|
||||
// 追加属性
|
||||
protected $append = [
|
||||
'type_text',
|
||||
'group_text',
|
||||
'status_text',
|
||||
];
|
||||
|
||||
|
||||
public function getKeywordsAttr($value, $data)
|
||||
{
|
||||
if (!empty($value)) {
|
||||
return explode(',', $value);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
public function setKeywordsAttr($value, $data)
|
||||
{
|
||||
if (!empty($value)) {
|
||||
return implode(',', $value);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 状态列表
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function typeList()
|
||||
{
|
||||
return ['text' => '文字', 'link' => '链接', 'image' => '图片', 'voice' => '语音', 'video' => '视频', 'news' => '图文消息'];
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用类型获取器
|
||||
*
|
||||
* @param string $value
|
||||
* @param array $data
|
||||
* @return string
|
||||
*/
|
||||
public function getGroupTextAttr($value, $data)
|
||||
{
|
||||
$list = ['keywords' => '关键词回复', 'subscribe' => '关注回复', 'default' => '默认回复'];
|
||||
|
||||
$value = $value ?: ($data['group'] ?? null);
|
||||
|
||||
return isset($list[$value]) ? $list[$value] : '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user