예제 #1
0
        /// <summary>
        /// <see cref="IDoorControlService.CreateDoorAuth(DoorAuthAddDto)"/>
        /// </summary>
        public async Task <string> CreateDoorAuth(Dto.DoorAuthAddDto model)
        {
            //todo create task
            var taskId = await CreateDoorAuthTask(model.TaskType.GetHashCode());

            if (taskId.IsNotWhiteSpace())
            {
                throw new MyException("创建task失败");
            }
            model.TaskId = taskId;

            var data = await _hikHttp.PostAsync <HikVisionResponse>("/api/acps/v1/authDownload/data/addition", model);

            if (data.Success)
            {
                return(taskId);
            }
            throw new MyException("门禁点权限下发失败:" + data.Msg);
        }
예제 #2
0
        /// <summary>
        /// <see cref="IDoorControlService.CreateDoorAuth(DoorAuthAddDto)"/>
        /// </summary>
        public async Task <string> CreateDoorAuth(Dto.DoorAuthAddDto model)
        {
            //todo create task
            var taskId = await CreateDoorAuthTask(model.TaskType.GetHashCode());

            if (taskId.IsNotWhiteSpace())
            {
                throw new MyException("创建task失败");
            }
            model.TaskId = taskId;

            var data = await _doorControlApi.AppendFormatToHik("/api/acps/v1/authDownload/data/addition")
                       .SetHiKSecreity()
                       .PostAsync(model)
                       .ReciveJsonResultAsync <HikVisionResponse>();

            if (data.Success)
            {
                return(taskId);
            }
            throw new MyException("门禁点权限下发失败:" + data.Msg);
        }