|
|
@@ -3,6 +3,10 @@ |
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"fmt" |
|
|
|
"reflect" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
@@ -21,3 +25,26 @@ func (u UserWalletFlowDb) UserWalletFlowInsertBySession(session *xorm.Session, u |
|
|
|
} |
|
|
|
return userWalletFlow.Id, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserWalletFlowDb) UserWalletFlowFindByParams(params map[string]interface{}, page, limit int) (*[]model.UserWalletFlow, int64, error) { |
|
|
|
var m []model.UserWalletFlow |
|
|
|
if page == 0 || limit == 0 { |
|
|
|
page = 1 |
|
|
|
limit = 10 |
|
|
|
} |
|
|
|
var total int64 |
|
|
|
var err error |
|
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
|
//指定In查询 |
|
|
|
if total, err = u.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m); err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Warn(err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
var query = fmt.Sprintf("%s =?", params["key"]) |
|
|
|
total, err = u.Db.Where(query, params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
} |
|
|
|
return &m, total, nil |
|
|
|
} |