Phase1 后端核心:
- 新增 fsgx_v1.sql 迁移脚本(is_queue_goods/frozen_points/available_points/no_assess)
- SystemConfigServices 返佣设置扩展(周期人数/分档比例/范围/时机)
- StoreOrderCreateServices 周期循环佣金计算
- StoreOrderTakeServices 佣金发放后同步冻结积分
- StoreProductServices/StoreProduct 保存 is_queue_goods
Phase2 后端接口:
- GET /api/hjf/brokerage/progress 佣金周期进度
- GET /api/hjf/assets/overview 资产总览
- HjfPointsServices 每日 frozen_points 0.4‰ 释放定时任务
- PUT /adminapi/hjf/member/{uid}/no_assess 不考核接口
- GET /adminapi/hjf/points/release_log 积分日志接口
Phase3 前端清理:
- hjfCustom.js 路由精简(仅保留 points/log)
- hjfQueue.js/hjfMember.js API 清理/重定向至 CRMEB 原生接口
- pages.json 公排→推荐佣金/佣金记录/佣金规则
Phase4-5 前端改造:
- queue/status.vue 推荐佣金进度页整体重写
- 商品详情/订单确认/支付结果页文案与逻辑改造
- 个人中心/资产页/引导页/规则页文案改造
- HjfQueueProgress/HjfRefundNotice/HjfAssetCard 组件改造
- 推广中心嵌入佣金进度摘要
- hjfMockData.js 全量更新(公排字段→佣金字段)
Phase6 Admin 增强:
- 用户列表新增 frozen_points/available_points 列及不考核操作按钮
- hjfPoints.js USE_MOCK=false 对接真实积分日志接口
Phase7 配置文档:
- docs/fsgx-phase7-config-checklist.md 后台配置与全链路验收清单
Made-with: Cursor
139 lines
4.1 KiB
PHP
139 lines
4.1 KiB
PHP
<?php
|
||
// +----------------------------------------------------------------------
|
||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||
// +----------------------------------------------------------------------
|
||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||
// +----------------------------------------------------------------------
|
||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||
// +----------------------------------------------------------------------
|
||
// | Author: CRMEB Team <admin@crmeb.com>
|
||
// +----------------------------------------------------------------------
|
||
declare (strict_types=1);
|
||
|
||
namespace app\services\community;
|
||
|
||
use app\services\BaseServices;
|
||
use crmeb\services\CacheService;
|
||
|
||
|
||
class CommunityCacheServices extends BaseServices
|
||
{
|
||
//帖子点赞
|
||
const COMMUNITY_LIKE = 'community_like';
|
||
|
||
//评论点赞
|
||
const COMMUNITY_COMMENT_LIKE = 'community_comment_like';
|
||
|
||
//浏览
|
||
const COMMUNITY_BROWSE = 'community_browse';
|
||
|
||
//是否关注
|
||
const COMMUNITY_INTEREST = 'community_interest';
|
||
|
||
//最新一条id
|
||
const COMMUNITY_NEWEST = 'community_newest';
|
||
|
||
//话题总数
|
||
const COMMUNITY_TOPIC_COUNT = 'community_topic_count';
|
||
/**
|
||
* 点赞操作
|
||
*
|
||
* @param int $id 被点赞对象的ID
|
||
* @param int $uid 执行点赞操作的用户ID
|
||
* @param string $type 点赞类型, 默认为社区点赞
|
||
*
|
||
* @return mixed 返回点赞操作的结果,通常是受影响的元素数量
|
||
* User: liusl
|
||
* DateTime: 2024/8/9 17:07
|
||
*/
|
||
public function setLike(int $id, int $uid, int $status = 1, string $type = self::COMMUNITY_LIKE)
|
||
{
|
||
$key = $type . '_' . $id;
|
||
$status == 1 ? CacheService::redisHandler()->sAdd($key, $uid) : CacheService::redisHandler()->sRem($key, $uid);
|
||
return true;
|
||
}
|
||
|
||
/**
|
||
* 是否点赞
|
||
* @param int $id
|
||
* @param int $uid
|
||
* @param string $type
|
||
* @return mixed
|
||
* User: liusl
|
||
* DateTime: 2024/8/9 17:07
|
||
*/
|
||
public function checkUserLike(int $id, int $uid, string $type = self::COMMUNITY_LIKE)
|
||
{
|
||
$key = $type . '_' . $id;
|
||
|
||
return CacheService::redisHandler()->sIsMember($key, $uid) ? 1 : 0;
|
||
}
|
||
|
||
/**
|
||
* 删除
|
||
* @param int $id
|
||
* @param int $uid
|
||
* @param string $type
|
||
* @return mixed
|
||
* User: liusl
|
||
* DateTime: 2024/8/28 16:35
|
||
*/
|
||
public function deleteKey(int $id, string $type = self::COMMUNITY_LIKE)
|
||
{
|
||
$key = $type . '_' . $id;
|
||
return CacheService::redisHandler()->del($key);
|
||
}
|
||
|
||
/**
|
||
* 多个帖子是否点赞
|
||
* @param array $ids
|
||
* @param int $uid
|
||
* @param string $type
|
||
* @return array
|
||
* User: liusl
|
||
* DateTime: 2024/8/9 17:19
|
||
*/
|
||
public function checkUserLikeMultiple(array $ids, int $uid, string $type = self::COMMUNITY_LIKE)
|
||
{
|
||
$userLikes = [];
|
||
foreach ($ids as $id) {
|
||
$userLikes[$id] = $this->checkUserLike($id, $uid, $type);
|
||
}
|
||
return $userLikes;
|
||
}
|
||
|
||
/**
|
||
* 存用户最新一条帖子
|
||
* @param int $uid
|
||
* @param int $id
|
||
* @return bool
|
||
* User: liusl
|
||
* DateTime: 2024/9/12 19:42
|
||
*/
|
||
public function setCommunityNewest(int $uid, int $id)
|
||
{
|
||
$key = self::COMMUNITY_NEWEST . $uid;
|
||
/** @var CacheService $cacheServices */
|
||
$cacheServices = app()->make(CacheService::class);
|
||
return $cacheServices->set($key, $id,0);
|
||
}
|
||
|
||
/**
|
||
* 检查用户是否已读作者最新一条帖子
|
||
* @param int $uid
|
||
* @param int $author_uid
|
||
* @return int
|
||
* User: liusl
|
||
* DateTime: 2024/9/12 19:58
|
||
*/
|
||
public function checkCommunityNewest(int $uid, int $author_uid)
|
||
{
|
||
$key = self::COMMUNITY_NEWEST . $author_uid;
|
||
/** @var CacheService $cacheServices */
|
||
$cacheServices = app()->make(CacheService::class);
|
||
$new_id = $cacheServices->get($key);
|
||
if (!$new_id) return 0;
|
||
return $this->checkUserLike((int)$new_id, $uid, self::COMMUNITY_BROWSE) ? 0 : 1;
|
||
}
|
||
}
|