contract.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package contract
  2. import (
  3. "context"
  4. "log"
  5. "personnelBehavior/internal/dao"
  6. "personnelBehavior/internal/model"
  7. "personnelBehavior/internal/service"
  8. )
  9. //业务接口的实现
  10. type (
  11. sContract struct{}
  12. )
  13. func init() {
  14. log.Println("--初始 接口 实现--")
  15. service.RegisterContract(New())
  16. }
  17. func New() *sContract {
  18. return &sContract{}
  19. }
  20. // InsertRecords 用户行为记录
  21. func (s *sContract) InsertRecords(ctx context.Context, in model.ContractInsertInput, chainName string) (err error) {
  22. return dao.Contract.ExecInsert(ctx, in, chainName)
  23. }
  24. // IsExists 表是否存在
  25. func (s *sContract) IsExists(ctx context.Context, chainName string) (err error) {
  26. return dao.Contract.IsExists(ctx, chainName)
  27. }
  28. // UpdateRedis 更新redis 表信息
  29. func (s *sContract) UpdateRedis(ctx context.Context, chainName string) (err error) {
  30. return dao.Contract.UpdateRedis(ctx, chainName)
  31. }
  32. // CreateTable 创建表
  33. func (s *sContract) CreateTable(ctx context.Context, chainName string) (err error) {
  34. return dao.Contract.CreateTable(ctx, chainName)
  35. }