feat: sale info
This commit is contained in:
@@ -66,6 +66,34 @@ func maskSaleMobile(info *dao.SaleInfo) {
|
||||
info.Mobile = utils.DecryptPhoneReplace(mobile)
|
||||
}
|
||||
|
||||
// querySaleInfo 查询销售详情并附带分组;mobile 脱敏,origin_mobile 为加密串。
|
||||
// 未找到时返回 (nil, nil)。
|
||||
func querySaleInfo(id int64) (*dao.SaleInfo, error) {
|
||||
var info dao.SaleInfo
|
||||
if err := (model.SaleModel{}.Init().GetOne(modelbase.Params{
|
||||
Eq: map[string]string{"id": strconv.FormatInt(id, 10)},
|
||||
}, &info)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if info.Id < utils.NumberOne {
|
||||
return nil, nil
|
||||
}
|
||||
maskSaleMobile(&info)
|
||||
|
||||
if info.GroupId > utils.NumberZero {
|
||||
var group dao.SaleGroupNameItem
|
||||
if err := (model.SaleGroupModel{}.Init().GetOne(modelbase.Params{
|
||||
Eq: map[string]string{"id": strconv.FormatInt(info.GroupId, 10)},
|
||||
}, &group)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if group.Id > utils.NumberZero {
|
||||
info.Group = &group
|
||||
}
|
||||
}
|
||||
return &info, nil
|
||||
}
|
||||
|
||||
func maskSaleNameItems(items []dao.SaleNameItem) {
|
||||
for i := range items {
|
||||
mobile, err := utils.DecryptPhone(items[i].Mobile)
|
||||
|
||||
Reference in New Issue
Block a user