feat: 新增地址选择插件及订阅消息等多项功能优化
- 新增地址选择插件,支持地图位置选择并返回地址和经纬度 - 新增微信订阅消息发送功能,支持审核结果、提现通知等场景 - 新增订单支付状态查询、提现收款人姓名保存等接口 - 新增服务区域管理,支持按省市区划分并同步到信息发布 - 新增资金流水和营收报表导出功能 - 新增可用优惠券查询、订单退款拆分处理等功能 - 优化后台角标显示、首页数据统计、UI配置下发等 - 修复订单支付并发问题、地区管理逻辑等
这个提交包含在:
@@ -11,7 +11,7 @@ use think\Cache;
|
||||
* 规则管理
|
||||
*
|
||||
* @icon fa fa-list
|
||||
* @remark 规则通常对应一个控制器的方法,同时左侧的菜单栏数据也从规则中体现,通常建议通过控制台进行生成规则节点
|
||||
* @remark 左侧菜单与权限节点都在这里维护;修改后左侧导航自动刷新,删除菜单会连同其子级一起删除
|
||||
*/
|
||||
class Rule extends Backend
|
||||
{
|
||||
@@ -57,8 +57,8 @@ class Rule extends Backend
|
||||
public function index()
|
||||
{
|
||||
if ($this->request->isAjax()) {
|
||||
$list = $this->rulelist;
|
||||
$total = count($this->rulelist);
|
||||
$list = $this->assignSeq($this->filterRuleList($this->rulelist));
|
||||
$total = count($list);
|
||||
$result = array("total" => $total, "rows" => $list);
|
||||
|
||||
return json($result);
|
||||
@@ -66,6 +66,116 @@ class Rule extends Backend
|
||||
return $this->view->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* 按筛选条件过滤规则树
|
||||
*
|
||||
* 支持:仅菜单 / 仅权限节点 / 全部、状态、关键词(标题或规则名)。
|
||||
* 命中节点的父级会一并保留,避免树形层级断裂。
|
||||
*
|
||||
* @param array $list
|
||||
* @return array
|
||||
*/
|
||||
protected function filterRuleList(array $list)
|
||||
{
|
||||
$type = (string)$this->request->request('rule_filter', 'menu');
|
||||
$status = (string)$this->request->request('rule_status', '');
|
||||
$keyword = trim((string)$this->request->request('rule_keyword', ''));
|
||||
|
||||
$type = in_array($type, ['menu', 'node', 'all'], true) ? $type : 'all';
|
||||
$status = in_array($status, ['normal', 'hidden'], true) ? $status : '';
|
||||
if ($type === 'all' && $status === '' && $keyword === '') {
|
||||
return $list;
|
||||
}
|
||||
|
||||
$byId = [];
|
||||
foreach ($list as $row) {
|
||||
$byId[(int)$row['id']] = $row;
|
||||
}
|
||||
|
||||
$keep = [];
|
||||
foreach ($list as $row) {
|
||||
$match = true;
|
||||
if ($type === 'menu' && !$row['ismenu']) {
|
||||
$match = false;
|
||||
}
|
||||
if ($type === 'node' && $row['ismenu']) {
|
||||
$match = false;
|
||||
}
|
||||
if ($status !== '' && $row['status'] !== $status) {
|
||||
$match = false;
|
||||
}
|
||||
if ($keyword !== '' && stripos($row['title'], $keyword) === false && stripos($row['name'], $keyword) === false) {
|
||||
$match = false;
|
||||
}
|
||||
if (!$match) {
|
||||
continue;
|
||||
}
|
||||
// 保留命中节点的所有父级
|
||||
$id = (int)$row['id'];
|
||||
$guard = 0;
|
||||
while ($id && isset($byId[$id]) && $guard++ < 20) {
|
||||
$keep[$id] = true;
|
||||
$id = (int)$byId[$id]['pid'];
|
||||
}
|
||||
}
|
||||
|
||||
$result = [];
|
||||
foreach ($list as $row) {
|
||||
if (isset($keep[(int)$row['id']])) {
|
||||
$result[] = $row;
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成层级序号:1、1.1、1.2、2、2.1……
|
||||
*
|
||||
* 树形列表默认会隐藏子行,若按行号显示序号会出现 1/7/28 这类跳号;
|
||||
* 这里按父子层级编号,展开/收起都稳定可读。
|
||||
*
|
||||
* @param array $list
|
||||
* @return array
|
||||
*/
|
||||
protected function assignSeq(array $list)
|
||||
{
|
||||
$byId = [];
|
||||
foreach ($list as $row) {
|
||||
$byId[(int)$row['id']] = $row;
|
||||
}
|
||||
|
||||
$seqById = [];
|
||||
$counters = [];
|
||||
foreach ($list as &$row) {
|
||||
$depth = 0;
|
||||
$pid = (int)$row['pid'];
|
||||
$guard = 0;
|
||||
while ($pid && isset($byId[$pid]) && $guard++ < 20) {
|
||||
$depth++;
|
||||
$pid = (int)$byId[$pid]['pid'];
|
||||
}
|
||||
|
||||
$counters[$depth] = isset($counters[$depth]) ? $counters[$depth] + 1 : 1;
|
||||
if ($depth === 0) {
|
||||
$seq = (string)$counters[$depth];
|
||||
} else {
|
||||
$parentSeq = isset($seqById[(int)$row['pid']]) ? $seqById[(int)$row['pid']] : '';
|
||||
$seq = ($parentSeq !== '' ? $parentSeq . '.' : '') . $counters[$depth];
|
||||
}
|
||||
|
||||
// 进入新分支后,重置更深的层级计数
|
||||
for ($i = $depth + 1; $i <= 10; $i++) {
|
||||
unset($counters[$i]);
|
||||
}
|
||||
|
||||
$row['seq'] = $seq;
|
||||
$seqById[(int)$row['id']] = $seq;
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*/
|
||||
|
||||
在新工单中引用
屏蔽一个用户