feat: sale manager
This commit is contained in:
@@ -100,6 +100,7 @@ type UserListItem struct {
|
||||
Nickname string `json:"nickname"`
|
||||
HeadPortrait string `json:"head_portrait"`
|
||||
Mobile string `json:"mobile"`
|
||||
OriginMobile string `json:"origin_mobile"`
|
||||
OnTrialNum int `json:"on_trial_num"`
|
||||
Gender int `json:"gender"`
|
||||
Birthday string `json:"birthday"`
|
||||
|
||||
@@ -83,7 +83,7 @@ func (l *RegisterByUserLogic) RegisterByUser(in *user.RegisterByUserReq) (*user.
|
||||
}
|
||||
|
||||
if v.Type == utils.NumberOne {
|
||||
encryptMobile, cErr := utils.Crypto{}.AESEncryptECB(v.Account)
|
||||
encryptMobile, cErr := utils.EncryptPhone(v.Account)
|
||||
if cErr != nil {
|
||||
l.Errorf("registerByUser encrypt mobile: %v", cErr)
|
||||
return failResponse(utils.ErrorEncryptAesError), nil
|
||||
|
||||
@@ -51,7 +51,7 @@ func (l *RegisterLogic) Register(in *user.RegisterReq) (*user.Response, error) {
|
||||
return failResponse(utils.ErrorExist), nil
|
||||
}
|
||||
|
||||
encryptMobile, cErr := utils.Crypto{}.AESEncryptECB(v.Mobile)
|
||||
encryptMobile, cErr := utils.EncryptPhone(v.Mobile)
|
||||
if cErr != nil {
|
||||
l.Errorf("register encrypt mobile: %v", cErr)
|
||||
return failResponse(utils.ErrorEncryptAesError), nil
|
||||
|
||||
@@ -39,7 +39,7 @@ func decryptMobile(mobile string) string {
|
||||
if mobile == utils.StringEmpty {
|
||||
return utils.StringEmpty
|
||||
}
|
||||
plain, err := utils.Crypto{}.AESDecryptECB(mobile)
|
||||
plain, err := utils.DecryptPhone(mobile)
|
||||
if err != nil {
|
||||
return utils.StringEmpty
|
||||
}
|
||||
|
||||
@@ -49,23 +49,22 @@ func (l *UserItemsLogic) UserItems(in *user.UserItemsReq) (*user.Response, error
|
||||
size = modelbase.DefaultSize
|
||||
}
|
||||
|
||||
where := map[string]string{}
|
||||
if v.Mobile != utils.StringEmpty {
|
||||
mobile, cErr := utils.Crypto{}.AESEncryptECB(v.Mobile)
|
||||
if cErr != nil {
|
||||
l.Errorf("user items encrypt mobile: %v", cErr)
|
||||
return failResponse(utils.ErrorEncryptAesError), nil
|
||||
}
|
||||
where["mobile"] = mobile
|
||||
}
|
||||
|
||||
var list []dao.UserListRow
|
||||
result, err := model.UserModel{}.Init().Page(modelbase.Params{
|
||||
Eq: where,
|
||||
params := modelbase.Params{
|
||||
Order: "id DESC",
|
||||
Page: page,
|
||||
Size: size,
|
||||
}, &list)
|
||||
}
|
||||
if v.Mobile != utils.StringEmpty {
|
||||
phone := utils.GetSearchPhone(v.Mobile)
|
||||
if len(phone) > utils.NumberZero {
|
||||
params.Like = map[string]string{
|
||||
"mobile LIKE ? ": "%%" + phone + "%%",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var list []dao.UserListRow
|
||||
result, err := model.UserModel{}.Init().Page(params, &list)
|
||||
if err != nil {
|
||||
l.Errorf("user items: %v", err)
|
||||
return failResponse(utils.Fail), nil
|
||||
@@ -74,12 +73,17 @@ func (l *UserItemsLogic) UserItems(in *user.UserItemsReq) (*user.Response, error
|
||||
items := make([]dao.UserListItem, 0, len(list))
|
||||
for _, row := range list {
|
||||
headPortrait, _ := utils.BuildImageURL(row.Avatar).(string)
|
||||
mobile := row.Mobile
|
||||
if plain, dErr := utils.DecryptPhone(row.Mobile); dErr == nil {
|
||||
mobile = utils.DecryptPhoneReplace(plain)
|
||||
}
|
||||
items = append(items, dao.UserListItem{
|
||||
Id: row.Id,
|
||||
Username: row.Username,
|
||||
Nickname: row.Nickname,
|
||||
HeadPortrait: headPortrait,
|
||||
Mobile: utils.DecryptMobile(row.Mobile),
|
||||
Mobile: mobile,
|
||||
OriginMobile: row.Mobile,
|
||||
OnTrialNum: row.OnTrialNum,
|
||||
Gender: row.Gender,
|
||||
Birthday: row.Birthday,
|
||||
|
||||
Reference in New Issue
Block a user