public ActionResult Receive(long id, string openId = "") { ReceiveModel receiveModel = (ReceiveModel)_bonusService.Receive(id, openId); BonusModel bonusModel = new BonusModel(_bonusService.Get(id)); if (receiveModel.State == ReceiveStatus.CanReceive) { object[] objArray = new object[] { "/m-weixin/Bonus/Completed/", bonusModel.Id, "?openId=", openId, "&price=", receiveModel.Price }; return(Redirect(string.Concat(objArray))); } if (receiveModel.State == ReceiveStatus.Receive) { return(Redirect(string.Concat("/m-weixin/Bonus/HasReceive/", bonusModel.Id))); } if (receiveModel.State == ReceiveStatus.HaveNot) { return(Redirect(string.Concat("/m-weixin/Bonus/HaveNot/", bonusModel.Id))); } if (receiveModel.State == ReceiveStatus.NotAttention) { return(Redirect(string.Concat("/m-weixin/Bonus/NotAttention/", bonusModel.Id))); } if (receiveModel.State != ReceiveStatus.Invalid) { throw new Exception("领取发生异常"); } return(Redirect(string.Concat("/m-weixin/Bonus/Invalid/", bonusModel.Id))); }
/// <summary> /// 发送关注红包 /// </summary> private ActionResult SendAttentionToUser(IRequestMessageBase requestBaseMsg) { string msg = ""; try { IBonusService bonusService = _iBonusService; Log.Debug("关注红包openId:" + requestBaseMsg.FromUserName); msg = bonusService.Receive(requestBaseMsg.FromUserName); if (!string.IsNullOrEmpty(msg)) { string result = DealTextMsg(requestBaseMsg, msg); return new XmlResult(result); } } catch (Exception e) { Log.Info("关注红包出错:", e); } return Content(""); }
/// <summary> /// 领取活动红包 /// </summary> public static object Receive(long id, string openId) { return(_iBonusService.Receive(id, openId)); }