|
|
|
@ -7,6 +7,7 @@ import (
|
|
|
|
|
"recook/internal/define"
|
|
|
|
|
"recook/internal/libs/bean"
|
|
|
|
|
"recook/internal/service/baseCode"
|
|
|
|
|
"recook/internal/v2/model/company"
|
|
|
|
|
"recook/internal/v2/model/recook/user"
|
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
@ -19,9 +20,10 @@ import (
|
|
|
|
|
type AppUserReq struct {
|
|
|
|
|
bean.Page
|
|
|
|
|
AppUserInfo
|
|
|
|
|
Start string `json:"start"`
|
|
|
|
|
End string `json:"end"`
|
|
|
|
|
Kind uint `json:"kind"`
|
|
|
|
|
Start string `json:"start"`
|
|
|
|
|
End string `json:"end"`
|
|
|
|
|
Kind uint `json:"kind"`
|
|
|
|
|
TaxBillType string `json:"taxBillType"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type AppUserInfo struct {
|
|
|
|
@ -30,6 +32,7 @@ type AppUserInfo struct {
|
|
|
|
|
Level uint `json:"level"`
|
|
|
|
|
IsOffline bool `json:"is_offline"`
|
|
|
|
|
CreatedAt formatime.Second `json:"created_at"`
|
|
|
|
|
TaxType string `json:"tax_type"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err error) {
|
|
|
|
@ -38,7 +41,6 @@ func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err err
|
|
|
|
|
if args.Mobile != "" {
|
|
|
|
|
query = query.Where("mobile = ?", args.Mobile)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if args.Nickname != "" {
|
|
|
|
|
query = query.Where("nickname = ?", args.Nickname)
|
|
|
|
|
}
|
|
|
|
@ -58,14 +60,17 @@ func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err err
|
|
|
|
|
query = query.Where("level = 2 and is_offline = 0")
|
|
|
|
|
case 4: // vip店铺
|
|
|
|
|
query = query.Where("level = 2 and is_offline = 1")
|
|
|
|
|
case 5: // 子公司
|
|
|
|
|
case 5: // 合伙人
|
|
|
|
|
query = query.Where("level = 10")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if args.TaxType != "" {
|
|
|
|
|
query = query.Where("id in (?)", mysql.Db.Select("user_id").Model(&company.Info{}).Where("tax_type = ?", args.TaxType))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
query.Count(&total)
|
|
|
|
|
var temp []user.RecookUserInfoModel
|
|
|
|
|
query.Offset(args.GetStart()).Limit(args.GetLimit()).Find(&temp)
|
|
|
|
|
query.Preload("CompanyInfo").Offset(args.GetStart()).Limit(args.GetLimit()).Find(&temp)
|
|
|
|
|
for _, v := range temp {
|
|
|
|
|
res = append(res, AppUserInfo{
|
|
|
|
|
Mobile: v.Mobile,
|
|
|
|
@ -73,6 +78,7 @@ func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err err
|
|
|
|
|
Level: uint(v.Level),
|
|
|
|
|
IsOffline: v.IsOffline,
|
|
|
|
|
CreatedAt: v.CreatedAt,
|
|
|
|
|
TaxType: v.CompanyInfo.TaxType,
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
return
|
|
|
|
|