public JsonResult Delete(Game_Link _t) { if (WMFactory.GLGameLink.Delete(s => s.Id == _t.Id )) return Json(ResultMsg.Success("删除成功!")); else return Json(ResultMsg.Failure("删除失败,请您重试!")); }
public JsonResult Post(Game_Link _t) { if (WMFactory.GLGameLink.Insert(_t)) return Json(ResultMsg.Success("新增成功!")); else return Json(ResultMsg.Failure("新增失败,请您重试!")); }
public JsonResult Put(Game_Link _t) { IGLGameLinkService service = WMFactory.GLGameLink; Game_Link entity = service.GetById(_t.Id.ToString()); entity = AutoMapper<Game_Link, Game_Link>.Convert(_t, entity); if (service.Update(entity)) return Json(ResultMsg.Success("更新成功!")); else return Json(ResultMsg.Failure("更新失败,请您重试!")); }
public JsonResult addMoney(string lid, string sid, string oid) { //已攒过 if (WMFactory.GameLink.GetCount(f => f.Group == 10 && f.Lid == lid && f.Oid == oid) > 0) { return Json(ResultMsg.Failure("只能帮忙攒一次红包!")); ; } IEnumerable<Game_Record> gr = WMFactory.GameRecord.FindByConditions(null, f => f.Group == 10 && f.Oid == lid); if (gr.Count() == 0) { return Json(ResultMsg.Failure("找不到记录!")); } else { Game_Record g = gr.First(); int total = g.doTimes; int recently = g.linkedTimes; int count = WMFactory.GameLink.GetCount(f => f.Group == 10 && f.Lid == lid); int rest = 0; if (total == 3298) { rest = 100 - count; } else if (total == 2398) { rest = 80 - count; } else { rest = 50 - count; } //if (total == 3298) //{ // rest = 6 - count; //} //else if (total == 2398) //{ // rest = 6 - count; //} //else //{ // rest = 6 - count; //} if (rest == 0) { return Json(ResultMsg.Success("红包金额已筹满!")); } //产生随机数 Random Rdm = new Random(); int iRdm = Rdm.Next(1, (total - recently) / rest * 2); if (rest == 1) { iRdm = total - recently; } Game_Link gl = new Game_Link(); gl.Group = 10; gl.Lid = lid; gl.Oid = oid; WxFans wf = ElegantWM.WeiXin.Common.GetFanInfo(sid.ToString(), oid); gl.NickName = wf.nickname; gl.Avatar = wf.headimgurl; gl.Oper = iRdm.ToString(); gl.CreateUser = "******"; WxFans wx = ElegantWM.WeiXin.Common.GetFanInfo(sid.ToString(), lid); if (WMFactory.GameLink.Insert(gl)) { g.linkedTimes = recently + iRdm; g.ModifyUser = "******"; if (WMFactory.GameRecord.Update(g)) { return Json(ResultMsg.Success("成功帮" + wx.nickname + "筹得" + iRdm + "元红包金额")); } else { return Json(ResultMsg.Failure("操作失败!")); } } else { return Json(ResultMsg.Failure("操作失败!")); } } }
public JsonResult ClickStar(Guid sid, string oid, string lid) { if (WMFactory.GLGameLink.GetCount(f => f.Lid == lid && f.Oid == oid && f.Group == 3) > 0) { return Json(ResultMsg.Failure("您已经点亮过了!")); } else { Game_Link gl = new Game_Link(); gl.Group = 3; gl.Oid = oid; gl.Lid = lid; gl.CreateUser = "******"; if (WMFactory.GLGameLink.Insert(gl)) return Json(ResultMsg.Success("信息提交成功。")); else return Json(ResultMsg.Failure("信息提交失败,请重试!")); } }