package gate_card import ( dbmodel "property-device/model" "property-device/utils/gate_utils" ) type CardWhiter interface { PersonAdd() PersonDel() Command() bool } func NewCardWhiter(ucard *dbmodel.TUserCard, device *dbmodel.TGate, gcard *dbmodel.TGateCard) CardWhiter { switch device.Protocol { case gate_utils.GateProtocolSaiboHttpV1: return &CardSaiboHttpv1Whiter{ Gcard: gcard, Device: device, UCard: ucard, //Device: device, } case gate_utils.GateProtocolYufanHttpV1: byIp := false if gate_utils.CheckYufanIp(device.Ip, device.Port, device.Password) { byIp = true } return &CardYufanHttpv1Whiter{ Gcard: gcard, Device: device, UCard: ucard, ByIp: byIp, } case gate_utils.GateProtocolSaiboMqttV1: return nil } return nil }