using Mapster; using Znyc.CloudCar.Auth.HttpContextUser; using Znyc.CloudCar.Configuration; using Znyc.CloudCar.IRepository.Audit; using Znyc.CloudCar.IRepository.Currency; using Znyc.CloudCar.IRepository.Equipment; using Znyc.CloudCar.IRepository.EquipmentPicture; using Znyc.CloudCar.IRepository.User; using Znyc.CloudCar.IServices.CaChe; using Znyc.CloudCar.IServices.Collection; using Znyc.CloudCar.IServices.Currency; using Znyc.CloudCar.IServices.Dictionary; using Znyc.CloudCar.IServices.Equipment; using Znyc.CloudCar.IServices.EquipmentPicture; using Znyc.CloudCar.IServices.User; using Znyc.CloudCar.Model.Dtos.Equipment; using Znyc.CloudCar.Model.Dtos.EquipmentPicture; using Znyc.CloudCar.Model.Dtos.User; using Znyc.CloudCar.Model.Entities; using Znyc.CloudCar.Model.ViewModels.ReportsCallBack; using Znyc.CloudCar.Utility.Attributes; using Znyc.CloudCar.Utility.Extensions; using Znyc.CloudCar.Utility.Helper; using static Znyc.CloudCar.Configuration.GlobalEnumVars; using static Znyc.CloudCar.Utility.Helper.DateHelper; namespace Znyc.CloudCar.Services.Equipment { /// /// 设备信息服务 /// public class EquipmentService : IEquipmentService { private readonly IEquipmentRepository _equipmentRepository; private readonly IHttpContextUser _httpContextUser; private readonly IUserService _userService; private readonly IEquipmentPictureService _equipmentPictureSevice; private readonly IDictionaryService _dictionaryService; private readonly ICacheService _cacheService; private readonly IEquipmentPictureRepository _equipmentPictureRepository; private readonly ICurrencyService _currencyService; private readonly ICurrencyRecordService _currencyRecordService; private readonly ICollectionService _collectionService; private readonly ICurrencyRecordRepository _currencyRecordRepository; private readonly IUserRepository _userRepository; private readonly IAuditRepository _auditRepository; private readonly IUserCardRepository _userCardRepository; public EquipmentService( IEquipmentRepository equipmentRepository, IHttpContextUser httpContextUser, IUserService userService, IEquipmentPictureService equipmentPictureService, IDictionaryService dictionaryService, ICacheService cacheService, IEquipmentPictureRepository equipmentPictureRepository, ICurrencyService currencyService, ICurrencyRecordService currencyRecordService, ICollectionService collectionService, ICurrencyRecordRepository currencyRecordRepository, IUserRepository userRepository, IAuditRepository auditRepository, IUserCardRepository userCardRepository ) { _equipmentRepository = equipmentRepository; _httpContextUser = httpContextUser; _userService = userService; _equipmentPictureSevice = equipmentPictureService; _dictionaryService = dictionaryService; _cacheService = cacheService; _equipmentPictureRepository = equipmentPictureRepository; _currencyService = currencyService; _currencyRecordService = currencyRecordService; _collectionService = collectionService; _currencyRecordRepository = currencyRecordRepository; _userRepository = userRepository; _auditRepository = auditRepository; _userCardRepository = userCardRepository; } /// /// 新增设备信息 /// /// /// [Transaction] public async Task AddAsync(EquipmentAddInput input) { ResponseOutput response = new ResponseOutput(); IDictionary userUpdateCount = await _cacheService.GetUserUpdateCountAsync(); double count = 0; if (userUpdateCount.Count() > 0 && userUpdateCount.ContainsKey($"{_httpContextUser.Id}")) { count = userUpdateCount[$"{_httpContextUser.Id}"]; } //是否购买优惠卡 var usercars = await _userCardRepository.Where(x => x.UserId == _httpContextUser.Id && x.IsEnabled == true && x.EndTime > DateTime.Now).ToListAsync(); int freeNumber = 0; var carinfos = await _cacheService.GetCardIntroListAsync(); foreach (var usercar in usercars) { freeNumber += carinfos.Find(x => x.Id == usercar.CardId).FreeNumber; } Console.WriteLine($"{_httpContextUser.Id}|{freeNumber}|{count}"); if (count > freeNumber + 4) { response.Msg = "本月免费发布次数已用完"; response.Successed = false; response.Code = 0; return response; } EquipmentEntity entity = input.Adapt(); #region 拼接标题 string categoryName = (await _dictionaryService.GetByIdAsync(input.EquipmentType))?.Name; string brandName = (await _dictionaryService.GetByIdAsync(input.EquipmentBrand))?.Name; entity.Title = $"转让{brandName}{input.AppearanceDate}年"; if (input.AutomobileChassis > 0) { string automobileChassisName = (await _dictionaryService.GetByIdAsync(input.AutomobileChassis))?.Name; entity.Title += $"{automobileChassisName}"; } if (input.BoomLength > 0) { string boomLengthName = (await _dictionaryService.GetByIdAsync(input.BoomLength))?.Name; entity.Title += $"{boomLengthName}"; } if (input.ReprintVolume > 0) { string reprintVolumeName = (await _dictionaryService.GetByIdAsync(input.ReprintVolume))?.Name; entity.Title += $"{reprintVolumeName}方"; } if (input.MaxTransportation > 0) { string maxTransportationName = (await _dictionaryService.GetByIdAsync(input.MaxTransportation))?.Name; entity.Title += $"{maxTransportationName}"; } if (input.EquipmentModel.IsNotNull()) { entity.Title += $"{input.EquipmentModel}"; } if (input.EquipmentTonnage > 0) { entity.Title += $"{input.EquipmentTonnage}吨"; } if (input.Capacity > 0) { entity.Title += $"{input.Capacity}升"; } if (input.Power.IsNotNull()) { entity.Title += $"{input.Power}"; } entity.Title += $"{categoryName}"; #endregion entity.UserId = _httpContextUser.Id; entity.EquipmentNumber = Convert.ToInt64(CommonHelper.GetEquipmentNumber()); entity.State = (int)StateEnum.InReview; entity.IsPublic = true; entity.RefreshDate = DateTime.Now; entity.SellingPrice = input.SellingPrice * 10000; long id = (await _equipmentRepository.InsertAsync(entity)).Id; foreach (var item in input.EquipmentPictures) { var equipmentPicture = item.Adapt(); equipmentPicture.EquipmentId = id; //equipmentPicture.PictureLink = equipmentPicture.PictureLink[(equipmentPicture.PictureLink.LastIndexOf("/") + 1)..]; await _equipmentPictureRepository.InsertAsync(equipmentPicture); } //用户修改次数自增 await _cacheService.SetIncrUserUpdateCountAsync(entity.UserId); //记录用户保存联系人,联系电话 await _cacheService.SetEquipmentAsync(entity, _httpContextUser.Id); response.Data = id; response.Successed = true; response.Code = 1; return response; } /// /// 编辑设备信息 /// /// /// public async Task UpdateAsync(EquipmentUpdateInput input) { ResponseOutput response = new ResponseOutput(); EquipmentEntity entity = await _equipmentRepository.GetAsync(input.Id); if (entity.IsNull()) { response.Successed = false; response.Msg = "信息不存在!"; response.Code = 0; return response; } IDictionary userUpdateCount = await _cacheService.GetUserUpdateCountAsync(); double count = 0; if (userUpdateCount.Count() > 0 && userUpdateCount.ContainsKey($"{_httpContextUser.Id}")) { count = userUpdateCount[$"{_httpContextUser.Id}"]; } //是否购买优惠卡 var usercars = await _userCardRepository.Where(x => x.UserId == _httpContextUser.Id && x.IsEnabled == true && x.EndTime > DateTime.Now).ToListAsync(); int freeNumber = 0; var carinfos = await _cacheService.GetCardIntroListAsync(); foreach (var usercar in usercars) { freeNumber += carinfos.Find(x => x.Id == usercar.CardId).FreeNumber; } Console.WriteLine($"{_httpContextUser.Id}|{freeNumber}|{count}"); if (count > freeNumber + 4) { response.Msg = "本月免费发布次数已用完"; response.Successed = false; response.Code = 0; return response; } #region 更新设备图片 var oldEquipmentPictures = await _equipmentPictureRepository.Select .Where(x => x.EquipmentId == input.Id && x.IsDeleted == false) .ToListAsync(); var oldEquipmentPictureLinks = oldEquipmentPictures.Select(x => x.PictureLink).ToArray(); var newEquipmentPictureLinks = input.EquipmentPictures.Select(x => x.PictureLink).ToArray(); var deleteProjectPersonLinks = oldEquipmentPictureLinks.Except(newEquipmentPictureLinks).ToArray(); if (deleteProjectPersonLinks.Length > 0) { for (int i = 0; i < deleteProjectPersonLinks.Length; i++) { var equipmentPicture = oldEquipmentPictures.FirstOrDefault(x => x.PictureLink == deleteProjectPersonLinks[i]); equipmentPicture.IsDeleted = true; await _equipmentPictureRepository.UpdateAsync(equipmentPicture); } } foreach (var item in input.EquipmentPictures) { var equipmentPicture = oldEquipmentPictures.Find(x => x.PictureLink == item.PictureLink); if (equipmentPicture == null) { var picture = item.Adapt(); picture.EquipmentId = input.Id; await _equipmentPictureRepository.InsertAsync(picture); } } #endregion input.Adapt(entity); entity.State = (int)StateEnum.InReview; #region 拼接标题 string categoryName = (await _dictionaryService.GetByIdAsync(input.EquipmentType))?.Name; string brandName = (await _dictionaryService.GetByIdAsync(input.EquipmentBrand))?.Name; entity.Title = $"转让{brandName}{input.AppearanceDate}年"; if (input.AutomobileChassis > 0) { string automobileChassisName = (await _dictionaryService.GetByIdAsync(input.AutomobileChassis))?.Name; entity.Title += $"{automobileChassisName}"; } if (input.BoomLength > 0) { string boomLengthName = (await _dictionaryService.GetByIdAsync(input.BoomLength))?.Name; entity.Title += $"{boomLengthName}"; } if (input.ReprintVolume > 0) { string reprintVolumeName = (await _dictionaryService.GetByIdAsync(input.ReprintVolume))?.Name; entity.Title += $"{reprintVolumeName}方"; } if (input.MaxTransportation > 0) { string maxTransportationName = (await _dictionaryService.GetByIdAsync(input.MaxTransportation))?.Name; entity.Title += $"{maxTransportationName}"; } if (input.EquipmentModel.IsNotNull()) { entity.Title += $"{input.EquipmentModel}"; } if (input.EquipmentTonnage > 0) { entity.Title += $"{input.EquipmentTonnage}吨"; } if (input.Capacity > 0) { entity.Title += $"{input.Capacity}升"; } if (input.Power.IsNotNull()) { entity.Title += $"{input.Power}"; } entity.Title += $"{categoryName}"; entity.SellingPrice = entity.SellingPrice * 10000; #endregion response.Data = await _equipmentRepository.UpdateAsync(entity); //用户修改次数自增 await _cacheService.SetIncrUserUpdateCountAsync(entity.UserId); //记录用户保存联系人,联系电话 await _cacheService.SetEquipmentAsync(entity, entity.UserId); response.Successed = true; response.Code = 1; return response; } /// /// 根据Id获取设备信息 /// /// /// public async Task GetAsync(long id) { ResponseOutput response = new ResponseOutput(); EquipmentOutput equipment = await _equipmentRepository.GetAsync(id); if (equipment.IsNull()) { response.Successed = false; response.Msg = "信息不存在!"; response.Code = 0; return response; } UserOutput user = await _userService.GetUserByIdAsync(equipment.UserId); equipment.UserName = user?.UserName ?? GlobalConstVars.User.Default_UserName; equipment.AvatarUrl = user?.AvatarUrl ?? GlobalConstVars.User.Default_AvataUrl_Address; equipment.CategoryName = (await _dictionaryService.GetByIdAsync(equipment.EquipmentType))?.Name; equipment.BrandName = (await _dictionaryService.GetByIdAsync(equipment.EquipmentBrand))?.Name; equipment.AutomobileChassisName = (await _dictionaryService.GetByIdAsync(equipment.AutomobileChassis))?.Name; equipment.BoomLengthName = (await _dictionaryService.GetByIdAsync(equipment.BoomLength))?.Name; equipment.ReprintVolumeName = (await _dictionaryService.GetByIdAsync(equipment.ReprintVolume))?.Name; equipment.MaxTransportationName = (await _dictionaryService.GetByIdAsync(equipment.MaxTransportation))?.Name; equipment.CallPhoneCurrency = CommonHelper.GetCallPhoneCurrency(Convert.ToInt32(equipment.SellingPrice)); equipment.IsCollection = false; equipment.IsGetPhone = false; string phone = equipment.ContactPhone; equipment.ContactPhone = CommonHelper.ToHiddenPhone(equipment.ContactPhone); if (_httpContextUser.Id > 0) { //是否收藏 equipment.IsCollection = await _collectionService.IsCollection(id); //是否获取电话 equipment.IsGetPhone = await _currencyRecordService.IsGetPhone(CurrencyType.CallPhone, equipment.Id) || equipment.UserId == _httpContextUser.Id; equipment.ContactPhone = equipment.IsGetPhone ? phone : CommonHelper.ToHiddenPhone(equipment.ContactPhone); //插入足迹 await _cacheService.SetBrowseAsync(_httpContextUser.Id, equipment.Id.ToString(), DateTime.Now.ToTimestamp()); } equipment.equipmentPictures = (await _equipmentPictureSevice.GetListAsync(id)).Where(x => x.PictureType == (int)PictureTypeEnum.Equipment).ToList(); equipment.DriverLicensePictures = await _equipmentPictureRepository.Where(x => x.EquipmentId == id && x.PictureType == (int)PictureTypeEnum.DriverLicense).ToListAsync(); equipment.SellingPrice = equipment.SellingPrice / 10000; //浏览量自增 await _cacheService.SetIncrPageViewAsync(equipment.Id); response.Successed = true; response.Data = equipment; response.Code = 1; return response; } /// /// 分页查询设备列表 /// /// /// /// /// /// /// /// public async Task PageAsync(string? key, long categoryId, long brandId, long yearId, int currentPage, int pageSize) { int currentYear = DateTime.Now.Year; List equipmentList = await _equipmentRepository.Select .Where(x => new[] { (int)StateEnum.Selling, (int)StateEnum.Traded }.Contains(x.State) && x.IsPublic) .WhereIf(categoryId > 0, x => x.EquipmentType == categoryId) .WhereIf(brandId > 0, x => x.EquipmentBrand == brandId) .WhereIf(yearId == 8001, x => x.AppearanceDate > currentYear - 3) .WhereIf(yearId == 8002, x => x.AppearanceDate > currentYear - 5 && x.AppearanceDate <= currentYear - 3) .WhereIf(yearId == 8003, x => x.AppearanceDate > currentYear - 8 && x.AppearanceDate <= currentYear - 5) .WhereIf(yearId == 8004, x => x.AppearanceDate > currentYear - 12 && x.AppearanceDate <= currentYear - 8) .WhereIf(yearId == 8005, x => x.AppearanceDate < currentYear - 12) .WhereIf(key.IsNotNull(), x => x.Introduction.Contains(key) || x.Title.Contains(key)) .Count(out long total) .OrderByDescending(x => x.IsTop) .OrderByDescending(x => x.TopExpireDate) .OrderByDescending(x => x.RefreshDate) .Page(currentPage, pageSize) .ToListAsync(); //积分记录 List currencyRecordList = new List(); if (_httpContextUser.Id > 0) { long[] cIds = equipmentList.Select(x => x.Id).Distinct().ToArray(); currencyRecordList = await _currencyRecordRepository.Where(x => cIds.Contains(x.CurrencySoureObjectId) && x.CurrencyType == (int)CurrencyType.CallPhone).ToListAsync(); } long[] uIds = equipmentList.Select(x => x.UserId).Distinct().ToArray(); List users = await _userRepository.Select.Where(x => uIds.Contains(x.Id)).ToListAsync(); long[] eIds = equipmentList.Select(x => x.Id).Distinct().ToArray(); List equipmentPictures = await _equipmentPictureRepository.Select .Where(x => x.IsDeleted == false && eIds.Contains(x.EquipmentId) && x.PictureType == (int)PictureTypeEnum.Equipment) .ToListAsync(); foreach (var item in equipmentList) { item.EquipmentPictures = equipmentPictures.FindAll(x => x.EquipmentId == item.Id); UserEntity user = users.FirstOrDefault(x => x.Id == item.UserId); item.UserName = user?.UserName ?? GlobalConstVars.User.Default_UserName; item.AvatarUrl = user?.AvatarUrl; item.IsGetPhone = item.UserId == _httpContextUser.Id ? true : currencyRecordList.Exists(x => x.UserId == _httpContextUser.Id && x.CurrencySoureObjectId == item.Id); item.ContactPhone = !item.IsGetPhone ? CommonHelper.ToHiddenPhone(item.ContactPhone) : item.ContactPhone; item.SellingPrice = item.SellingPrice / 10000; } PageOutput data = new PageOutput { List = equipmentList, Total = total }; ResponseOutput response = new ResponseOutput() { Data = data, Successed = true, Code = 1 }; return response; } /// /// 刷新设备信息 /// /// /// [Transaction] public async Task RefreshAsync(long id) { ResponseOutput response = new ResponseOutput(); var entity = await _equipmentRepository.GetAsync(id); if (entity.IsNull()) { response.Successed = false; response.Msg = "设备信息不存在!"; response.Code = 0; return response; } response = await _currencyService.RefreshDeduct(id); if (response.Successed) { entity.RefreshDate = DateTime.Now; await _equipmentRepository.UpdateAsync(entity); response.Successed = true; response.Code = 1; return response; } return response; } /// /// 置顶设备信息 /// /// /// [Transaction] public async Task TopAsync(long id) { ResponseOutput response = new ResponseOutput(); var entity = await _equipmentRepository.GetAsync(id); if (!(entity?.Id > 0)) { response.Successed = false; response.Msg = "设备信息不存在!"; response.Code = 0; return response; } if (entity.IsTop) { response.Successed = false; response.Msg = "请勿重复置顶!"; response.Code = 3; return response; } response = await _currencyService.TopDeduct(id); if (response.Successed) { entity.IsTop = true; entity.TopExpireDate = DateTime.Now.AddDays(1); await _equipmentRepository.UpdateAsync(entity); response.Successed = true; response.Code = 1; response.Msg = "置顶成功!"; } return response; } /// /// 取消置顶设备信息 /// /// public async Task CancelTopAsync() { int id = await _equipmentRepository.Select .Where(x => x.IsTop && x.TopExpireDate <= DateTime.Now && x.State != (int)StateEnum.InReview) .ToUpdate() .Set(x => x.IsTop, false) .Set(x => x.TopExpireDate, Convert.ToDateTime("0001-01-01 00:00:00")) .ExecuteAffrowsAsync(); ResponseOutput response = new ResponseOutput() { Successed = true, Msg = "取消置顶成功", Code = 1 }; return response; } /// /// 更改设备信息状态 /// /// /// 设备状态 /// public async Task UpdateStateAsync(long id, int state) { ResponseOutput response = new ResponseOutput(); var entity = await _equipmentRepository.GetAsync(id); if (!(entity?.Id > 0)) { response.Successed = false; response.Msg = "设备信息不存在!"; response.Code = 0; return response; } entity.State = state; await _equipmentRepository.UpdateAsync(entity); response.Successed = true; response.Code = 1; response.Msg = "修改成功"; return response; } /// /// 是否公开设备信息 /// /// /// /// public async Task IsPublicAsync(long id, bool isPublic) { ResponseOutput response = new ResponseOutput(); var entity = await _equipmentRepository.GetAsync(id); if (!(entity?.Id > 0)) { response.Successed = false; response.Msg = "设备信息不存在!"; response.Code = 0; return response; } entity.IsPublic = isPublic; await _equipmentRepository.UpdateAsync(entity); response.Successed = true; response.Msg = "修改成功"; response.Code = 1; return response; } /// /// 获取手机号码 /// /// /// [Transaction] public async Task GetPhoneAsync(long id) { ResponseOutput response = new ResponseOutput(); var entity = await _equipmentRepository.GetAsync(id); if (entity.IsNull()) { response.Successed = false; response.Msg = "设备信息不存在!"; response.Code = 0; return response; } bool isGetPhone = await _currencyRecordService.IsGetPhone(CurrencyType.CallPhone, id); if (isGetPhone) { response.Successed = false; response.Msg = "请勿重复获取手机号"; response.Code = 3; return response; } response = await _currencyService.GetPhoneDeduct(id, Convert.ToInt32(entity.SellingPrice)); if (response.Successed) { response.Successed = true; response.Msg = "获取成功"; response.Code = 1; response.Data = entity.ContactPhone; } return response; } /// /// 同步浏览量 /// /// public async Task PageViewAsync() { IDictionary pageView = await _cacheService.GetPageViewAsync(); if (pageView.Count() <= 0) { List list = await _equipmentRepository.Select.Where(x => x.PageView > 0).ToListAsync(); foreach (EquipmentEntity item in list) { await _cacheService.SetPageViewAsync(item.Id.ToString(), item.PageView); } pageView = await _cacheService.GetPageViewAsync(); } foreach (var item in pageView) { long key = Convert.ToInt64(item.Key); int value = Convert.ToInt32(item.Value); await _equipmentRepository.UpdatePageView(key, value); } ResponseOutput response = new ResponseOutput() { Successed = true, Msg = "同步浏览量成功", Code = 1 }; return response; } /// /// 我的设备信息 /// /// 全部-1/审核中10/出售中20/已成交30/审核失败0 /// /// /// public async Task MyEquipmentPageAsync( int state, int currentPage, int pageSize) { List equipmentList = await _equipmentRepository.Select .WhereIf(state < 0, x => x.State != (int)StateEnum.Revocation) .WhereIf(state >= 0, x => x.State == state) .Where(x => x.UserId == _httpContextUser.Id) .Count(out long total) .OrderByDescending(x => x.RefreshDate) .Page(currentPage, pageSize) .ToListAsync(); long[] eIds = equipmentList.Select(x => x.Id).Distinct().ToArray(); List auditList = await _auditRepository.Select .Where(x => eIds.Contains(x.EquipmentId)) .OrderByDescending(true, x => x.CreatedTime) .ToListAsync(); //设备图片 List equipmentPictures = await _equipmentPictureRepository.Select .Where(x => x.IsDeleted == false && eIds.Contains(x.EquipmentId) && x.PictureType == (int)PictureTypeEnum.Equipment) .ToListAsync(); equipmentList.ForEach(item => { AuditEntity audit = auditList.FirstOrDefault(x => x.EquipmentId == item.Id); item.Note = audit.IsNotNull() ? audit.Note : ""; item.AuditTime = audit.IsNotNull() ? audit.ModifiedTime : Convert.ToDateTime("0001-01-01 00:00:00"); item.EquipmentPictures = equipmentPictures.FindAll(x => x.EquipmentId == item.Id); item.SellingPrice = item.SellingPrice / 10000; }); PageOutput data = new PageOutput { List = equipmentList, Total = total }; ResponseOutput response = new ResponseOutput() { Data = data, Successed = true, Code = 1 }; return response; } /// /// 根据UserId查询设备信息 /// /// /// /// /// public async Task GetEquipmentByUserIdAsync(long userId, int currentPage, int pageSize) { SellerOutput seller = (await _userService.GetUserByIdAsync(userId)).Adapt(); //是否购买优惠卡 var usercar = await _userCardRepository.GetAsync(x => x.UserId == _httpContextUser.Id && x.IsEnabled == true && x.EndTime > DateTime.Now); seller.IsMember = usercar.IsNotNull() ? true : false; List equipmentList = await _equipmentRepository.Select .Where(x => x.UserId == userId && x.State == (int)StateEnum.Selling) .Count(out long total) .OrderByDescending(x => x.RefreshDate) .Page(currentPage, pageSize) .ToListAsync(); //设备图片 long[] eIds = equipmentList.Select(x => x.Id).Distinct().ToArray(); List equipmentPictures = await _equipmentPictureRepository.Select .Where(x => x.IsDeleted == false && eIds.Contains(x.EquipmentId) && x.PictureType == (int)PictureTypeEnum.Equipment) .ToListAsync(); equipmentList.ForEach(item => { item.EquipmentPictures = equipmentPictures.FindAll(x => x.EquipmentId == item.Id); item.SellingPrice = item.SellingPrice / 10000; }); SellerEquipmentOutput data = new SellerEquipmentOutput { Seller = seller, SellerEquipmentList = equipmentList, Total = total }; var response = new ResponseOutput() { Data = data, Successed = true, Code = 1 }; return response; } /// /// 获取上次保存信息 /// /// public async Task GetLastEquipmentAsync() { var response = new ResponseOutput() { Data =await _cacheService.GetEquipmentAsync(_httpContextUser.Id), Successed = true, Code = 1 }; return response; } } }