更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -1,8 +1,3 @@
|
||||
// Package gueststore 游客(免登录模块)通用存储。
|
||||
//
|
||||
// 一条业务条目 = yz_guest_data 一行 JSON 文档,按 guest_id + module 隔离;
|
||||
// 删除只做软删(is_deleted=1)永久保留,合并进正式账号后置 is_deleted=2。
|
||||
// 业务控制器通过 identity.IsGuest 分流到这里,响应结构与登录态接口保持一致。
|
||||
package gueststore
|
||||
|
||||
import (
|
||||
@@ -16,10 +11,8 @@ import (
|
||||
"github.com/beego/beego/v2/client/orm"
|
||||
)
|
||||
|
||||
// ErrNotFound 条目不存在(或不属于该游客 / 已被删除)。
|
||||
var ErrNotFound = errors.New("记录不存在")
|
||||
|
||||
// Row 一条游客数据文档(对外统一用表 ID 作为条目 ID,payload 内的 id 仅冗余)。
|
||||
type Row struct {
|
||||
ID uint64
|
||||
Payload json.RawMessage
|
||||
@@ -27,9 +20,6 @@ type Row struct {
|
||||
UpdateTime *time.Time
|
||||
}
|
||||
|
||||
// Upsert 按手机号定位/创建游客身份,并刷新 openid / 活跃时间。
|
||||
// 已合并(merged_uid>0)的旧记录会被复位为新的游客周期:
|
||||
// 历史数据行在合并时已置 is_deleted=2,不会再次出现在列表里。
|
||||
func Upsert(phone, openid, unionid string) (*models.GuestUser, error) {
|
||||
phone = strings.TrimSpace(phone)
|
||||
if phone == "" {
|
||||
@@ -60,7 +50,6 @@ func Upsert(phone, openid, unionid string) (*models.GuestUser, error) {
|
||||
upd["unionid"] = unionid
|
||||
}
|
||||
if row.MergedUID > 0 {
|
||||
// 复位游客周期,允许同一手机号再次以游客身份产生新数据
|
||||
upd["merged_uid"] = uint64(0)
|
||||
upd["merged_time"] = nil
|
||||
row.MergedUID = 0
|
||||
@@ -72,7 +61,6 @@ func Upsert(phone, openid, unionid string) (*models.GuestUser, error) {
|
||||
return &row, nil
|
||||
}
|
||||
|
||||
// Insert 写入一条业务条目,返回行 ID(即条目 ID)。
|
||||
func Insert(guestID uint64, module string, payload interface{}) (uint64, error) {
|
||||
b, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
@@ -92,7 +80,6 @@ func Insert(guestID uint64, module string, payload interface{}) (uint64, error)
|
||||
return uint64(id), nil
|
||||
}
|
||||
|
||||
// Get 读取单条(限本游客 + 本模块 + 未删除)。
|
||||
func Get(guestID uint64, module string, id uint64) (Row, error) {
|
||||
var d models.GuestData
|
||||
err := models.Orm.QueryTable(new(models.GuestData)).
|
||||
@@ -110,7 +97,6 @@ func Get(guestID uint64, module string, id uint64) (Row, error) {
|
||||
return toRow(d), nil
|
||||
}
|
||||
|
||||
// List 列出某游客某模块的全部有效条目(新→旧)。
|
||||
func List(guestID uint64, module string) ([]Row, error) {
|
||||
var rows []models.GuestData
|
||||
_, err := models.Orm.QueryTable(new(models.GuestData)).
|
||||
@@ -129,7 +115,6 @@ func List(guestID uint64, module string) ([]Row, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Update 覆盖一条条目的 payload。
|
||||
func Update(guestID uint64, module string, id uint64, payload interface{}) error {
|
||||
b, err := json.Marshal(payload)
|
||||
if err != nil {
|
||||
@@ -150,7 +135,6 @@ func Update(guestID uint64, module string, id uint64, payload interface{}) error
|
||||
return nil
|
||||
}
|
||||
|
||||
// Delete 软删除一条条目(保留数据行,永久不清理)。
|
||||
func Delete(guestID uint64, module string, id uint64) error {
|
||||
n, err := models.Orm.QueryTable(new(models.GuestData)).
|
||||
Filter("id", id).
|
||||
@@ -167,7 +151,6 @@ func Delete(guestID uint64, module string, id uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MarkMerged 游客转正后:该游客全部有效数据行置 is_deleted=2(保留行本身)。
|
||||
func MarkMerged(guestID uint64) error {
|
||||
_, err := models.Orm.QueryTable(new(models.GuestData)).
|
||||
Filter("guest_id", guestID).
|
||||
|
||||
Reference in new issue
Block a user