diff --git a/miniapp/config/index.js b/miniapp/config/index.js
index 6bdbd8d..7794e45 100644
--- a/miniapp/config/index.js
+++ b/miniapp/config/index.js
@@ -23,7 +23,7 @@ const ENV = {
}
// 当前环境 - 开发时使用 development,打包时改为 production
-const CURRENT_ENV = 'production'
+const CURRENT_ENV = 'development'
// 导出配置
export const config = {
diff --git a/miniapp/store/config.js b/miniapp/store/config.js
index 7e7d7da..4bd57df 100644
--- a/miniapp/store/config.js
+++ b/miniapp/store/config.js
@@ -16,6 +16,7 @@ import {
getSubscribeReminderClosedDate, setSubscribeReminderClosedDate
} from '../utils/storage.js'
import { getAppConfig } from '../api/config.js'
+import { useUserStore } from './user.js'
/**
* 获取今天的日期字符串 (YYYY-MM-DD)
@@ -231,15 +232,18 @@ export const useConfigStore = defineStore('config', {
/**
* 检查是否应该显示服务号关注弹窗
* 条件:
- * 1. 用户未关注服务号
+ * 1. 用户未关注服务号(从后端获取真实状态)
* 2. 从其他页面返回首页时
* 3. 弹出后5分钟内不再弹出
* 4. 一天最多弹出3次
* @param {boolean} isFromOtherPage - 是否从其他页面返回
*/
checkServiceAccountPopup(isFromOtherPage = false) {
+ // 从 userStore 获取真实的关注状态
+ const userStore = useUserStore()
+
// 如果已关注服务号,不显示
- if (this.serviceAccountFollowed) {
+ if (userStore.isFollowServiceAccount) {
this.showServiceAccountPopup = false
return
}
@@ -315,7 +319,7 @@ export const useConfigStore = defineStore('config', {
/**
* 检查是否应该显示小程序订阅消息提醒
* 条件:
- * 1. 用户未关注服务号
+ * 1. 用户未关注服务号(从后端获取真实状态)
* 2. 今日已弹出3次服务号关注弹窗
* 3. 优先级低于会员广告(会员广告关闭后才显示)
* 4. 今日未关闭过
@@ -323,9 +327,10 @@ export const useConfigStore = defineStore('config', {
*/
checkSubscribeReminder(isMember = false) {
const today = getTodayDateString()
+ const userStore = useUserStore()
// 如果已关注服务号,不显示
- if (this.serviceAccountFollowed) {
+ if (userStore.isFollowServiceAccount) {
this.showSubscribeReminder = false
return
}
diff --git a/miniapp/store/user.js b/miniapp/store/user.js
index ee4d0b7..9937197 100644
--- a/miniapp/store/user.js
+++ b/miniapp/store/user.js
@@ -37,6 +37,7 @@ export const useUserStore = defineStore('user', {
isMember: false,
memberLevel: 0,
isRealName: false,
+ isFollowServiceAccount: false, // 是否关注服务号
genderPreference: getGenderPreference() || 0,
/** 上次从服务器刷新用户信息的时间戳(用于节流) */
lastRefreshTime: 0
@@ -98,6 +99,7 @@ export const useUserStore = defineStore('user', {
this.isMember = false
this.memberLevel = 0
this.isRealName = false
+ this.isFollowServiceAccount = false
removeUserInfo()
},
@@ -116,6 +118,7 @@ export const useUserStore = defineStore('user', {
if (userInfo.isMember !== undefined) this.isMember = userInfo.isMember
if (userInfo.memberLevel !== undefined) this.memberLevel = userInfo.memberLevel
if (userInfo.isRealName !== undefined) this.isRealName = userInfo.isRealName
+ if (userInfo.isFollowServiceAccount !== undefined) this.isFollowServiceAccount = userInfo.isFollowServiceAccount
// 持久化用户信息
setUserInfo({
@@ -126,7 +129,8 @@ export const useUserStore = defineStore('user', {
isProfileCompleted: this.isProfileCompleted,
isMember: this.isMember,
memberLevel: this.memberLevel,
- isRealName: this.isRealName
+ isRealName: this.isRealName,
+ isFollowServiceAccount: this.isFollowServiceAccount
})
},
@@ -160,6 +164,7 @@ export const useUserStore = defineStore('user', {
this.isMember = userInfo.isMember || false
this.memberLevel = userInfo.memberLevel || 0
this.isRealName = userInfo.isRealName || false
+ this.isFollowServiceAccount = userInfo.isFollowServiceAccount || false
}
if (genderPref) {
@@ -215,7 +220,8 @@ export const useUserStore = defineStore('user', {
isProfileCompleted: data.auditStatus === 1,
isMember: data.isMember,
memberLevel: data.memberLevel,
- isRealName: data.isRealName
+ isRealName: data.isRealName,
+ isFollowServiceAccount: data.isFollowServiceAccount
})
// 更新刷新时间戳
this.lastRefreshTime = Date.now()
diff --git a/server/src/XiangYi.Application/DTOs/Responses/AuthResponses.cs b/server/src/XiangYi.Application/DTOs/Responses/AuthResponses.cs
index 1635349..e1effb1 100644
--- a/server/src/XiangYi.Application/DTOs/Responses/AuthResponses.cs
+++ b/server/src/XiangYi.Application/DTOs/Responses/AuthResponses.cs
@@ -54,6 +54,11 @@ public class LoginResponse
/// 是否首次登录(新用户)
///
public bool IsNewUser { get; set; }
+
+ ///
+ /// 是否关注服务号
+ ///
+ public bool IsFollowServiceAccount { get; set; }
}
///
diff --git a/server/src/XiangYi.Application/DTOs/Responses/ProfileResponses.cs b/server/src/XiangYi.Application/DTOs/Responses/ProfileResponses.cs
index 9b5d3ec..d0c663d 100644
--- a/server/src/XiangYi.Application/DTOs/Responses/ProfileResponses.cs
+++ b/server/src/XiangYi.Application/DTOs/Responses/ProfileResponses.cs
@@ -229,6 +229,11 @@ public class ProfileResponse
/// 父母医疗保险
///
public string? ParentMedicalStatus { get; set; }
+
+ ///
+ /// 是否关注服务号
+ ///
+ public bool IsFollowServiceAccount { get; set; }
}
///
diff --git a/server/src/XiangYi.Application/Services/AuthService.cs b/server/src/XiangYi.Application/Services/AuthService.cs
index bb57fc6..5a31d7a 100644
--- a/server/src/XiangYi.Application/Services/AuthService.cs
+++ b/server/src/XiangYi.Application/Services/AuthService.cs
@@ -115,7 +115,8 @@ public class AuthService : IAuthService
IsMember = existingUser.IsMember,
MemberLevel = existingUser.MemberLevel,
IsRealName = existingUser.IsRealName,
- IsNewUser = isNewUser
+ IsNewUser = isNewUser,
+ IsFollowServiceAccount = existingUser.IsFollowServiceAccount
};
}
diff --git a/server/src/XiangYi.Application/Services/ProfileService.cs b/server/src/XiangYi.Application/Services/ProfileService.cs
index ed42765..330a1fd 100644
--- a/server/src/XiangYi.Application/Services/ProfileService.cs
+++ b/server/src/XiangYi.Application/Services/ProfileService.cs
@@ -268,6 +268,7 @@ public class ProfileService : IProfileService
IsMember = user.IsMember,
MemberLevel = user.MemberLevel,
IsRealName = user.IsRealName,
+ IsFollowServiceAccount = user.IsFollowServiceAccount,
Photos = photos.OrderBy(p => p.Sort).Select(p => new PhotoResponse
{
Id = p.Id,