过滤待确认条件
This commit is contained in:
parent
043274e61f
commit
f55af5f719
@ -97,6 +97,9 @@ 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) {
|
||||||
|
subQuery := app.ModuleClients.BundleDB.Table("bundle_order_records").
|
||||||
|
Select("customer_id, MAX(created_at) AS max_created_time").
|
||||||
|
Group("customer_id")
|
||||||
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
session := app.ModuleClients.BundleDB.Table("`micro-account`.`user` AS u").
|
||||||
Select(`
|
Select(`
|
||||||
bb.*,
|
bb.*,
|
||||||
@ -111,7 +114,8 @@ func GetBundleBalanceList(req *bundle.GetBundleBalanceListReq) (data []model.Bun
|
|||||||
Joins("LEFT JOIN fiee_bundle.bundle_balance AS bb on u.id = bb.user_id").
|
Joins("LEFT JOIN fiee_bundle.bundle_balance AS bb 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").
|
Joins("LEFT JOIN bundle_order_records bor on bor.uuid = bb.order_uuid").
|
||||||
Where("bor.deleted_at IS NULL and rn.name IS NOT NULL and u.deleted_at = 0")
|
Joins("INNER JOIN (?) AS t ON bor.customer_id = t.customer_id AND bor.created_at = t.max_created_time", subQuery).
|
||||||
|
Where("rn.name IS NOT NULL and u.deleted_at = 0")
|
||||||
if req.UserName != "" {
|
if req.UserName != "" {
|
||||||
if utils.IsPhoneNumber(req.UserName) {
|
if utils.IsPhoneNumber(req.UserName) {
|
||||||
session = session.Where("u.tel_num = ?", req.UserName)
|
session = session.Where("u.tel_num = ?", req.UserName)
|
||||||
@ -286,7 +290,7 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWor
|
|||||||
session := app.ModuleClients.BundleDB.
|
session := app.ModuleClients.BundleDB.
|
||||||
Table("cast_work_log AS cwl").
|
Table("cast_work_log AS cwl").
|
||||||
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", subQuery).
|
Joins("INNER JOIN (?) AS t ON cwl.work_uuid = t.work_uuid AND cwl.update_time = t.max_update_time", subQuery).
|
||||||
Where("artist_uuid = ?", req.ArtistUuid)
|
Where("artist_uuid = ?", req.ArtistUuid).Where("work_status in ?", []int{4, 5, 6, 7})
|
||||||
err = session.Count(&total).Error
|
err = session.Count(&total).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user