/// <summary> /// 校验配置的产品是否在其他活动中存在不同价格 /// </summary> /// <param name="pid"></param> /// <param name="price"></param> /// <returns></returns> public ActionResult CheckPIDSamePrice(string p) { var dic = new Dictionary <string, string>(); List <QiangGouProductModel> model = JsonConvert.DeserializeObject <List <QiangGouProductModel> >(p); if (model == null || model.Count() == 0) { dic.Add("", "无产品,无需验证"); return(Json(dic.Select(c => new { PID = c.Key, Content = c.Value }))); } foreach (var item in model) { var M = QiangGouManager.CheckPIDSamePriceInOtherActivity(item); if (M != null && M.Count() > 0) { var content = ""; foreach (var t in M) { content += "活动ID:" + t.ActivityID + " 价格:" + t.Price.ToString("C") + "<br/>"; } dic.Add(M.FirstOrDefault()?.PID, content); } } if (dic.Count() == 0) { dic.Add("", "与其他活动相同产品价格不冲突"); } return(Json(dic.Select(c => new { PID = c.Key, Content = c.Value }))); }