修改需求

master
KK 3 years ago
parent c8c58ba248
commit 26a2f7f79c

@ -20,20 +20,20 @@ import (
type AppUserReq struct { type AppUserReq struct {
bean.Page bean.Page
AppUserInfo AppUserInfo
Start string `json:"start"` Start string `json:"start"`
End string `json:"end"` End string `json:"end"`
Kind uint `json:"kind"` Kind uint `json:"kind"`
TaxBillType string `json:"taxBillType"` TaxBillType string `json:"taxBillType"`
IsEnterprise uint `json:"isEnterprise"` // 1公司 2 个人
} }
type AppUserInfo struct { type AppUserInfo struct {
Mobile string `json:"mobile"` Mobile string `json:"mobile"`
Nickname string `json:"nickname"` Nickname string `json:"nickname"`
Level uint `json:"level"` Level uint `json:"level"`
IsOffline bool `json:"is_offline"` IsOffline bool `json:"is_offline"`
CreatedAt formatime.Second `json:"created_at"` CreatedAt formatime.Second `json:"created_at"`
TaxType string `json:"tax_type"` TaxType string `json:"tax_type"`
IsEnterprise uint `json:"isEnterprise"` // 1 公司 0 个人
} }
func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err error) { func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err error) {
@ -68,8 +68,12 @@ func (o logic) AppUser(args AppUserReq) (res []AppUserInfo, total int64, err err
if args.TaxType != "" { if args.TaxType != "" {
query = query.Where("id in (?)", mysql.Db.Select("user_id").Model(&company.Info{}).Where("tax_type = ?", args.TaxType)) query = query.Where("id in (?)", mysql.Db.Select("user_id").Model(&company.Info{}).Where("tax_type = ?", args.TaxType))
} }
if args.IsEnterprise == 0 || args.IsEnterprise == 1 { if args.IsEnterprise != 0 { // 判断公司还是个人
query = query.Where("is_enterprise = ? ", args.IsEnterprise) if args.IsEnterprise == 1 {
query = query.Where("is_enterprise = ? ", args.IsEnterprise)
} else {
query = query.Where("is_enterprise = ? ", 0)
}
} }
} }
query.Count(&total) query.Count(&total)

Loading…
Cancel
Save