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
278 lines
7.8 KiB
PHP
278 lines
7.8 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;
|
||
|
||
use crmeb\traits\Macroable;
|
||
|
||
/**
|
||
* Class Request
|
||
* @package app
|
||
* @method tokenData() 获取token信息
|
||
* @method user(string $key = null) 获取用户信息
|
||
* @method uid() 获取用户uid
|
||
* @method isAdminLogin() 后台登陆状态
|
||
* @method adminId() 后台管理员id
|
||
* @method adminInfo() 后台管理信息
|
||
* @method adminType() 后台管理类型
|
||
* @method kefuId() 客服id
|
||
* @method kefuInfo() 客服信息
|
||
* @method outId() 对外接口用户id
|
||
* @method outInfo() 对外接口用户id
|
||
* @method storeId() 门店ID
|
||
* @method storeStaffId() 门店管理员id
|
||
* @method storeStaffInfo() 门店管理员信息
|
||
* @method cashierId() 门店收银员id
|
||
* @method cashierInfo() 门店收银员信息
|
||
* @method clientInfo() 企业微信客户信息
|
||
* @method userid() 企业微信客户userid
|
||
* @method supplierId() 供应商id
|
||
* @method supplierInfo() 供应商信息
|
||
*/
|
||
class Request extends \think\Request
|
||
{
|
||
|
||
public $tokenData; //获取token信息
|
||
public $user; //获取用户信息
|
||
public $uid; //获取用户uid
|
||
public $isLogin;
|
||
public $isAdminLogin; //后台登陆状态
|
||
public $adminId; //后台管理员id
|
||
public $adminInfo; //后台管理信息
|
||
public $adminType; //后台管理类型
|
||
public $kefuId; //客服id
|
||
public $kefuInfo; //客服信息
|
||
public $outId; //对外接口用户id
|
||
public $outInfo; //对外接口用户id
|
||
public $storeId; //门店ID
|
||
public $storeStaffId; //门店管理员id
|
||
public $storeStaffInfo; //门店管理员信息
|
||
public $cashierId; //门店收银员id
|
||
public $cashierInfo; //门店收银员信息
|
||
public $clientInfo; //企业微信客户信息
|
||
public $userid; //企业微信客户userid
|
||
public $supplierId; //供应商id
|
||
public $supplierInfo; //供应商信息
|
||
|
||
/**
|
||
* 登录保存参数
|
||
* @var array
|
||
*/
|
||
protected $loginParam = [
|
||
'tokenData', 'user', 'uid', 'isLogin',
|
||
'isAdminLogin', 'adminId', 'adminInfo',
|
||
'kefuId', 'kefuInfo',
|
||
'outId', 'outInfo',
|
||
'storeId', 'storeStaffId', 'storeStaffInfo',
|
||
'cashierId', 'cashierInfo',
|
||
'clientInfo', 'userid',
|
||
'supplierId', 'supplierInfo', 'adminType'
|
||
];
|
||
/**
|
||
* 不过滤变量名
|
||
* @var array
|
||
*/
|
||
protected array $except = [
|
||
'menu_path', 'api_url', 'unique_auth',
|
||
'description', 'custom_form', 'product_detail_diy', 'member', 'product_category_diy', 'value','val'
|
||
];
|
||
|
||
/**
|
||
* 获取请求的数据
|
||
* @param array $params
|
||
* @param bool $suffix
|
||
* @param bool $filter
|
||
* @return array
|
||
*/
|
||
public function more(array $params, bool $suffix = false, bool $filter = true): array
|
||
{
|
||
$p = [];
|
||
$i = 0;
|
||
foreach ($params as $param) {
|
||
if (!is_array($param)) {
|
||
$p[$suffix == true ? $i++ : $param] = $this->param($param);
|
||
} else {
|
||
if (!isset($param[1])) $param[1] = null;
|
||
if (!isset($param[2])) $param[2] = '';
|
||
if (is_array($param[0])) {
|
||
$name = is_array($param[1]) ? $param[0][0] . '/a' : $param[0][0] . '/' . $param[0][1];
|
||
$keyName = $param[0][0];
|
||
} else {
|
||
$name = is_array($param[1]) ? $param[0] . '/a' : $param[0];
|
||
$keyName = $param[0];
|
||
}
|
||
|
||
$p[$suffix == true ? $i++ : ($param[3] ?? $keyName)] = $this->param($name, $param[1], $param[2]);
|
||
}
|
||
}
|
||
|
||
if ($filter && $p) {
|
||
$p = $this->filterArrayValues($p);
|
||
}
|
||
|
||
return $p;
|
||
}
|
||
|
||
/**
|
||
* @param $array
|
||
* @return array
|
||
*/
|
||
public function filterArrayValues($array)
|
||
{
|
||
$result = [];
|
||
foreach ($array as $key => $value) {
|
||
if (is_array($value)) {
|
||
// 如果值是数组,递归调用 filterArrayValues
|
||
$result[$key] = in_array($key, $this->except) ? $value : $this->filterArrayValues($value);
|
||
} else {
|
||
if (in_array($key, $this->except) || is_int($value) || is_null($value)) {
|
||
$result[$key] = $value;
|
||
} else {
|
||
// 如果值是字符串,过滤特殊字符
|
||
$result[$key] = filter_str($value);
|
||
}
|
||
|
||
}
|
||
}
|
||
return $result;
|
||
}
|
||
|
||
|
||
/**
|
||
* 获取get参数
|
||
* @param array $params
|
||
* @param bool $suffix
|
||
* @param bool $filter
|
||
* @return array
|
||
*/
|
||
public function getMore(array $params, bool $suffix = false, bool $filter = true): array
|
||
{
|
||
return $this->more($params, $suffix, $filter);
|
||
}
|
||
|
||
/**
|
||
* 获取post参数
|
||
* @param array $params
|
||
* @param bool $suffix
|
||
* @param bool $filter
|
||
* @return array
|
||
*/
|
||
public function postMore(array $params, bool $suffix = false, bool $filter = true): array
|
||
{
|
||
return $this->more($params, $suffix, $filter);
|
||
}
|
||
|
||
/**
|
||
* 获取用户访问端
|
||
* @return array|string|null
|
||
*/
|
||
public function getFromType()
|
||
{
|
||
return $this->header('Form-type', '');
|
||
}
|
||
|
||
/**
|
||
* 当前访问端
|
||
* @param string $terminal
|
||
* @return bool
|
||
*/
|
||
public function isTerminal(string $terminal)
|
||
{
|
||
return strtolower($this->getFromType()) === $terminal;
|
||
}
|
||
|
||
/**
|
||
* 是否是H5端
|
||
* @return bool
|
||
*/
|
||
public function isH5()
|
||
{
|
||
return $this->isTerminal('h5');
|
||
}
|
||
|
||
/**
|
||
* 是否是微信端
|
||
* @return bool
|
||
*/
|
||
public function isWechat()
|
||
{
|
||
return $this->isTerminal('wechat');
|
||
}
|
||
|
||
/**
|
||
* 是否是小程序端
|
||
* @return bool
|
||
*/
|
||
public function isRoutine()
|
||
{
|
||
return $this->isTerminal('routine');
|
||
}
|
||
|
||
/**
|
||
* 是否是app端
|
||
* @return bool
|
||
*/
|
||
public function isApp()
|
||
{
|
||
return $this->isTerminal('app');
|
||
}
|
||
|
||
/**
|
||
* 是否是app端
|
||
* @return bool
|
||
*/
|
||
public function isPc()
|
||
{
|
||
return $this->isTerminal('pc');
|
||
}
|
||
|
||
/**
|
||
* 获取ip
|
||
* @return string
|
||
*/
|
||
public function ip(): string
|
||
{
|
||
if ($this->server('HTTP_CLIENT_IP', '')) {
|
||
$ip = $this->server('HTTP_CLIENT_IP', '');
|
||
} elseif ($this->server('HTTP_X_REAL_IP', '')) {
|
||
$ip = $this->server('HTTP_X_REAL_IP', '');
|
||
} elseif ($this->server('HTTP_X_FORWARDED_FOR', '')) {
|
||
$ip = $this->server('HTTP_X_FORWARDED_FOR', '');
|
||
$ips = explode(',', $ip);
|
||
$ip = $ips[0];
|
||
} elseif ($this->server('REMOTE_ADDR', '')) {
|
||
$ip = $this->server('REMOTE_ADDR', '');
|
||
} else {
|
||
$ip = '0.0.0.0';
|
||
}
|
||
return $ip;
|
||
}
|
||
|
||
public function hasMacro(string $name): bool
|
||
{
|
||
return !!$this->{$name};
|
||
}
|
||
|
||
|
||
public function __call($method, $parameters)
|
||
{
|
||
if (in_array($method, $this->loginParam)) {
|
||
$result = $this->{$method};
|
||
if (is_callable($result)) {
|
||
return call_user_func_array($result, $parameters);
|
||
} else {
|
||
return $result;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
}
|