更新
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 企业微信会话存档消息
|
||||
*
|
||||
* 数据来源为「会话内容存档」SDK 拉取后解密落库,msgid 官方唯一。
|
||||
* 消息体字段根据 msgtype 有不同含义,统一用 content(摘要/文本)+ raw(原始 JSON)组合存储,
|
||||
* 具体渲染放到业务层(前端或 Logic)再按需展开。
|
||||
*/
|
||||
class QywxMsgArchive extends BaseModel
|
||||
{
|
||||
protected $name = 'qywx_msg_archive';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
protected $type = [
|
||||
'send_time' => 'integer',
|
||||
'seq' => 'integer',
|
||||
'file_size' => 'integer',
|
||||
'play_length' => 'integer',
|
||||
];
|
||||
|
||||
/** JSON 反序列化 to_list 访问器,便于业务层直接拿数组 */
|
||||
public function getToListAttr($value): array
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return [];
|
||||
}
|
||||
if (is_array($value)) {
|
||||
return $value;
|
||||
}
|
||||
$decoded = json_decode((string) $value, true);
|
||||
return is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
|
||||
public function setToListAttr($value): string
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
class QywxMsgArchiveCursor extends BaseModel
|
||||
{
|
||||
protected $name = 'qywx_msg_archive_cursor';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
public const DEFAULT_KEY = 'global';
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
class QywxMsgArchiveMedia extends BaseModel
|
||||
{
|
||||
protected $name = 'qywx_msg_archive_media';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
public const STATUS_PENDING = 0;
|
||||
public const STATUS_SUCCESS = 1;
|
||||
public const STATUS_FAILED = 2;
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 员工代发消息(企业群发)任务
|
||||
*
|
||||
* 企业群发 add_msg_template 的特性:
|
||||
* - 必须以「员工身份」为 sender 代发,客户端显示为员工本人
|
||||
* - 员工手机端会弹一次"发送确认",员工点确认后才真正送达客户;admin 后台无法强制送达
|
||||
* - 返回的 msgid 可通过 get_group_msg_send_result 查询确认 / 送达结果
|
||||
*
|
||||
* 状态:
|
||||
* 0=待提交、1=已提交等待员工确认、2=员工已确认发送、3=失败
|
||||
*/
|
||||
class QywxMsgSendTask extends BaseModel
|
||||
{
|
||||
protected $name = 'qywx_msg_send_task';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
|
||||
public const STATUS_PENDING = 0;
|
||||
public const STATUS_SUBMITTED = 1;
|
||||
public const STATUS_SENT = 2;
|
||||
public const STATUS_FAILED = 3;
|
||||
|
||||
public function getExternalUseridsAttr($value): array
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return [];
|
||||
}
|
||||
$decoded = json_decode((string) $value, true);
|
||||
return is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
|
||||
public function setExternalUseridsAttr($value): string
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function getMsgPayloadAttr($value)
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return [];
|
||||
}
|
||||
$decoded = json_decode((string) $value, true);
|
||||
return is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
|
||||
public function setMsgPayloadAttr($value): string
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
|
||||
public function getFailListAttr($value)
|
||||
{
|
||||
if ($value === null || $value === '') {
|
||||
return [];
|
||||
}
|
||||
$decoded = json_decode((string) $value, true);
|
||||
return is_array($decoded) ? $decoded : [];
|
||||
}
|
||||
|
||||
public function setFailListAttr($value): string
|
||||
{
|
||||
if (is_string($value)) {
|
||||
return $value;
|
||||
}
|
||||
return json_encode($value ?? [], JSON_UNESCAPED_UNICODE);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace app\common\model;
|
||||
|
||||
/**
|
||||
* 企业微信 员工×客户 会话索引(用于 admin 聊天页左侧会话列表)
|
||||
*/
|
||||
class QywxMsgSession extends BaseModel
|
||||
{
|
||||
protected $name = 'qywx_msg_session';
|
||||
protected $autoWriteTimestamp = 'int';
|
||||
}
|
||||
Reference in New Issue
Block a user