pic_whiter.go 713 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package gate_pic
  2. import (
  3. dbmodel "property-device/model"
  4. "property-device/utils/gate_utils"
  5. )
  6. type PicWhiter interface {
  7. PersonAdd()
  8. PicAdd()
  9. PicUpdate()
  10. PersonDel()
  11. Command() bool
  12. }
  13. func NewPicWhiter(up *dbmodel.TUserPic, device *dbmodel.TGate, gp *dbmodel.TGatePic) PicWhiter {
  14. switch device.Protocol {
  15. case gate_utils.GateProtocolYufanHttpV1:
  16. byIp := false
  17. if gate_utils.CheckYufanIp(device.Ip, device.Port, device.Password) {
  18. byIp = true
  19. }
  20. return &PicYufanHttpv1Whiter{
  21. Up: up,
  22. Device: device,
  23. Gp: gp,
  24. ByIp: byIp,
  25. }
  26. case gate_utils.GateProtocolSaiboMqttV1:
  27. return &PicSaiboMqttv1Whiter{
  28. Up: up,
  29. Device: device,
  30. Gp: gp,
  31. }
  32. }
  33. return nil
  34. }