更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -1,11 +1,5 @@
|
||||
package controllers
|
||||
|
||||
// ==================== 游客数据转正合并 ====================
|
||||
//
|
||||
// 正式登录后按手机号把 yz_guest_data 里的条目迁入各模块业务表。
|
||||
// 新免登录模块接入时:在 guestMergeAdapters 注册一个适配器即可,
|
||||
// rows 为该模块全部有效游客条目,返回成功迁移的条数。
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
@@ -17,15 +11,12 @@ import (
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
// 游客数据所属模块编码(与 gueststore 的 module 字段一致)
|
||||
const (
|
||||
guestModuleNotebook = "notebook"
|
||||
guestModuleSchedule = "schedule"
|
||||
guestModulePasswordStore = "passwordStore"
|
||||
)
|
||||
|
||||
// guestNoteItem 游客记事本条目:与 /api/notebook 登录态响应字段一致,
|
||||
// 前端拿到的形状不因游客/登录而变化。
|
||||
type guestNoteItem struct {
|
||||
ID uint64 `json:"id"`
|
||||
Title string `json:"title"`
|
||||
@@ -35,8 +26,6 @@ type guestNoteItem struct {
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// guestScheduleItem 游客日程条目:与 /api/schedule 登录态响应字段一致。
|
||||
// 游客日程不接提醒发送链路(无短信/邮件推送),仅作待办记录。
|
||||
type guestScheduleItem struct {
|
||||
ID uint64 `json:"id"`
|
||||
Content string `json:"content"`
|
||||
@@ -50,12 +39,9 @@ type guestScheduleItem struct {
|
||||
UpdatedAt string `json:"updated_at"`
|
||||
}
|
||||
|
||||
// mergeGuestToUser 把游客的全部模块数据并入正式身份(AuthIdentity.ID=uid, 租户 tid)。
|
||||
// 单条失败只记日志不中断;完成后游客数据行统一置 is_deleted=2(保留行本身)。
|
||||
func mergeGuestToUser(guest *models.GuestUser, uid uint64, tid int, username string) (map[string]int, error) {
|
||||
counts := map[string]int{}
|
||||
|
||||
// ---- 记事本 ----
|
||||
if rows, err := gueststore.List(guest.ID, guestModuleNotebook); err != nil {
|
||||
logs.Error("[guest-merge] list notebook failed guest=%d: %v", guest.ID, err)
|
||||
} else {
|
||||
@@ -84,7 +70,6 @@ func mergeGuestToUser(guest *models.GuestUser, uid uint64, tid int, username str
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 日程 ----
|
||||
if rows, err := gueststore.List(guest.ID, guestModuleSchedule); err != nil {
|
||||
logs.Error("[guest-merge] list schedule failed guest=%d: %v", guest.ID, err)
|
||||
} else {
|
||||
@@ -111,7 +96,6 @@ func mergeGuestToUser(guest *models.GuestUser, uid uint64, tid int, username str
|
||||
logs.Error("[guest-merge] insert schedule row=%d: %v", r.ID, ierr)
|
||||
continue
|
||||
}
|
||||
// 提醒行按登录态创建逻辑重建;已完成的不再发送
|
||||
status := int8(0)
|
||||
if item.IsFinished {
|
||||
status = 2
|
||||
@@ -141,7 +125,6 @@ func mergeGuestToUser(guest *models.GuestUser, uid uint64, tid int, username str
|
||||
}
|
||||
}
|
||||
|
||||
// ---- 密码库 ----
|
||||
if rows, err := gueststore.List(guest.ID, guestModulePasswordStore); err != nil {
|
||||
logs.Error("[guest-merge] list passwordStore failed guest=%d: %v", guest.ID, err)
|
||||
} else {
|
||||
@@ -174,7 +157,6 @@ func mergeGuestToUser(guest *models.GuestUser, uid uint64, tid int, username str
|
||||
return counts, nil
|
||||
}
|
||||
|
||||
// firstLineOf 取首行作为标题(与登录态日程创建逻辑一致)。
|
||||
func firstLineOf(content, fallback string) string {
|
||||
title := strings.SplitN(content, "\n", 2)[0]
|
||||
if len(title) > 60 {
|
||||
@@ -186,8 +168,6 @@ func firstLineOf(content, fallback string) string {
|
||||
return title
|
||||
}
|
||||
|
||||
// normalizeRemindChannels 与 AppReminderController.Create 相同的通道白名单:
|
||||
// APP 归一为 SITE_MSG,非法值丢弃。
|
||||
func normalizeRemindChannels(list []string) []string {
|
||||
out := make([]string, 0, len(list))
|
||||
for _, ch := range list {
|
||||
|
||||
Reference in new issue
Block a user