mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 13:14:11 +00:00
Optimize subEmailInRemark setting lookup
This commit is contained in:
parent
c7e0736a60
commit
8378925f26
1 changed files with 10 additions and 7 deletions
|
|
@ -28,6 +28,7 @@ type SubService struct {
|
||||||
showInfo bool
|
showInfo bool
|
||||||
remarkModel string
|
remarkModel string
|
||||||
datepicker string
|
datepicker string
|
||||||
|
emailInRemark bool
|
||||||
inboundService service.InboundService
|
inboundService service.InboundService
|
||||||
settingService service.SettingService
|
settingService service.SettingService
|
||||||
}
|
}
|
||||||
|
|
@ -35,8 +36,9 @@ type SubService struct {
|
||||||
// NewSubService creates a new subscription service with the given configuration.
|
// NewSubService creates a new subscription service with the given configuration.
|
||||||
func NewSubService(showInfo bool, remarkModel string) *SubService {
|
func NewSubService(showInfo bool, remarkModel string) *SubService {
|
||||||
return &SubService{
|
return &SubService{
|
||||||
showInfo: showInfo,
|
showInfo: showInfo,
|
||||||
remarkModel: remarkModel,
|
remarkModel: remarkModel,
|
||||||
|
emailInRemark: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -60,6 +62,11 @@ func (s *SubService) GetSubs(subId string, host string) ([]string, int64, xray.C
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.datepicker = "gregorian"
|
s.datepicker = "gregorian"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.emailInRemark, err = s.settingService.GetSubEmailInRemark()
|
||||||
|
if err != nil {
|
||||||
|
s.emailInRemark = true
|
||||||
|
}
|
||||||
for _, inbound := range inbounds {
|
for _, inbound := range inbounds {
|
||||||
clients, err := s.inboundService.GetClients(inbound)
|
clients, err := s.inboundService.GetClients(inbound)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -825,11 +832,7 @@ func (s *SubService) genRemark(inbound *model.Inbound, email string, extra strin
|
||||||
'e': "",
|
'e': "",
|
||||||
'o': "",
|
'o': "",
|
||||||
}
|
}
|
||||||
emailInRemark, err := s.settingService.GetSubEmailInRemark()
|
if len(email) > 0 && s.emailInRemark {
|
||||||
if err != nil {
|
|
||||||
emailInRemark = true
|
|
||||||
}
|
|
||||||
if len(email) > 0 && emailInRemark {
|
|
||||||
orders['e'] = email
|
orders['e'] = email
|
||||||
}
|
}
|
||||||
if len(inbound.Remark) > 0 {
|
if len(inbound.Remark) > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue