From 3f249e399659dcd09d3fe58071b146e50e45c17f Mon Sep 17 00:00:00 2001
From: wangzhibo <wangzhibo@shsening.com>
Date: 星期五, 14 八月 2026 21:56:15 +0800
Subject: [PATCH] 为小程序端增加接口

---
 src/modules/user/service/info.ts |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/src/modules/user/service/info.ts b/src/modules/user/service/info.ts
index 1331c45..c918e6f 100644
--- a/src/modules/user/service/info.ts
+++ b/src/modules/user/service/info.ts
@@ -8,6 +8,8 @@
 import { UserInfoEntity } from '../entity/info';
 import { UserSmsService } from './sms';
 import { UserWxService } from './wx';
+import { RecycleOrderEntity } from '../../shop/entity/recycleorder';
+
 
 /**
  * 鐢ㄦ埛淇℃伅
@@ -16,6 +18,9 @@
 export class UserInfoService extends BaseService {
   @InjectEntityModel(UserInfoEntity)
   userInfoEntity: Repository<UserInfoEntity>;
+
+  @InjectEntityModel(RecycleOrderEntity)
+  recycleOrderEntity: Repository<RecycleOrderEntity>;
 
   @Inject()
   pluginService: PluginService;
@@ -85,7 +90,7 @@
           uuid() + '.png'
         );
       }
-    } catch (err) {}
+    } catch (err) { }
     try {
       return await this.userInfoEntity.update({ id }, param);
     } catch (err) {
@@ -129,4 +134,27 @@
     }
     await this.userInfoEntity.update({ id: userId }, { phone });
   }
+
+  /**
+     * 鑾峰彇鐢ㄦ埛鐨勭⒊绉垎淇℃伅
+     * @param unionid
+     */
+  async dashboard(unionid) {
+    const info = await this.userInfoEntity.findOneBy({ unionid: unionid });
+    if (!info) {
+      throw new CoolCommException('鏌ヨ鏃犵粨鏋�');
+    }
+
+    const count_ = await this.recycleOrderEntity.countBy({
+      campusUserId: unionid
+    });
+
+
+    return { carbonPoints: info.carbonBalance, recycleCount:count_, overPercent: 90 }
+
+  }
+
+
+
+
 }

--
Gitblit v1.9.1