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
120 lines
4.9 KiB
PHP
120 lines
4.9 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>
|
||
// +----------------------------------------------------------------------
|
||
|
||
namespace app\services\store;
|
||
|
||
|
||
use app\dao\store\StoreUserDao;
|
||
use app\services\BaseServices;
|
||
use app\services\user\level\SystemUserLevelServices;
|
||
use app\services\user\level\UserLevelServices;
|
||
use app\services\user\UserServices;
|
||
use think\annotation\Inject;
|
||
use think\exception\ValidateException;
|
||
|
||
/**
|
||
* 门店用户
|
||
* Class StoreUser
|
||
* @package app\services\store
|
||
* @mixin StoreUserDao
|
||
*/
|
||
class StoreUserServices extends BaseServices
|
||
{
|
||
/**
|
||
* @var StoreUserDao
|
||
*/
|
||
#[Inject]
|
||
protected StoreUserDao $dao;
|
||
|
||
|
||
|
||
/**
|
||
* 获取门店用户列表
|
||
* @param array $where 查询条件
|
||
* @param int $store_id 门店ID
|
||
* @return array
|
||
*/
|
||
public function index(array $where, int $store_id)
|
||
{
|
||
$where['store_id'] = $store_id;
|
||
/** @var UserStoreUserServices $userStoreUserServices */
|
||
$userStoreUserServices = app()->make(UserStoreUserServices::class);
|
||
$fields = 'u.*';
|
||
[$list, $count] = $userStoreUserServices->getWhereUserList($where, $fields);
|
||
if ($list) {
|
||
$uids = array_column($list, 'uid');
|
||
/** @var UserServices $userServices */
|
||
$userServices = app()->make(UserServices::class);
|
||
$userlabel = $userServices->getUserLablel($uids, $store_id);
|
||
$levelName = app()->make(SystemUserLevelServices::class)->getUsersLevel(array_unique(array_column($list, 'level')));
|
||
$userLevel = app()->make(UserLevelServices::class)->getUsersLevelInfo($uids);
|
||
$spread_names = $userServices->getColumn([['uid', 'in', $uids]], 'nickname', 'uid');
|
||
/** @var SystemStoreStaffServices $staffServices */
|
||
$staffServices = app()->make(SystemStoreStaffServices::class);
|
||
$staffNames = $staffServices->getColumn([['store_id', '=', $store_id], ['uid', 'in', array_column($list, 'uid')], ['is_del', '=', 0]], 'uid,staff_name', 'uid');
|
||
foreach ($list as &$item) {
|
||
$item['status'] = ($item['status'] == 1) ? '正常' : '禁止';
|
||
// $item['birthday'] = $item['birthday'] ? date('Y-m-d', (int)$item['birthday']) : '';
|
||
$item['spread_uid_nickname'] = $item['spread_uid'] ? ($spread_names[$item['spread_uid']] ?? '') . '/' . $item['spread_uid'] : '无';
|
||
$item['staff_name'] = $staffNames[$item['uid']]['staff_name'] ?? '';
|
||
//用户类型
|
||
if ($item['user_type'] == 'routine') {
|
||
$item['user_type'] = '小程序';
|
||
} else if ($item['user_type'] == 'wechat') {
|
||
$item['user_type'] = '公众号';
|
||
} else if ($item['user_type'] == 'h5') {
|
||
$item['user_type'] = 'H5';
|
||
} else if ($item['user_type'] == 'pc') {
|
||
$item['user_type'] = 'PC';
|
||
} else if ($item['user_type'] == 'app') {
|
||
$item['user_type'] = 'APP';
|
||
} else $item['user_type'] = '其他';
|
||
//等级名称
|
||
$item['level'] = $levelName[$item['level']] ?? '无';
|
||
//用户等级
|
||
$item['vip_name'] = false;
|
||
$levelinfo = $userLevel[$item['uid']] ?? null;
|
||
if ($levelinfo) {
|
||
if ($levelinfo && ($levelinfo['is_forever'] || time() < $levelinfo['valid_time'])) {
|
||
$item['vip_name'] = $item['level'] != '无' ? $item['level'] : false;
|
||
}
|
||
}
|
||
$item['labels'] = $userlabel[$item['uid']] ?? '';
|
||
$item['isMember'] = $item['is_money_level'] > 0 ? 1 : 0;
|
||
}
|
||
}
|
||
|
||
return compact('count', 'list');
|
||
}
|
||
|
||
|
||
/**
|
||
* 同步写入门店用户
|
||
* @param int $uid
|
||
* @param int $store_id
|
||
* @return bool
|
||
* @throws \think\db\exception\DataNotFoundException
|
||
* @throws \think\db\exception\DbException
|
||
* @throws \think\db\exception\ModelNotFoundException
|
||
*/
|
||
public function setStoreUser(int $uid, int $store_id)
|
||
{
|
||
$storeUser = $this->dao->getOne(['uid' => $uid, 'store_id' => $store_id]);
|
||
if (!$storeUser) {
|
||
if (!$this->dao->save(['uid' => $uid, 'store_id' => $store_id, 'add_time' => time()])) {
|
||
throw new ValidateException('新增门店用户失败');
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
|
||
}
|