public JsonResult PostData(PostDataReq req) { if (!ModelState.IsValid) { var errors = ModelState.Where(x => x.Value.Errors.Count > 0).Select(x => new { PropertyName = x.Key, ErrorMsg = x.Value.Errors[0].ErrorMessage }).ToList(); return(ObjectExtends.ToJsonObject(Entity.Enum.EnumRspStatus.Fail, values: errors).ToJsonResult()); } if (!CheckSign(req)) { return(ObjectExtends.ToJsonObject(Entity.Enum.EnumRspStatus.Fail, msg: "签名验证失败!").ToJsonResult()); } return(ObjectExtends.ToJsonObject(Entity.Enum.EnumRspStatus.Success, values: new { name = "测试", age = 10 }).ToJsonResult()); }
public JsonResult Query(QueryLotteryReq req) { string probability = "0", historyWinningCount = "0", historyMaxFlawed = "0";//理论出现概率,历史开奖中奖次数,历史最大披露 if (req.LotteryType == "Sd11x5") { //理论出现概率 //CreateQueue(); probability = string.Format("{0:0.#####}", 1 * 100 * 0.00001 / (11 * 10 * 9 * 8 * 7 * 0.00001)); //历史开奖中的中奖次数 historyWinningCount = GetHistoryWinningCount(req.LotteryCode).ToString(); //历史最大遗漏 待实现 } return(ObjectExtends.ToJsonObject(Entity.Enum.EnumRspStatus.Success, values: new { probability, historyWinningCount, historyMaxFlawed }).ToJsonResult()); }