public ActionResult LogOut() { string refUrl = RQuery["refUrl"]; ClearCookie(); string str = string.IsNullOrEmpty(OpenID)?"":OpenID; string str1 = string.IsNullOrEmpty(MpUserID.ToString()) ? "" : MpUserID.ToString(); string str2 = Session["MpUserID"] == null ? "" : Session["MpUserID"].ToString(); return(Content(str + "," + str1 + "," + str2)); }
public ActionResult MyPosBind(Guid id) { //当前登录用户 MpUser mpUser = _mpUserService.GetById(MpUserID); PosAuth posAuth = _posAuthService.GetUnique(p => p.MpUserId == mpUser.Id); //if (posAuth == null) //{ // return RedirectToAction("PosApply"); //} if (posAuth != null) { ViewBag.Name = posAuth.Name; } else { ViewBag.Name = mpUser.NickName; } if (mpUser.Sex == 1) { ViewBag.Sex = "先生"; } else if (mpUser.Sex == 2) { ViewBag.Sex = "女士"; } else { ViewBag.Sex = ""; } string mpuserId = MpUserID.ToString(); Pos pos = _posService.GetUnique(p => p.Id == id && p.MpUserIds.Contains(mpuserId)); if (pos == null) { throw new OceanException("对不起,参数有误,请检查!"); } return(View(pos)); }
public ActionResult MyPosBindList() { string mpuserid = MpUserID.ToString(); IList <Pos> pos = _posService.GetALL(p => p.MpUserIds.Contains(mpuserid)); if (pos == null || pos.Count == 0) { return(RedirectToAction("MyPos")); } //当前登录用户 MpUser mpUser = _mpUserService.GetById(MpUserID); PosAuth posAuth = _posAuthService.GetUnique(p => p.MpUserId == mpUser.Id); //if (posAuth == null) //{ // return RedirectToAction("PosApply"); //} if (posAuth != null) { ViewBag.Name = posAuth.Name; } else { ViewBag.Name = mpUser.NickName; } if (mpUser.Sex == 1) { ViewBag.Sex = "先生"; } else if (mpUser.Sex == 2) { ViewBag.Sex = "女士"; } else { ViewBag.Sex = ""; } return(View(pos)); }
public ActionResult MyPosUnbind(Guid id) { //当前登录用户 MpUser mpUser = _mpUserService.GetById(MpUserID); PosAuth posAuth = _posAuthService.GetUnique(p => p.MpUserId == mpUser.Id); //if (posAuth == null) //{ // return JsonMessage(false, "对不起,您还未申请POS,请先申请!"); //} if (posAuth != null) { ViewBag.Name = posAuth.Name; } else { ViewBag.Name = mpUser.NickName; } if (mpUser.Sex == 1) { ViewBag.Sex = "先生"; } else if (mpUser.Sex == 2) { ViewBag.Sex = "女士"; } else { ViewBag.Sex = ""; } if (id != Guid.Empty) { _posService.ExcuteSql("update Pos set MpUserIds=replace(MpUserIds,'," + MpUserID.ToString() + "',''),MobilePhones=replace(MobilePhones,'," + posAuth.MobilePhone + "','') where id='" + id.ToString() + "'"); } else { _posService.ExcuteSql("update Pos set MpUserIds=replace(MpUserIds,'," + MpUserID.ToString() + "',''),MobilePhones=replace(MobilePhones,'," + posAuth.MobilePhone + "','') where MpUserIds like '%" + MpUserID.ToString() + "%'"); } return(JsonMessage(true)); }
public ActionResult MyPos(Pos pos) { //当前登录用户 MpUser mpUser = _mpUserService.GetById(MpUserID); PosAuth posAuth = _posAuthService.GetUnique(p => p.MpUserId == mpUser.Id); //if (posAuth == null) //{ // return JsonMessage(false, "对不起,您还未申请POS,请先申请!"); //} if (posAuth != null) { ViewBag.Name = posAuth.Name; } else { ViewBag.Name = mpUser.NickName; } if (mpUser.Sex == 1) { ViewBag.Sex = "先生"; } else if (mpUser.Sex == 2) { ViewBag.Sex = "女士"; } else { ViewBag.Sex = ""; } int useCount = _mobileCodeService.GetMobileCodeCount(this.MpUserID, 4);//当天使用次数 if (useCount <= 5) { MobileCode lastCode = _mobileCodeService.GetMobileCode(this.MpUserID, 4);//是否存在未使用的证码 if (lastCode != null) { //验证 MobileCode mobileCode = _mobileCodeService.GetMobileCode(RQuery["MobilePhone"], RQuery["Code"], MpUserID, 4); if (mobileCode != null) { TimeSpan ts = DateTime.Now.Subtract(mobileCode.CreateDate).Duration(); mobileCode.Status = 1; if (ts.Minutes > 10) { return(JsonMessage(false, "验证码已经失效,请重新获取")); } _mobileCodeService.Update(mobileCode); if (_posService.PosBind(pos) == 1) { if (!string.IsNullOrEmpty(pos.MobilePhones) && pos.MobilePhones.Contains(RQuery["MobilePhone"])) { return(JsonMessage(false, "您已查询过当前POS信息,您可以点击我的POS查看详细!")); } else { _posService.ExcuteSql("update Pos set MobilePhones=isnull(MobilePhones,'')+'," + RQuery["MobilePhone"] + "',MpUserIds=isnull(MpUserIds,'')+'," + MpUserID.ToString() + "' where Id='" + pos.Id.ToString() + "'"); return(JsonMessage(true, pos.Id.ToString())); } } else { return(JsonMessage(false, "-1")); } } else { lastCode.Time += 1; _mobileCodeService.Update(lastCode); return(JsonMessage(false, "对不起,验证码有误,请检查!")); } } else { return(JsonMessage(false, "对不起,您还未点击发送验证码!")); } } else { return(JsonMessage(false, "对不起,您今天最多只能发起5次验证码")); } }
public ActionResult Vote(Guid baseId, Guid itemId, string t) { try { if (MpUserID == Guid.Empty) { string rawUrl = "http://wx.ssrcb.com/vote/VoteSummary?id=" + WebHelper.GetGuid("baseId", Guid.Empty); if (string.IsNullOrEmpty(RQuery["openid"])) { Log4NetImpl.Write("open.weixin.qq.com"); return(Json(new { isLogin = true, message = string.Format("https://open.weixin.qq.com/connect/oauth2/authorize?appid={0}&redirect_uri=http://wx.ssrcb.com/mpuser/autologin?refUrl={1}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect", MpCenterCache.AppID, rawUrl) })); } } if (baseId == Guid.Empty || itemId == Guid.Empty) { return(Json(new { message = "参数有误,请检查!" })); } VoteBase VoteBase = _voteBaseService.GetById(baseId); if (VoteBase == null) { throw new OceanException("对不起,未存在本投票,请检查!"); } if (VoteBase.VoteStartDate > DateTime.Now) { return(Json(new { message = "对不起,投票还未开始!" })); } else if (VoteBase.VoteEndDate < DateTime.Now) { return(Json(new { message = "对不起,投票已经结束!" })); } VoteItem voteItem = _voteItemService.GetUnique("from VoteItem where VoteParentId='" + baseId.ToString() + "' and Id='" + itemId.ToString() + "'"); if (voteItem == null) { throw new OceanException("对不起,未存在本投票,请检查!"); } int voteCount = _voteInfoService.GetCount("from VoteInfo where MpUserID='" + MpUserID.ToString() + "' and VoteItemID in (select id from VoteItem where VoteParentId = '" + baseId.ToString() + "')"); if (voteCount >= VoteBase.VoteCount) { return(Json(new { message = "对不起,您已经投了 " + voteCount + " 票!" })); } voteCount = _voteInfoService.GetCount("from VoteInfo where MpUserID='" + MpUserID.ToString() + "' and VoteItemID='" + itemId.ToString() + "'"); if (voteCount > 0) { return(Json(new { message = "对不起,您已经投了该选项!" })); } VoteInfo newVoteInfo = new VoteInfo(); newVoteInfo.MpUserId = MpUserID; newVoteInfo.VoteDate = DateTime.Now; newVoteInfo.VoteItemID = itemId; _voteInfoService.Insert(newVoteInfo); voteItem.VoteCount = voteItem.VoteCount + 1; _voteItemService.Update(voteItem); return(Json(new { message = "感谢您的参与!", isSuccess = true, voteCount = voteItem.VoteCount })); } catch (System.Exception ex) { throw new OceanException(ex.Message, ex); } }
public ActionResult VoteSummary(Guid Id) { if (Id == Guid.Empty) { throw new OceanException("参数有误,请检查!"); } try { //页面上的Plugins IList <VoteBase> VoteBases = _voteBaseService.GetALL(); ViewBag.ContentPlugins = VoteBases; VoteBase VoteBase = VoteBases.Where(p => p.Id == Id).FirstOrDefault(); ViewBag.CurVoteBase = VoteBase; if (VoteBase == null) { throw new OceanException("对不起,未存在本投票,请检查!"); } ViewBag.Title = VoteBase.VoteTitle; IList <VoteItem> voteItemList = _voteItemService.GetList("from VoteItem where VoteParentId='" + Id.ToString() + "'"); ViewBag.voteItemList = voteItemList; if (MpUserID != Guid.Empty) { IList <VoteInfo> voteInfoList = _voteInfoService.GetList("from VoteInfo where MpUserID='" + MpUserID.ToString() + "' and VoteItemID in (select ID from VoteItem where VoteParentId='" + Id.ToString() + "')"); ViewBag.voteSubmitItemList = voteInfoList; } return(View("vote")); } catch (System.Exception ex) { throw new OceanException(ex.Message, ex); } }