Преглед на файлове

feat(api): 添加幸福币记录功能

- 新增 xfb_list 接口用于获取用户幸福币记录
- 实现分页查询功能
- 添加收支统计功能
- 在路由文件中注册新的 API 端点
- 添加完整的注释文档
shichen преди 3 месеца
родител
ревизия
364a6415ce
променени са 2 файла, в които са добавени 23 реда и са изтрити 0 реда
  1. 22 0
      app/controller/api/user/User.php
  2. 1 0
      route/api.php

+ 22 - 0
app/controller/api/user/User.php

@@ -616,6 +616,28 @@ class User extends BaseController
616 616
     }
617 617
 
618 618
 
619
+    /**
620
+     * @return mixed
621
+     * @throws \think\db\exception\DataNotFoundException
622
+     * @throws \think\db\exception\DbException
623
+     * @throws \think\db\exception\ModelNotFoundException
624
+     * @author 史晨
625
+     * @date 2026/4/9 14:16
626
+     * 幸福币列表
627
+     */
628
+    public function xfb_list()
629
+    {
630
+        $type = $this->request->param('type');
631
+        [$page, $limit] = $this->getPage();
632
+        $uid = $this->request->uid();
633
+        $where['uid'] = $uid;
634
+        $list = DB::name('user_sign_xfb')->where($where)->where('type', $type)->page($page, $limit)->order("id desc")->select();
635
+        $obtain = Db::name('user_sign_xfb')->where($where)->where('type', 1)->sum('number');
636
+        $consume = Db::name('user_sign_xfb')->where($where)->where('type', 2)->sum('number');
637
+        return app("json")->success(['list' => $list, 'obtain' => $obtain, 'consume' => $consume]);
638
+    }
639
+
640
+
619 641
     public function spread_info_yhc()
620 642
     {
621 643
         log::info("============ddddddddd");

+ 1 - 0
route/api.php

@@ -356,6 +356,7 @@ Route::group('api/', function () {
356 356
             Route::get('vr_name','User/vr_name');//VR名称
357 357
             Route::post('un_bind', 'User/unBindVxOrAli');//解绑微信或支付宝
358 358
 
359
+            Route::get('xfb_list','User/xfb_list');//购物金记录
359 360
         })->prefix('api.user.');
360 361
 
361 362
         // 共富区