account_destroy_record.go
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package domain
import (
"fmt"
"time"
)
// 账号注销记录
type AccountDestroyRecord struct {
// 用户基础数据id
UserBaseId int64 `json:"userBaseId,string"`
// 账号注销记录ID
AccountDestroyRecordId int64 `json:"accountDestroyRecordId,string"`
// 注销时间
DestroyTime time.Time `json:"destroyTime"`
// 账号修改后
AccountAfter string `json:"accountAfter"`
// 账号修改前
AccountBefore string `json:"accountBefore"`
}
type AccountDestroyRecordRepository interface {
Save(accountDestroyRecord *AccountDestroyRecord) (*AccountDestroyRecord, error)
Remove(accountDestroyRecord *AccountDestroyRecord) (*AccountDestroyRecord, error)
FindOne(queryOptions map[string]interface{}) (*AccountDestroyRecord, error)
Find(queryOptions map[string]interface{}) (int64, []*AccountDestroyRecord, error)
}
func (accountDestroyRecord *AccountDestroyRecord) Identify() interface{} {
if accountDestroyRecord.AccountDestroyRecordId == 0 {
return nil
}
return accountDestroyRecord.AccountDestroyRecordId
}
func (accountDestroyRecord *AccountDestroyRecord) Update(data map[string]interface{}) error {
//if userBaseId, ok := data["userBaseId"]; ok {
// accountDestroyRecord.UserBaseId = userBaseId.(int64)
//}
//if accountDestroyRecordId, ok := data["accountDestroyRecordId"]; ok {
// accountDestroyRecord.AccountDestroyRecordId = accountDestroyRecordId.(int64)
//}
//if destroyTime, ok := data["destroyTime"]; ok {
// accountDestroyRecord.DestroyTime = destroyTime.(string)
//}
//if accountAfter, ok := data["accountAfter"]; ok {
// accountDestroyRecord.AccountAfter = accountAfter.(string)
//}
//if accountBefore, ok := data["accountBefore"]; ok {
// accountDestroyRecord.AccountBefore = accountBefore.(string)
//}
return nil
}
func NewAccountDestroyRecord(userBaseId int64, num int64, account string) *AccountDestroyRecord {
return &AccountDestroyRecord{
UserBaseId: userBaseId,
DestroyTime: time.Now(),
AccountBefore: account,
AccountAfter: fmt.Sprintf("%v-%v", account, num+1),
}
}