私域操盘手 - 调整微信账号限制记录至模型WechatRestrictsModel

This commit is contained in:
柳清爽
2025-05-14 15:00:21 +08:00
parent 798b0d7854
commit 2ad1b99ea3
3 changed files with 44 additions and 26 deletions

View File

@@ -1010,7 +1010,8 @@ export default function WechatAccountDetailPage() {
</DialogHeader>
<ScrollArea className="max-h-[400px]">
<div className="space-y-4">
{accountSummary && accountSummary.restrictions.map((record) => (
{accountSummary?.restrictions?.length > 0 ? (
accountSummary.restrictions.map((record) => (
<div key={record.id} className="border-b pb-4 last:border-0">
<div className="flex justify-between items-start">
<div className={`text-sm ${getRestrictionLevelColor(record.level)}`}>
@@ -1020,7 +1021,12 @@ export default function WechatAccountDetailPage() {
</div>
<div className="text-sm text-gray-500 mt-1">{formatDateTime(record.date)}</div>
</div>
))}
))
) : (
<div className="text-center py-8 text-green-500">
</div>
)}
</div>
</ScrollArea>
</DialogContent>

View File

@@ -0,0 +1,17 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信风险受限记录
*/
class WechatRestricts extends Model
{
const LEVEL_WARNING = 2;
const LEVEL_ERROR = 3;
// 设置数据表名
protected $name = 'wechat_restricts';
}

View File

@@ -4,6 +4,7 @@ namespace app\cunkebao\controller\wechat;
use app\common\model\WechatAccount as WechatAccountModel;
use app\common\model\WechatFriendShip as WechatFriendShipModel;
use app\common\model\WechatRestricts as WechatRestrictsModel;
use app\cunkebao\controller\BaseController;
use library\ResponseHelper;
@@ -60,27 +61,21 @@ class GetWechatOnDeviceSummarizeV1Controller extends BaseController
}
/**
* TODO 获取限制记录
* 获取限制记录
*
* @param string $wechatId
* @return array
*/
protected function getRestrict(string $wechatId): array
{
return [
return WechatRestrictsModel::alias('r')
->field(
[
'id' => 1,
'level' => 2,
'reason' => '频繁添加好友',
'date' => date('Y-m-d H:i:s', strtotime('-1 day')),
],
[
'id' => 2,
'level' => 3,
'reason' => '营销内容违规',
'date' => date('Y-m-d H:i:s', strtotime('-1 day')),
],
];
'r.id', 'r.restrictTime date', 'r.level', 'r.reason'
]
)
->where('r.wechatId', $wechatId)->select()
->toArray();
}
/**