添加未购买过滤
This commit is contained in:
parent
c6a65f4589
commit
4e2faf05cb
@ -96,7 +96,7 @@ func GetBundleExtendRecordList(req *bundle.BundleExtendRecordsListRequest) (data
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.BundleBalancePo, total int64, err error) {
|
func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.BundleBalancePo, total int64, err error) {
|
||||||
session := app.ModuleClients.BundleDB.Table("fiee_bundle.bundle_balance AS bb").
|
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
||||||
Select(`
|
Select(`
|
||||||
bb.*,
|
bb.*,
|
||||||
bor.expiration_time as expired_time,
|
bor.expiration_time as expired_time,
|
||||||
@ -106,10 +106,10 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
rn.name as user_name,
|
rn.name as user_name,
|
||||||
u.tel_num as user_phone_number
|
u.tel_num as user_phone_number
|
||||||
`).
|
`).
|
||||||
Joins("INNER JOIN bundle_order_records bor on bor.uuid = bb.order_uuid").
|
Joins("LEFT JOIN fiee_bundle.bundle_balance AS bb on u.id = bb.user_id").
|
||||||
Joins("LEFT JOIN `micro-account`.`user` u on u.id = bb.user_id").
|
Joins("LEFT JOIN `micro-account`.`real_name` rn on u.real_name_id = rn.id").
|
||||||
Joins("LEFT JOIN `micro-account`.`real_name` rn on u.real_name_id = rn.id").
|
Joins("LEFT JOIN bundle_order_records bor on bor.uuid = bb.order_uuid").
|
||||||
Where("bor.deleted_at IS NULL")
|
Where("bor.deleted_at IS NULL and rn.name IS NOT NULL")
|
||||||
if req.UserName != "" {
|
if req.UserName != "" {
|
||||||
session = session.Where("rn.name like ?", "%"+req.UserName+"%")
|
session = session.Where("rn.name like ?", "%"+req.UserName+"%")
|
||||||
}
|
}
|
||||||
@ -125,6 +125,12 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
if req.ExpiredTimeStart != 0 {
|
if req.ExpiredTimeStart != 0 {
|
||||||
session = session.Where("bor.expiration_time >= ?", time.UnixMilli(req.ExpiredTimeStart))
|
session = session.Where("bor.expiration_time >= ?", time.UnixMilli(req.ExpiredTimeStart))
|
||||||
}
|
}
|
||||||
|
if req.Bought == 2 {
|
||||||
|
session = session.Where("bor.uuid IS NOT NULL")
|
||||||
|
}
|
||||||
|
if req.Bought == 1 {
|
||||||
|
session = session.Where("bor.uuid IS NULL")
|
||||||
|
}
|
||||||
err = session.Count(&total).Error
|
err = session.Count(&total).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
@ -514,10 +514,11 @@ message GetBundleBalanceListReq{
|
|||||||
string userName = 1;
|
string userName = 1;
|
||||||
int32 status = 2;
|
int32 status = 2;
|
||||||
string bundleName = 3;
|
string bundleName = 3;
|
||||||
int64 expiredTimeStart = 4;
|
int32 bought = 4;
|
||||||
int64 expiredTimeEnd = 5;
|
int64 expiredTimeStart = 5;
|
||||||
int32 page = 6;
|
int64 expiredTimeEnd = 6;
|
||||||
int32 pageSize = 7;
|
int32 page = 7;
|
||||||
|
int32 pageSize = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
message GetBundleBalanceReq{
|
message GetBundleBalanceReq{
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -7,8 +7,8 @@ import (
|
|||||||
fmt "fmt"
|
fmt "fmt"
|
||||||
math "math"
|
math "math"
|
||||||
proto "github.com/golang/protobuf/proto"
|
proto "github.com/golang/protobuf/proto"
|
||||||
_ "google.golang.org/protobuf/types/descriptorpb"
|
|
||||||
_ "github.com/mwitkow/go-proto-validators"
|
_ "github.com/mwitkow/go-proto-validators"
|
||||||
|
_ "google.golang.org/protobuf/types/descriptorpb"
|
||||||
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user