自动点赞 支持打标签

This commit is contained in:
wong
2025-05-16 18:43:11 +08:00
parent 950a06b8a7
commit b3b1dde54a
3 changed files with 10 additions and 18 deletions

View File

@@ -217,7 +217,7 @@ class WebSocketController extends BaseController
$wechatAccountId = !empty($data['wechatAccountId']) ? $data['wechatAccountId'] : '';
$wechatFriendId = !empty($data['wechatFriendId']) ? $data['wechatFriendId'] : 0;
$prevSnsId = !empty($data['prevSnsId']) ? $data['prevSnsId'] : 0;
$maxPages = 20; // 最大页数限制为20
$maxPages = 1; // 最大页数限制为20
$currentPage = 1; // 当前页码
$allMoments = []; // 存储所有朋友圈数据

View File

@@ -649,24 +649,12 @@ class WorkbenchController extends Controller
$page = $this->request->param('page', 1);
$limit = $this->request->param('limit', 10);
$workbenchId = $this->request->param('workbenchId', 0);
$startTime = $this->request->param('startTime', '');
$endTime = $this->request->param('endTime', '');
$where = [
['wali.workbenchId', '=', $workbenchId]
];
// 添加时间筛选
if (!empty($startTime) && !empty($endTime)) {
$where[] = ['wali.createTime', 'between', [
strtotime($startTime . ' 00:00:00'),
strtotime($endTime . ' 23:59:59')
]];
} elseif (!empty($startTime)) {
$where[] = ['wali.createTime', '>=', strtotime($startTime . ' 00:00:00')];
} elseif (!empty($endTime)) {
$where[] = ['wali.createTime', '<=', strtotime($endTime . ' 23:59:59')];
}
// 查询点赞记录
$list = Db::name('workbench_auto_like_item')->alias('wali')
@@ -686,7 +674,9 @@ class WorkbenchController extends Controller
'wm.createTime as momentTime',
'wm.userName',
'wa.nickName as operatorName',
'wa.avatar as operatorAvatar',
'wf.nickName as friendName',
'wf.avatar as friendAvatar',
])
->where($where)
->order('wali.createTime', 'desc')

View File

@@ -227,17 +227,16 @@ class WorkbenchJob
*/
protected function handleAutoLike($workbench, $config)
{
if (!$this->validateAutoLikeConfig($workbench, $config)) {
return;
}
// 验证是否达到点赞次数上限
$likeCount = $this->getTodayLikeCount($workbench, $config);
if ($likeCount >= $config['maxLikes']) {
Log::info("工作台 {$workbench->id} 点赞次数已达上限");
return;
}
// 验证是否在点赞时间范围内
if (!$this->isWithinLikeTimeRange($config)) {
return;
@@ -261,6 +260,8 @@ class WorkbenchJob
return;
}
foreach ($friendList as $friend) {
// 验证是否达到好友点赞次数上限
$friendMaxLikes = Db::name('workbench_auto_like_item')
@@ -542,10 +543,11 @@ class WorkbenchJob
{
$friends = json_decode($config['friends'], true);
$devices = json_decode($config['devices'], true);
$list = Db::table('s2_company_account')
->alias('ca')
->join(['s2_wechat_account' => 'wa'], 'ca.id = wa.deviceAccountId')
->join(['s2_wechat_friend' => 'wf'], 'ca.id = wf.accountId')
->join(['s2_wechat_friend' => 'wf'], 'ca.id = wf.accountId AND wf.wechatAccountId = wa.id')
->where([
'ca.status' => 0,
'wf.isDeleted' => 0,