diff --git a/app/db/db_master_list_cfg.go b/app/db/db_master_list_cfg.go index 15c10c8..87cad4c 100644 --- a/app/db/db_master_list_cfg.go +++ b/app/db/db_master_list_cfg.go @@ -45,16 +45,26 @@ func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOneNoDataNoErr(key strin func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOne(uid, key string) (*model.MasterListCfg, error) { var cfgList model.MasterListCfg - if has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList); err != nil || has == false { + has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList) + if err != nil { return nil, logx.Error(err) } + if has == false { + cfgList = model.MasterListCfg{Uid: uid, K: key} + masterListCfgDb.Db.InsertOne(&cfgList) + } return &cfgList, nil } func (masterListCfgDb *MasterListCfgDb) MasterListCfgGetOneData(uid, key string) string { var cfgList model.MasterListCfg - if has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList); err != nil || has == false { + has, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Get(&cfgList) + if err != nil { return "" } + if has == false { + cfgList = model.MasterListCfg{Uid: uid, K: key} + masterListCfgDb.Db.InsertOne(&cfgList) + } return cfgList.V } @@ -70,7 +80,7 @@ func (masterListCfgDb *MasterListCfgDb) MasterListCfgInsert(uid, key, val, memo func (masterListCfgDb *MasterListCfgDb) MasterListCfgUpdate(uid, key, val string) bool { cfg := model.MasterListCfg{K: key, V: val} - _, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Cols("val").Update(&cfg) + _, err := masterListCfgDb.Db.Where("`k`=? and uid=?", key, uid).Cols("v").Update(&cfg) if err != nil { logx.Error(err) return false diff --git a/app/db/db_playlet_sale_order.go b/app/db/db_playlet_sale_order.go index 62d4b14..f9226da 100644 --- a/app/db/db_playlet_sale_order.go +++ b/app/db/db_playlet_sale_order.go @@ -76,8 +76,9 @@ func (playletSaleOrderDb *PlayletSaleOrderDb) GetPlayletVideoOrderList(args map[ sess = sess.And("update_time>=?", args["start_time"]) } if args["end_time"] != "" { - sess = sess.And("update_time>=?", args["end_time"]) + sess = sess.And("update_time<=?", args["end_time"]) } + if args["to_settle_time"] != "" { sess = sess.And("create_time