From 6da86d4e6d8511695a73ee64cd96e38e05820e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=B4=E6=98=8A=E5=A4=A9?= <442384644@qq.com> Date: Mon, 12 Oct 2026 15:04:58 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=A7=AF=E5=88=86=E8=AE=B0=E5=BD=95):=20?= =?UTF-8?q?=E8=A1=A5=E5=85=A8=E6=B5=81=E6=B0=B4=E7=B1=BB=E5=9E=8B=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E4=B8=8E=E5=85=B3=E8=81=94=E8=AE=A2=E5=8D=95=E5=9B=9E?= =?UTF-8?q?=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 搜索下拉收敛为主程序七类,列表 type_name 兜底旧链路类型,关联订单按中台/积分商城分组回查 --- .../integral/StorePointRecordServices.php | 43 +++++++++++++------ 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/backend/app/services/activity/integral/StorePointRecordServices.php b/backend/app/services/activity/integral/StorePointRecordServices.php index c8179efad..d0bbe6488 100644 --- a/backend/app/services/activity/integral/StorePointRecordServices.php +++ b/backend/app/services/activity/integral/StorePointRecordServices.php @@ -40,21 +40,40 @@ class StorePointRecordServices extends BaseService public function pointRecord($where) { $where['category'] = 'integral'; + // 主程序积分流水仅七类,搜索下拉即此七项(新族别名 gain/product_gain 等历史类型不在下拉,仅做列表显示兜底) $status = [ - 'invite_user' => '邀新奖励', 'system_add' => '系统增加积分', 'system_sub' => '系统减少积分', + 'sign' => '签到获得积分', + 'order_give_integral' => '下单赠送积分', + 'pay_give_integral' => '购买商品赠送积分', + 'order_gain_refund' => '退款返还下单赠送积分', + 'product_gain_refund' => '退款返还购买商品赠送积分', + ]; + // 列表 type_name 显示映射:含旧链路落库类型 + $typeNames = $status + [ 'gain' => '下单赠送积分', 'product_gain' => '购买商品赠送积分', - 'deduction' => '下单积分抵扣', - 'lottery_use' => '参与抽奖使用积分', - 'lottery_add' => '抽奖中奖赠送积分', - 'lottery_give_integral' => '抽奖中奖赠送积分', - 'order_deduction' => '扣除订单下单赠送积分', - 'storeIntegral_use' => '积分兑换商品', + 'order_deduction' => '退款返还下单赠送积分', + 'integral_refund' => '退款返还下单赠送积分', 'pay_product_integral_back' => '返还下单使用积分', - 'sign' => '签到获得积分', ]; + // link_id 存中台订单主键、可回查订单号的类型 + $orderLinkTypes = [ + 'gain', + 'product_gain', + 'order_give_integral', + 'pay_give_integral', + 'order_gain_refund', + 'product_gain_refund', + 'deduction', + 'product_deduction', + 'order_deduction', + 'integral_refund', + 'pay_product_integral_back', + ]; + // link_id 存积分商城订单主键的类型 + $integralOrderTypes = ['storeIntegral_use', 'storeIntegral_use_integral']; [$page, $limit] = $this->getPageValue(); $list = $this->dao->getList($where, '*', $page, $limit); //关联用户 @@ -69,14 +88,14 @@ class StorePointRecordServices extends BaseService $integralOrderServices = app()->make(StoreIntegralOrderServices::class); foreach ($list as &$item) { $item['nickname'] = $nicknameArr[$item['uid']] ?? '未知用户'; - if ($item['type'] == 'gain' || $item['type'] == 'deduction' || $item['type'] == 'product_deduction' || $item['type'] == 'pay_product_integral_back') { + if (in_array($item['type'], $orderLinkTypes)) { $item['relation'] = $orderServices->value(['id' => $item['link_id']], 'order_no'); - } elseif ($item['type'] == 'storeIntegral_use') { + } elseif (in_array($item['type'], $integralOrderTypes)) { $item['relation'] = $integralOrderServices->value(['id' => $item['link_id']], 'order_id'); } else { - $item['relation'] = $status[$item['type']] ?? ''; + $item['relation'] = $typeNames[$item['type']] ?? ''; } - $item['type_name'] = $status[$item['type']] ?? $item['type']; + $item['type_name'] = $typeNames[$item['type']] ?? $item['type']; } $count = $this->dao->count($where); return compact('list', 'count', 'status');