package gate_pic import ( dbmodel "property-device/model" "property-device/utils/gate_utils" ) type PicWhiter interface { PersonAdd() PicAdd() PicUpdate() PersonDel() Command() bool } func NewPicWhiter(up *dbmodel.TUserPic, device *dbmodel.TGate, gp *dbmodel.TGatePic) PicWhiter { switch device.Protocol { case gate_utils.GateProtocolYufanHttpV1: byIp := false if gate_utils.CheckYufanIp(device.Ip, device.Port, device.Password) { byIp = true } return &PicYufanHttpv1Whiter{ Up: up, Device: device, Gp: gp, ByIp: byIp, } case gate_utils.GateProtocolSaiboMqttV1: return &PicSaiboMqttv1Whiter{ Up: up, Device: device, Gp: gp, } } return nil }