This commit is contained in:
@@ -101,11 +101,12 @@ type EmailConfig struct {
|
||||
EnableNotify bool `yaml:"enable_notify"`
|
||||
EnableDomainSuffix bool `yaml:"enable_domain_suffix"`
|
||||
DomainSuffixList string `yaml:"domain_suffix_list"`
|
||||
VerifyEmailTemplate string `yaml:"verify_email_template"`
|
||||
VerifyEmailTemplates map[string]string `yaml:"verify_email_templates"`
|
||||
ExpirationEmailTemplate string `yaml:"expiration_email_template"`
|
||||
MaintenanceEmailTemplate string `yaml:"maintenance_email_template"`
|
||||
TrafficExceedEmailTemplate string `yaml:"traffic_exceed_email_template"`
|
||||
VerifyEmailTemplate string `yaml:"verify_email_template"`
|
||||
VerifyEmailTemplates map[string]string `yaml:"verify_email_templates"`
|
||||
ExpirationEmailTemplate string `yaml:"expiration_email_template"`
|
||||
MaintenanceEmailTemplate string `yaml:"maintenance_email_template"`
|
||||
TrafficExceedEmailTemplate string `yaml:"traffic_exceed_email_template"`
|
||||
DeleteAccountEmailTemplate string `yaml:"delete_account_email_template"`
|
||||
}
|
||||
|
||||
type MobileConfig struct {
|
||||
|
||||
@@ -82,7 +82,7 @@ func (l *GetFamilyDetailLogic) GetFamilyDetail(req *types.GetFamilyDetailRequest
|
||||
memberItem := types.FamilyMemberItem{
|
||||
UserId: member.UserId,
|
||||
Identifier: identifier,
|
||||
DeviceNo: deviceNoMap[member.UserId],
|
||||
DeviceID: deviceNoMap[member.UserId],
|
||||
Role: member.Role,
|
||||
RoleName: mapFamilyRoleName(member.Role),
|
||||
Status: member.Status,
|
||||
|
||||
@@ -37,7 +37,7 @@ func (l *GetUserDetailLogic) GetUserDetail(req *types.GetDetailRequest) (*types.
|
||||
tool.DeepCopy(&resp, userInfo)
|
||||
for i, d := range userInfo.UserDevices {
|
||||
if i < len(resp.UserDevices) {
|
||||
resp.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
resp.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
if referCode := strings.TrimSpace(resp.ReferCode); referCode != "" {
|
||||
|
||||
@@ -163,10 +163,10 @@ func (l *GetUserListLogic) GetUserList(req *types.GetUserListRequest) (*types.Ge
|
||||
}
|
||||
u.AuthMethods = authMethods
|
||||
|
||||
// 填充 DeviceNo
|
||||
// 填充 DeviceID
|
||||
for i, d := range item.UserDevices {
|
||||
if i < len(u.UserDevices) {
|
||||
u.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
u.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func (l *GetUserSubscribeDevicesLogic) GetUserSubscribeDevices(req *types.GetUse
|
||||
tool.DeepCopy(&userRespList, list)
|
||||
for i, d := range list {
|
||||
if i < len(userRespList) {
|
||||
userRespList[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
userRespList[i].DeviceID = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
return &types.GetUserSubscribeDevicesResponse{
|
||||
|
||||
@@ -89,7 +89,11 @@ func (l *SendEmailCodeLogic) SendEmailCode(req *types.SendCodeRequest) (resp *ty
|
||||
// Generate verification code
|
||||
code := random.Key(6, 0)
|
||||
scene := constant.ParseVerifyType(req.Type).String()
|
||||
taskPayload.Type = queue.EmailTypeVerify
|
||||
if scene == constant.DeleteAccount.String() {
|
||||
taskPayload.Type = queue.EmailTypeDeleteAccount
|
||||
} else {
|
||||
taskPayload.Type = queue.EmailTypeVerify
|
||||
}
|
||||
taskPayload.Scene = scene
|
||||
taskPayload.Email = req.Email
|
||||
taskPayload.Subject = "Verification code"
|
||||
|
||||
@@ -38,7 +38,7 @@ func (l *GetDeviceListLogic) GetDeviceList() (resp *types.GetDeviceListResponse,
|
||||
tool.DeepCopy(&userRespList, list)
|
||||
for i, d := range list {
|
||||
if i < len(userRespList) {
|
||||
userRespList[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
userRespList[i].DeviceID = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
resp = &types.GetDeviceListResponse{
|
||||
|
||||
@@ -47,7 +47,7 @@ func (l *QueryUserInfoLogic) QueryUserInfo() (resp *types.User, err error) {
|
||||
tool.DeepCopy(resp, u)
|
||||
for i, d := range u.UserDevices {
|
||||
if i < len(resp.UserDevices) {
|
||||
resp.UserDevices[i].DeviceNo = tool.DeviceIdToHash(d.Id)
|
||||
resp.UserDevices[i].DeviceID = tool.DeviceIdToHash(d.Id)
|
||||
}
|
||||
}
|
||||
// refer_code 为空时自动生成
|
||||
|
||||
+30
-22
@@ -113,17 +113,18 @@ func (l *TelegramAuthConfig) Unmarshal(data string) error {
|
||||
}
|
||||
|
||||
type EmailAuthConfig struct {
|
||||
Platform string `json:"platform"`
|
||||
PlatformConfig interface{} `json:"platform_config"`
|
||||
EnableVerify bool `json:"enable_verify"`
|
||||
EnableNotify bool `json:"enable_notify"`
|
||||
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
||||
DomainSuffixList string `json:"domain_suffix_list"`
|
||||
VerifyEmailTemplate string `json:"verify_email_template"`
|
||||
VerifyEmailTemplates map[string]string `json:"verify_email_templates"`
|
||||
ExpirationEmailTemplate string `json:"expiration_email_template"`
|
||||
MaintenanceEmailTemplate string `json:"maintenance_email_template"`
|
||||
TrafficExceedEmailTemplate string `json:"traffic_exceed_email_template"`
|
||||
Platform string `json:"platform"`
|
||||
PlatformConfig interface{} `json:"platform_config"`
|
||||
EnableVerify bool `json:"enable_verify"`
|
||||
EnableNotify bool `json:"enable_notify"`
|
||||
EnableDomainSuffix bool `json:"enable_domain_suffix"`
|
||||
DomainSuffixList string `json:"domain_suffix_list"`
|
||||
VerifyEmailTemplate string `json:"verify_email_template"`
|
||||
VerifyEmailTemplates map[string]string `json:"verify_email_templates"`
|
||||
ExpirationEmailTemplate string `json:"expiration_email_template"`
|
||||
MaintenanceEmailTemplate string `json:"maintenance_email_template"`
|
||||
TrafficExceedEmailTemplate string `json:"traffic_exceed_email_template"`
|
||||
DeleteAccountEmailTemplate string `json:"delete_account_email_template"`
|
||||
}
|
||||
|
||||
func (l *EmailAuthConfig) Marshal() string {
|
||||
@@ -136,6 +137,9 @@ func (l *EmailAuthConfig) Marshal() string {
|
||||
if l.TrafficExceedEmailTemplate == "" {
|
||||
l.TrafficExceedEmailTemplate = email.DefaultTrafficExceedEmailTemplate
|
||||
}
|
||||
if l.DeleteAccountEmailTemplate == "" {
|
||||
l.DeleteAccountEmailTemplate = email.DefaultDeleteAccountEmailTemplate
|
||||
}
|
||||
if l.VerifyEmailTemplate == "" {
|
||||
l.VerifyEmailTemplate = email.DefaultEmailVerifyTemplate
|
||||
}
|
||||
@@ -145,17 +149,18 @@ func (l *EmailAuthConfig) Marshal() string {
|
||||
bytes, err := json.Marshal(l)
|
||||
if err != nil {
|
||||
config := &EmailAuthConfig{
|
||||
Platform: "smtp",
|
||||
PlatformConfig: new(SMTPConfig),
|
||||
EnableVerify: true,
|
||||
EnableNotify: true,
|
||||
EnableDomainSuffix: false,
|
||||
DomainSuffixList: "",
|
||||
VerifyEmailTemplate: email.DefaultEmailVerifyTemplate,
|
||||
VerifyEmailTemplates: map[string]string{},
|
||||
ExpirationEmailTemplate: email.DefaultExpirationEmailTemplate,
|
||||
MaintenanceEmailTemplate: email.DefaultMaintenanceEmailTemplate,
|
||||
TrafficExceedEmailTemplate: email.DefaultTrafficExceedEmailTemplate,
|
||||
Platform: "smtp",
|
||||
PlatformConfig: new(SMTPConfig),
|
||||
EnableVerify: true,
|
||||
EnableNotify: true,
|
||||
EnableDomainSuffix: false,
|
||||
DomainSuffixList: "",
|
||||
VerifyEmailTemplate: email.DefaultEmailVerifyTemplate,
|
||||
VerifyEmailTemplates: map[string]string{},
|
||||
ExpirationEmailTemplate: email.DefaultExpirationEmailTemplate,
|
||||
MaintenanceEmailTemplate: email.DefaultMaintenanceEmailTemplate,
|
||||
TrafficExceedEmailTemplate: email.DefaultTrafficExceedEmailTemplate,
|
||||
DeleteAccountEmailTemplate: email.DefaultDeleteAccountEmailTemplate,
|
||||
}
|
||||
|
||||
bytes, _ = json.Marshal(config)
|
||||
@@ -189,6 +194,9 @@ func (l *EmailAuthConfig) Unmarshal(data string) {
|
||||
if l.VerifyEmailTemplates == nil {
|
||||
l.VerifyEmailTemplates = map[string]string{}
|
||||
}
|
||||
if l.DeleteAccountEmailTemplate == "" {
|
||||
l.DeleteAccountEmailTemplate = email.DefaultDeleteAccountEmailTemplate
|
||||
}
|
||||
}
|
||||
|
||||
// SMTPConfig Email SMTP configuration
|
||||
|
||||
@@ -682,7 +682,7 @@ type FamilyDetail struct {
|
||||
type FamilyMemberItem struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
Identifier string `json:"identifier"`
|
||||
DeviceNo string `json:"device_no"`
|
||||
DeviceID string `json:"device_id"`
|
||||
Role uint8 `json:"role"`
|
||||
RoleName string `json:"role_name"`
|
||||
Status uint8 `json:"status"`
|
||||
@@ -2957,7 +2957,7 @@ type UserDevice struct {
|
||||
Id int64 `json:"id"`
|
||||
Ip string `json:"ip"`
|
||||
Identifier string `json:"identifier"`
|
||||
DeviceNo string `json:"device_no"`
|
||||
DeviceID string `json:"device_id"`
|
||||
UserAgent string `json:"user_agent"`
|
||||
Online bool `json:"online"`
|
||||
Enabled bool `json:"enabled"`
|
||||
|
||||
Reference in New Issue
Block a user