pic_saibo_mqttv1_whiter.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package gate_pic
  2. import (
  3. "context"
  4. dbmodel "property-device/model"
  5. "property-device/pb"
  6. pb_v1 "property-device/pb/v1"
  7. "property-device/utils/gate_utils"
  8. )
  9. type PicSaiboMqttv1Whiter struct {
  10. Up *dbmodel.TUserPic
  11. Device *dbmodel.TGate
  12. Gp *dbmodel.TGatePic
  13. command bool
  14. }
  15. func (p *PicSaiboMqttv1Whiter) PersonAdd() {
  16. mreq := pb_v1.FaceWhiteAddRequest{
  17. Sn: p.Device.Sn,
  18. List: []*pb_v1.FaceWhiteData{&pb_v1.FaceWhiteData{
  19. CustomId: p.Up.Uid,
  20. Name: p.Up.Name,
  21. Pic: p.Up.PicUrl,
  22. }},
  23. }
  24. _, err := pb.Mqtt.FaceWhiteAdd(context.Background(), &mreq)
  25. if err != nil {
  26. whitePicSetFail(p.Up, p.Device, gate_utils.WhiteAddStatusPersonFail, err.Error())
  27. }
  28. return
  29. }
  30. func (p *PicSaiboMqttv1Whiter) PicAdd() {
  31. return
  32. }
  33. func (p *PicSaiboMqttv1Whiter) PicUpdate() {
  34. p.PersonAdd()
  35. return
  36. }
  37. func (p *PicSaiboMqttv1Whiter) PersonDel() {
  38. mreq := pb_v1.FaceWhiteDelRequest{
  39. Sn: p.Device.Sn,
  40. CustomIds: []string{p.Up.Uid},
  41. }
  42. _, _ = pb.Mqtt.FaceWhiteDel(context.Background(), &mreq)
  43. return
  44. }
  45. func (p *PicSaiboMqttv1Whiter) Command() bool {
  46. return p.command
  47. }