Merge branch 'dev-lzh' into dev
This commit is contained in:
commit
7154d0a92a
@ -99,6 +99,9 @@ func GetBundleExtendRecordList(req *bundle.BundleExtendRecordsListRequest) (data
|
||||
}
|
||||
|
||||
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").
|
||||
Select(`
|
||||
bb.*,
|
||||
@ -113,7 +116,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 `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 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 utils.IsPhoneNumber(req.UserName) {
|
||||
session = session.Where("u.tel_num = ?", req.UserName)
|
||||
@ -288,7 +292,7 @@ func ToBeComfirmedWorks(req *bundle.ToBeComfirmedWorksReq) (data []model.CastWor
|
||||
session := app.ModuleClients.BundleDB.
|
||||
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).
|
||||
Where("artist_uuid = ?", req.ArtistUuid)
|
||||
Where("artist_uuid = ?", req.ArtistUuid).Where("work_status in ?", []int{4, 5, 6, 7})
|
||||
err = session.Count(&total).Error
|
||||
if err != nil {
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user