Просмотр исходного кода

feat(profit-share): 新增分账接收方详情查看功能

- 后端新增 ProfitShareReceiverController::read 方法用于获取接收方详情
- Entity 层新增 getReceiver 方法支持按 ID 查询单条记录
- 前端新增 getProfitShareReceiverDetail API 接口- 接收方列表页移除变更申请按钮
- 接收方详情页改为从服务端加载真实数据并展示
-详情页增加变更申请操作按钮及对应跳转逻辑
- 优化详情页字段显示逻辑,增加空值处理- 调整部分字段标签文案和展示方式
runphp 4 месяцев назад
Родитель
Сommit
e1abab9b20

+ 6 - 0
src/Controller/Api/ProfitShareReceiverController.php

@@ -24,4 +24,10 @@ class ProfitShareReceiverController
         $params = ['user_id' => $request->userID];
         return page_response(page: $entity->getReceiverList($params, $request->pageAndLimit()));
     }
+
+    public function read(int $id, Request $request, ProfitShareReceiverEntity $entity):Response
+    {
+        $params = ['user_id' => $request->userID, 'id' => $id];
+        return success_response($entity->getReceiver($params));
+    }
 }

+ 12 - 1
src/Entity/ProfitShareReceiverEntity.php

@@ -38,8 +38,19 @@ class ProfitShareReceiverEntity extends BaseEntity
 
     public function getReceiverList(array $params, array $pageAndLimit):Paginator
     {
-        return $this->where('user_id', $params['user_id'])
+        return $this->where($params)
             ->append(['status_text'])
             ->paginate($pageAndLimit);
     }
+
+    public function getReceiver(array $params):self
+    {
+        $result = $this->where($params)
+            ->append(['status_text'])
+            ->findOrEmpty();
+        if ($result->isEmpty()) {
+            throw_logic_exception('分账接收方申请记录不存在!');
+        }
+        return $result;
+    }
 }