|
|
@@ -1,4 +1,4 @@ |
|
|
|
package implement |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao" |
|
|
@@ -7,12 +7,40 @@ import ( |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao { |
|
|
|
return &HoneyDividendBasicDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type HoneyDividendBasicDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func NewHoneyDividendBasicDb(engine *xorm.Engine) dao.HoneyDividendBasicDao { |
|
|
|
return &HoneyDividendBasicDb{Db: engine} |
|
|
|
func (i HoneyDividendBasicDb) UpdateHoneyDividendBasic(m *models.HoneyDividendBasic, forceColums ...string) (int64, error) { |
|
|
|
var ( |
|
|
|
affected int64 |
|
|
|
err error |
|
|
|
) |
|
|
|
if forceColums != nil { |
|
|
|
affected, err = i.Db.Where("id=?", m.Id).Cols(forceColums...).Update(m) |
|
|
|
} else { |
|
|
|
affected, err = i.Db.Where("id=?", m.Id).Update(m) |
|
|
|
} |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return affected, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (i HoneyDividendBasicDb) GetHoneyDividendBasic() (m *models.HoneyDividendBasic, err error) { |
|
|
|
m = new(models.HoneyDividendBasic) |
|
|
|
has, err := i.Db.Where("is_open = 1").Get(m) |
|
|
|
if err != nil { |
|
|
|
return nil, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
if has == false { |
|
|
|
return nil, nil |
|
|
|
} |
|
|
|
return m, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (i HoneyDividendBasicDb) GetHoneyDividendBasicByCoinIdSess(sess *xorm.Session, coinId int) (m *models.HoneyDividendBasic, err error) { |
|
|
|