|
|
@@ -0,0 +1,33 @@ |
|
|
|
package implement |
|
|
|
|
|
|
|
import ( |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" |
|
|
|
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" |
|
|
|
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" |
|
|
|
"xorm.io/xorm" |
|
|
|
) |
|
|
|
|
|
|
|
func NewEggAccessRecordsDb(engine *xorm.Engine) dao.EggAccessRecordsDao { |
|
|
|
return &EggAccessRecordsDb{Db: engine} |
|
|
|
} |
|
|
|
|
|
|
|
type EggAccessRecordsDb struct { |
|
|
|
Db *xorm.Engine |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggAccessRecordsDb) EggAccessRecordsExist(uid int64, date string, index string) (bool, error) { |
|
|
|
var m model.EggAccessRecords |
|
|
|
exist, err := e.Db.Where("uid = ?", uid).And("date = ?", date).And("page_index = ?", index).Exist(&m) |
|
|
|
if err != nil { |
|
|
|
return false, zhios_order_relate_logx.Error(err.Error()) |
|
|
|
} |
|
|
|
return exist, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (e EggAccessRecordsDb) EggAccessRecordsInsert(m *model.EggAccessRecords) (int64, error) { |
|
|
|
_, err := e.Db.InsertOne(m) |
|
|
|
if err != nil { |
|
|
|
return 0, err |
|
|
|
} |
|
|
|
return m.Id, nil |
|
|
|
} |