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
292 lines
7.6 KiB
PHP
292 lines
7.6 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 crmeb\utils;
|
||
|
||
/**
|
||
* 操作数组帮助类
|
||
* Class Arr
|
||
* @package crmeb\utils
|
||
*/
|
||
class Arr
|
||
{
|
||
/**
|
||
* 对数组增加默认值
|
||
* @param array $keys
|
||
* @return array
|
||
*/
|
||
public static function getDefaultValue(array $keys, array $configList = [])
|
||
{
|
||
$value = [];
|
||
foreach ($keys as $val) {
|
||
if (is_array($val)) {
|
||
$k = $val[0] ?? '';
|
||
$v = $val[1] ?? '';
|
||
} else {
|
||
$k = $val;
|
||
$v = '';
|
||
}
|
||
$value[$k] = $configList[$k] ?? $v;
|
||
}
|
||
return $value;
|
||
}
|
||
|
||
/**
|
||
* 获取ivew菜单列表
|
||
* @param array $data
|
||
* @return array
|
||
*/
|
||
public static function getMenuIviewList(array $data)
|
||
{
|
||
return Arr::toIviewUi(Arr::getTree($data));
|
||
}
|
||
|
||
/**
|
||
* 转化iviewUi需要的key值
|
||
* @param $data
|
||
* @return array
|
||
*/
|
||
public static function toIviewUi($data)
|
||
{
|
||
$newData = [];
|
||
foreach ($data as $k => $v) {
|
||
$temp = [];
|
||
$temp['path'] = $v['menu_path'];
|
||
$temp['title'] = $v['menu_name'];
|
||
$temp['icon'] = $v['icon'];
|
||
$temp['header'] = $v['header'];
|
||
$temp['is_header'] = $v['is_header'];
|
||
if ($v['is_show_path']) {
|
||
$temp['auth'] = ['hidden'];
|
||
}
|
||
if (!empty($v['children'])) {
|
||
$temp['children'] = self::toIviewUi($v['children']);
|
||
}
|
||
$newData[] = $temp;
|
||
}
|
||
return $newData;
|
||
}
|
||
|
||
/**
|
||
* 获取树型菜单
|
||
* @param $data
|
||
* @param int $pid
|
||
* @param int $level
|
||
* @return array
|
||
*/
|
||
public static function getTree($data, $pid = 0, $level = 1)
|
||
{
|
||
$childs = self::getChild($data, $pid, $level);
|
||
$dataSort = array_column($childs, 'sort');
|
||
array_multisort($dataSort, SORT_DESC, $childs);
|
||
foreach ($childs as $key => $navItem) {
|
||
$resChild = self::getTree($data, $navItem['id']);
|
||
if (null != $resChild) {
|
||
$childs[$key]['children'] = $resChild;
|
||
}
|
||
}
|
||
return $childs;
|
||
}
|
||
|
||
/**
|
||
* 获取子菜单
|
||
* @param $arr
|
||
* @param $id
|
||
* @param $lev
|
||
* @return array
|
||
*/
|
||
private static function getChild(&$arr, $id, $lev)
|
||
{
|
||
$child = [];
|
||
foreach ($arr as $k => $value) {
|
||
if ($value['pid'] == $id) {
|
||
$value['level'] = $lev;
|
||
$child[] = $value;
|
||
}
|
||
}
|
||
return $child;
|
||
}
|
||
|
||
/**
|
||
* 格式化数据
|
||
* @param array $array
|
||
* @param $value
|
||
* @param int $default
|
||
* @return mixed
|
||
*/
|
||
public static function setValeTime(array $array, $value, $default = 0)
|
||
{
|
||
foreach ($array as $item) {
|
||
if (!isset($value[$item]))
|
||
$value[$item] = $default;
|
||
else if (is_string($value[$item]))
|
||
$value[$item] = (float)$value[$item];
|
||
}
|
||
return $value;
|
||
}
|
||
|
||
/**
|
||
* 获取二维数组中某个值的集合重新组成数组,并判断数组中的每一项是否为真
|
||
* @param array $data
|
||
* @param string $filed
|
||
* @return array
|
||
*/
|
||
public static function getArrayFilterValeu(array $data, string $filed)
|
||
{
|
||
return array_filter(array_unique(array_column($data, $filed)), function ($item) {
|
||
if ($item) {
|
||
return $item;
|
||
}
|
||
});
|
||
}
|
||
|
||
/**
|
||
* 获取二维数组中最大的值
|
||
* @param $arr
|
||
* @param $field
|
||
* @return int|string
|
||
*/
|
||
public static function getArrayMax($arr, $field)
|
||
{
|
||
$temp = [];
|
||
foreach ($arr as $k => $v) {
|
||
$temp[] = $v[$field];
|
||
}
|
||
if (!count($temp)) return 0;
|
||
$maxNumber = max($temp);
|
||
foreach ($arr as $k => $v) {
|
||
if ($maxNumber == $v[$field]) return $k;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
/**
|
||
* 获取二维数组中最小的值
|
||
* @param $arr
|
||
* @param $field
|
||
* @return int|string
|
||
*/
|
||
public static function getArrayMin($arr, $field)
|
||
{
|
||
$temp = [];
|
||
foreach ($arr as $k => $v) {
|
||
$temp[] = $v[$field];
|
||
}
|
||
if (!count($temp)) return 0;
|
||
$minNumber = min($temp);
|
||
foreach ($arr as $k => $v) {
|
||
if ($minNumber == $v[$field]) return $k;
|
||
}
|
||
return 0;
|
||
}
|
||
|
||
/**
|
||
* 数组转字符串去重复
|
||
* @param array $data
|
||
* @return false|string[]
|
||
*/
|
||
public static function unique(array $data)
|
||
{
|
||
return array_unique(explode(',', implode(',', $data)));
|
||
}
|
||
|
||
/**
|
||
* 获取数组中去重复过后的指定key值
|
||
* @param array $list
|
||
* @param string $key
|
||
* @return array
|
||
*/
|
||
public static function getUniqueKey(array $list, string $key)
|
||
{
|
||
return array_unique(array_column($list, $key));
|
||
}
|
||
|
||
/**
|
||
* 获取数组钟随机值
|
||
* @param array $data
|
||
* @return bool|mixed
|
||
*/
|
||
public static function getArrayRandKey(array $data)
|
||
{
|
||
if (!$data) {
|
||
return false;
|
||
}
|
||
mt_srand();
|
||
$mun = rand(0, count($data));
|
||
if (!isset($data[$mun])) {
|
||
return self::getArrayRandKey($data);
|
||
}
|
||
return $data[$mun];
|
||
}
|
||
|
||
/**
|
||
* 格式化数据
|
||
* @param array $list
|
||
* @return array
|
||
*/
|
||
public static function formatShipping(array $list)
|
||
{
|
||
$freeDate = [];
|
||
foreach ($list as $item) {
|
||
$freeDate[$item['uniqid']][] = $item;
|
||
}
|
||
$data = [];
|
||
foreach ($freeDate as $item) {
|
||
$cityIds = [];
|
||
$cityId = [];
|
||
$p = [];
|
||
foreach ($item as $value) {
|
||
$cityId[] = $value['city_id'];
|
||
$cityIds[] = is_array($value['value']) ? $value['value'] : json_decode($value['value'], true);
|
||
unset($value['city_id'], $value['value']);
|
||
$p = $value;
|
||
}
|
||
$p['city_id'] = $cityId;
|
||
$p['city_ids'] = $cityIds;
|
||
$data[] = $p;
|
||
}
|
||
return $data;
|
||
}
|
||
|
||
/**
|
||
* 过滤字段
|
||
* @param $value
|
||
* @param array $filter
|
||
* @return mixed
|
||
*/
|
||
public static function StrFilterValue($value, array $filter = [])
|
||
{
|
||
$filter = $filter ?: ['strip_tags', 'addslashes', 'trim', 'htmlspecialchars'];
|
||
foreach ($filter as $closure) {
|
||
if (function_exists($closure)) {
|
||
$value = $closure($value);
|
||
}
|
||
}
|
||
return $value;
|
||
}
|
||
|
||
/**
|
||
* 过滤字段
|
||
* @param array $data
|
||
* @return array
|
||
*/
|
||
public static function filterValue(array $data)
|
||
{
|
||
foreach ($data as &$item) {
|
||
if (is_array($item)) {
|
||
$item = self::filterValue($item);
|
||
} else {
|
||
$item = self::StrFilterValue($item);
|
||
}
|
||
}
|
||
return $data;
|
||
}
|
||
}
|