public void OnS2CNotify(NetPack pack) { //Debug.LogFormat("提示通知/对白框相关系统消息协议NotifyMsgID,CMD={0}, ", pack.CMD); switch ((NotifyMsgID)pack.CMD) { case NotifyMsgID.S2CNotifyNarmal: PB_NotifyNarmal mNotifyNarmal = PB_NotifyNarmal.Parser.ParseFrom(pack.BodyBuffer.Bytes); Debug.LogFormat("OnS2CNotify,普通悬浮提示:mNotifyNarmal={0}", mNotifyNarmal.ToString()); NotifyManager mNotifyManager = FindObjectOfType <NotifyManager>(); mNotifyManager.AddNotify(mNotifyNarmal.Msg); break; } }
public async Task <object> notifyAsync(EnterAndLeaveViewModel model) { //通过查询设备ID获取到学校ID,再将学校ID赋值给进出记录ID try { #region 前置设置 string inouttype = ""; switch (model.authType) { case "ICCard": model.authType = "IC卡"; break; case "QRCode": model.authType = "二维码"; break; case "FaceReco": model.authType = "人脸识别"; break; } switch (model.inOutType) { case 0: inouttype = "进"; break; case 1: inouttype = "出"; break; } string State = "正常"; #endregion int SchoolID = EqManager.GetSchoolIdByEqNum(model.deviceSerial); var result = AttendanceManager.GetTime(SchoolID); if (result == null) { State = "未设置考勤范围"; } else { if (model.inOutType == 0) { DateTime jinTime = DateTime.Parse(model.time); if (jinTime.Hour >= result.InTime.Hour) { if (jinTime.Minute > 0) { //迟到,增加一个考勤字段,在这里将这个考勤字段设置为迟到 State = "迟到"; } } } if (model.inOutType == 1) { DateTime jinTime = DateTime.Parse(model.time); if (jinTime.Hour <= result.OutTime.Hour) { if (jinTime.Minute < 60) { //早退 State = "早退"; } } } } await NotifyManager.AddNotify(SchoolID, model.faceID, model.deviceSerial, model.faceName, model.authType, inouttype, model.time, State, model.deviceID, model.snapshotUrl, "data:image/jpeg;base64," + model.snapshotContent, model.temperature); var rst = new { errCode = 0, errMsg = "success" }; return(rst); } catch (Exception ex) { var err = new { errCode = 1, errMsg = ex.Message }; return(err); } }