public Base <object> List(ExpressQuery queryModel) { Meta meta = new Meta(); PageModel <Express> list = new PageModel <Express>(); if (queryModel.flag == "1") { list = ExpressService.List(queryModel, ref meta); } if (queryModel.flag == "2" || queryModel.flag == "3") { //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(queryModel.Token); if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { queryModel.UserID = token.UserId; list = ExpressService.List(queryModel, ref meta); } } Base <object> response = new Base <object> { Body = list, Meta = meta }; return(response); }
public Base <object> Modify(ExpressInfo model) { //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(model.Token); Meta meta = new Meta(); bool editNote = true; //校验数据 if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { model.UserID = token.UserId.ToString(); editNote = ExpressService.Modify(model, ref meta); } Base <object> result = new Base <object> { Meta = meta, Body = editNote }; return(result); }
public Base <object> Edit(ExpressInfo model) { Express entity = new Express(); //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(model.Token); Meta meta = new Meta(); bool addNote = true; //校验数据 if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { model.HamalUserID = token.UserId; //入队 this.AddQueue(model); while (true) { if (queue.Count > 0) { while (queue.Count > 0) { ExpressInfo models = queue.Dequeue();//获取队列中的数据(出队) addNote = ExpressService.Edit(models, ref meta); if (models.JobType == EnumType.Delete) { continue; } } } else { break; } } } Base <object> result = new Base <object> { Meta = meta, Body = addNote }; return(result); }
public Base <object> Add(ExpressInfo model) { Express entity = new Express(); //取token值 TokenReponse repository = new TokenReponse(); Token token = repository.First(model.Token); Meta meta = new Meta(); bool addNote = true; //校验数据 if (token == null) { meta.ErrorCode = ErrorCode.LoginError.GetHashCode().ToString(); meta.ErrorMsg = EnumHelper.GetDescriptionFromEnumValue(ErrorCode.LoginError); } else { entity.UserID = token.UserId.ToString(); entity.ExpressName = model.ExpressName; entity.ExpressPwd = model.ExpressPwd; entity.Phone = model.Phone; entity.Destination = model.Destination; entity.ExpectTime = model.ExpectTime; entity.Money = Convert.ToDecimal(model.vState); entity.Zy = model.Zy; entity.Payway = Convert.ToInt32(model.Rel); addNote = ExpressService.Add(entity, ref meta); } Base <object> result = new Base <object> { Meta = meta, Body = addNote }; return(result); }