|
|
@@ -1,9 +1,10 @@ |
|
|
|
package implement |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/zhimeng/model.git/src/super/dao" |
|
|
|
"code.fnuoos.com/zhimeng/model.git/src/super/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/zhimeng/model.git/utils/logx" |
|
|
|
"strings" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -42,3 +43,43 @@ func (m MediumSettlementDb) GetMediumSettlementForAvailable(mediumId int) (mediu |
|
|
|
} |
|
|
|
return mediumSettlement, nil |
|
|
|
} |
|
|
|
func (m MediumSettlementDb) GetMediumSettlementById(id int) (mediumSettlement *model.MediumSettlement, err error) { |
|
|
|
mediumSettlement = new(model.MediumSettlement) |
|
|
|
has, err := m.Db.Where("id =?", id).Get(mediumSettlement) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return mediumSettlement, nil |
|
|
|
} |
|
|
|
func (m MediumSettlementDb) FindMediumSettlementList(uuid, mediumId, appId, payState, state, startDate, endDate string, page, limit int) (list []model.MediumSettlement, total int64, err error) { |
|
|
|
sess := m.Db.OrderBy("start_date desc,id desc").Limit(limit, (page-1)*limit) |
|
|
|
if uuid != "" { |
|
|
|
sess.And("uuid = ?", uuid) |
|
|
|
} |
|
|
|
if payState != "" { |
|
|
|
sess.And("pay_state = ?", payState) |
|
|
|
} |
|
|
|
if state != "" { |
|
|
|
sess.And("state = ?", state) |
|
|
|
} |
|
|
|
if startDate != "" { |
|
|
|
sess.And("start_date>=", startDate) |
|
|
|
} |
|
|
|
if endDate != "" { |
|
|
|
sess.And("end_date<=", endDate) |
|
|
|
} |
|
|
|
if appId != "" { |
|
|
|
sess.In("app_id", strings.Split(appId, ",")) |
|
|
|
} |
|
|
|
if mediumId != "" { |
|
|
|
sess.In("medium_id", strings.Split(mediumId, ",")) |
|
|
|
} |
|
|
|
total, err = sess.FindAndCount(&list) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, err |
|
|
|
} |
|
|
|
return |
|
|
|
} |