From a34e0fcf201e9f24d383dd80c47605468c725770 Mon Sep 17 00:00:00 2001 From: zpc Date: Sun, 8 Feb 2026 01:02:07 +0800 Subject: [PATCH] 213 --- honey_box/package/index/leitai.vue | 5 ++- honey_box/package/index/lian-ji.vue | 5 ++- honey_box/pages/infinite/benefit.vue | 5 ++- honey_box/pages/infinite/index.vue | 5 ++- honey_box/pages/mall/index.vue | 5 ++- honey_box/pages/shouye/detail.vue | 5 ++- honey_box/pages/shouye/detail_wuxian.vue | 5 ++- honey_box/pages/shouye/index.vue | 17 ++++++++-- honey_box/pages/user/change.vue | 3 +- honey_box/pages/user/index.vue | 5 ++- honey_box/pages/user/tui-guang.vue | 33 +++++++++++++++---- .../HoneyBox.Model/Models/Auth/UserInfoDto.cs | 12 ++++++- 12 files changed, 87 insertions(+), 18 deletions(-) diff --git a/honey_box/package/index/leitai.vue b/honey_box/package/index/leitai.vue index b7cd1421..a46be3ab 100644 --- a/honey_box/package/index/leitai.vue +++ b/honey_box/package/index/leitai.vue @@ -490,6 +490,9 @@ export default { }, onShareAppMessage() { + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync("userinfo") || {}; + const pid = userinfo.id || userinfo.ID || ''; return { title: this.$config.getAppSetting("app_name") + `${this.pageData.goods.title}系列 第${this.pageData.goods.num}套`, @@ -498,7 +501,7 @@ export default { this.$c.qs({ goods_id: this.pageData.goods.id, goods_num: this.pageData.goods.num, - pid: uni.getStorageSync("userinfo").ID, + pid: pid, }), }; }, diff --git a/honey_box/package/index/lian-ji.vue b/honey_box/package/index/lian-ji.vue index 069b5a54..b32acac1 100644 --- a/honey_box/package/index/lian-ji.vue +++ b/honey_box/package/index/lian-ji.vue @@ -554,6 +554,9 @@ } } + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { title: this.$config.getAppSetting("app_name") + `${this.pageData.goods.title}系列`, imageUrl: this.pageData.goods.imgurl_detail, @@ -561,7 +564,7 @@ this.$c.qs({ goods_id: this.pageData.goods.id, goods_num: this.pageData.goods.num, - pid: uni.getStorageSync('userinfo').ID + pid: pid }) } }, diff --git a/honey_box/pages/infinite/benefit.vue b/honey_box/pages/infinite/benefit.vue index 2c22f1fb..4ad99737 100644 --- a/honey_box/pages/infinite/benefit.vue +++ b/honey_box/pages/infinite/benefit.vue @@ -51,10 +51,13 @@ export default { }, onShareAppMessage() { let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { imageUrl: imageUrl, title: this.$config.getAppSetting('share_title') || "哈尼盲盒上线,来就送!", - path: '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID + path: '/pages/shouye/index?pid=' + pid } }, methods: { diff --git a/honey_box/pages/infinite/index.vue b/honey_box/pages/infinite/index.vue index 68a93938..275f3622 100644 --- a/honey_box/pages/infinite/index.vue +++ b/honey_box/pages/infinite/index.vue @@ -28,10 +28,13 @@ export default { }, onShareAppMessage() { let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { imageUrl: imageUrl, title: this.$config.getAppSetting('share_title') || "哈尼盲盒上线,来就送!", - path: '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID + path: '/pages/shouye/index?pid=' + pid } }, methods: { diff --git a/honey_box/pages/mall/index.vue b/honey_box/pages/mall/index.vue index 4d1bfbb1..358b9e98 100644 --- a/honey_box/pages/mall/index.vue +++ b/honey_box/pages/mall/index.vue @@ -113,10 +113,13 @@ export default { }, onShareAppMessage() { let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { imageUrl: imageUrl, title: this.$config.getAppSetting('share_title') || "哈尼盲盒上线,来就送!", - path: '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID + path: '/pages/shouye/index?pid=' + pid } }, data() { diff --git a/honey_box/pages/shouye/detail.vue b/honey_box/pages/shouye/detail.vue index a7f69c19..bb78f79d 100644 --- a/honey_box/pages/shouye/detail.vue +++ b/honey_box/pages/shouye/detail.vue @@ -256,6 +256,9 @@ return co; } } + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync("userinfo") || {}; + const pid = userinfo.id || userinfo.ID || ''; return { title: this.$config.getAppSetting("app_name") + `${this.pageData.goods.title}系列 第${this.pageData.goods.num}套`, @@ -264,7 +267,7 @@ this.$c.qs({ goods_id: this.pageData.goods.id, goods_num: this.pageData.goods.num, - pid: uni.getStorageSync("userinfo").ID, + pid: pid, }), }; }, diff --git a/honey_box/pages/shouye/detail_wuxian.vue b/honey_box/pages/shouye/detail_wuxian.vue index b6b7d0d8..a9d56a1c 100644 --- a/honey_box/pages/shouye/detail_wuxian.vue +++ b/honey_box/pages/shouye/detail_wuxian.vue @@ -323,6 +323,9 @@ } } + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { title: this.$config.getAppSetting("app_name") + `${this.pageData.goods.title}系列`, imageUrl: this.pageData.goods.imgurl_detail, @@ -330,7 +333,7 @@ this.$c.qs({ goods_id: this.pageData.goods.id, goods_num: this.pageData.goods.num, - pid: uni.getStorageSync('userinfo').ID + pid: pid }) } }, diff --git a/honey_box/pages/shouye/index.vue b/honey_box/pages/shouye/index.vue index db91e09e..24e716b5 100644 --- a/honey_box/pages/shouye/index.vue +++ b/honey_box/pages/shouye/index.vue @@ -216,14 +216,24 @@ uni.setStorageSync("page", this.$mp.page.route); }, onLoad(v) { - console.log("参数", v); + console.log("=== 首页 onLoad 开始 ==="); + console.log("接收到的参数 v:", JSON.stringify(v)); + console.log("v.pid:", v.pid); + console.log("v.scene:", v.scene); + console.log("当前存储的 pid:", uni.getStorageSync("pid")); if (v.pid) { + console.log("设置 pid 到 storage:", v.pid); uni.setStorageSync("pid", v.pid); } if (v.scene) { + console.log("设置 scene 作为 pid 到 storage:", v.scene); uni.setStorageSync("pid", v.scene); } + + console.log("设置后存储的 pid:", uni.getStorageSync("pid")); + console.log("=== 首页 onLoad 结束 ==="); + this.tabList = this.$config.getGoodType(); this.tabCur = 0; @@ -247,11 +257,14 @@ onShareAppMessage() { let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync("userinfo") || {}; + const pid = userinfo.id || userinfo.ID || ''; return { imageUrl: imageUrl, title: this.$config.getAppSetting("app_name") + ",正版潮玩手办一番赏", - path: "/pages/shouye/index?pid=" + uni.getStorageSync("userinfo").ID, + path: "/pages/shouye/index?pid=" + pid, }; }, computed: { diff --git a/honey_box/pages/user/change.vue b/honey_box/pages/user/change.vue index a18d27a4..32c8521c 100644 --- a/honey_box/pages/user/change.vue +++ b/honey_box/pages/user/change.vue @@ -81,7 +81,8 @@ if (userInfo) { this.avatarUrl = userInfo.headimg || ""; this.nickname = userInfo.nickname || ""; - this.id = userInfo.ID; + // 使用小写 id,兼容新版 .NET API + this.id = userInfo.id || userInfo.ID; this.uid = userInfo.uid; } }, diff --git a/honey_box/pages/user/index.vue b/honey_box/pages/user/index.vue index 2ffb81d2..aeca3cb9 100644 --- a/honey_box/pages/user/index.vue +++ b/honey_box/pages/user/index.vue @@ -214,10 +214,13 @@ }, onShareAppMessage() { let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; return { imageUrl: imageUrl, title: this.$config.getAppSetting('share_title_detail') || "哈尼盲盒,正版潮玩手办一番赏", - path: '/pages/user/index?pid=' + uni.getStorageSync('userinfo').ID + path: '/pages/user/index?pid=' + pid } }, onShow() { diff --git a/honey_box/pages/user/tui-guang.vue b/honey_box/pages/user/tui-guang.vue index 26275ee0..92483916 100644 --- a/honey_box/pages/user/tui-guang.vue +++ b/honey_box/pages/user/tui-guang.vue @@ -148,14 +148,24 @@ export default { let that = this; console.log(); let imageUrl = this.$config.getShareImageUrl(); + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; + console.log('=== 分享邀请 ==='); + console.log('userinfo:', JSON.stringify(userinfo)); + console.log('分享 pid:', pid); return { imageUrl: imageUrl, title: this.$config.getAppSetting('share_title') || "哈尼盲盒上线,来就送!", - path: '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID + path: '/pages/shouye/index?pid=' + pid } }, onLoad() { - console.log(uni.getStorageSync('userinfo').ID) + const userinfo = uni.getStorageSync('userinfo') || {}; + console.log('=== 推广页 onLoad ==='); + console.log('userinfo:', JSON.stringify(userinfo)); + console.log('userinfo.id:', userinfo.id); + console.log('userinfo.ID:', userinfo.ID); console.log(this.$platform.code); if (this.$platform.code == 'WEB_APP' || this.$platform.code == 'APP_IOS' || this.$platform.code == 'APP_ANDROID') { this.isApp = true; @@ -180,14 +190,19 @@ export default { }, methods: { yaoaing() { + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; uni.setClipboardData({ - data: window.location.origin + '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID + data: window.location.origin + '/pages/shouye/index?pid=' + pid }); this.$c.msg("链接已复制,快去分享吧~") }, copyMyInviteCode() { + // 使用小写 id,兼容新版 .NET API + const pid = this.userInfo.id || this.userInfo.ID || ''; uni.setClipboardData({ - data: this.userInfo.ID + '' + data: pid + '' }); this.$c.msg("邀请码已复制") }, @@ -198,7 +213,10 @@ export default { }) }, getHaiBao() { - return this.$baseUrl + '/api/generate_urllinks?userId=' + uni.getStorageSync('userinfo').ID; + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const userId = userinfo.id || userinfo.ID || ''; + return this.$baseUrl + '/api/generate_urllinks?userId=' + userId; }, getXiaZai() { return this.$baseUrl + '/dow.png'; @@ -216,7 +234,10 @@ export default { }, fenxiang() { var image = this.$baseUrl + "/storage/topic/20240617/30a73c0d5061f700a66f653deeb60f6d.jpg"; - var path = '/pages/shouye/index?pid=' + uni.getStorageSync('userinfo').ID; + // 使用小写 id,兼容新版 .NET API + const userinfo = uni.getStorageSync('userinfo') || {}; + const pid = userinfo.id || userinfo.ID || ''; + var path = '/pages/shouye/index?pid=' + pid; this.$c.$fenxiang(this.$config.getAppSetting('share_title_detail') || '哈尼盲盒,正版潮玩手办一番赏', '', path, image); }, diff --git a/server/HoneyBox/src/HoneyBox.Model/Models/Auth/UserInfoDto.cs b/server/HoneyBox/src/HoneyBox.Model/Models/Auth/UserInfoDto.cs index a151f271..7c3faeef 100644 --- a/server/HoneyBox/src/HoneyBox.Model/Models/Auth/UserInfoDto.cs +++ b/server/HoneyBox/src/HoneyBox.Model/Models/Auth/UserInfoDto.cs @@ -1,3 +1,5 @@ +using System.Text.Json.Serialization; + namespace HoneyBox.Model.Models.Auth; /// @@ -6,13 +8,21 @@ namespace HoneyBox.Model.Models.Auth; public class UserInfoDto { /// - /// 用户ID + /// 用户ID (小写,新版API) /// + [JsonPropertyName("id")] public int Id { get; set; } + /// + /// 用户ID (大写,兼容旧版前端) + /// + [JsonPropertyName("ID")] + public int ID => Id; + /// /// 用户唯一标识 /// + [JsonPropertyName("uid")] public string? Uid { get; set; } ///