Beispiel #1
0
        private List <string> GetVoteObjectImageList(VoteObjectInfo voteObjectInfo)
        {
            List <string> showImgList = new List <string>();

            if (!string.IsNullOrEmpty(voteObjectInfo.ShowImage1))
            {
                showImgList.Add(bllVote.GetImgUrl(voteObjectInfo.ShowImage1));
            }
            if (!string.IsNullOrEmpty(voteObjectInfo.ShowImage2))
            {
                showImgList.Add(bllVote.GetImgUrl(voteObjectInfo.ShowImage2));
            }
            if (!string.IsNullOrEmpty(voteObjectInfo.ShowImage3))
            {
                showImgList.Add(bllVote.GetImgUrl(voteObjectInfo.ShowImage3));
            }
            if (!string.IsNullOrEmpty(voteObjectInfo.ShowImage4))
            {
                showImgList.Add(bllVote.GetImgUrl(voteObjectInfo.ShowImage4));
            }
            if (!string.IsNullOrEmpty(voteObjectInfo.ShowImage5))
            {
                showImgList.Add(bllVote.GetImgUrl(voteObjectInfo.ShowImage5));
            }
            return(showImgList);
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            model = bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID);
            if (model == null)
            {
                Response.Write("您还没有报名,请先报名");
                Response.End();
            }
            else if (!model.Status.Equals(1))
            {
                Response.Write("您还未通过审核");
                Response.End();
            }
            else if (model.Rank > 1000)
            {
                Response.Write("您没有获奖");
                Response.End();
            }
            int TotalCount = 0;

            bllCardCoupon.GetMyCardCoupons(BLLJIMP.Enums.EnumCardCouponType.EntranceTicket, CurrentUserInfo.UserID, 1, 1, out TotalCount);

            if (TotalCount > 0)
            {
                IsGetPrize = true;
            }
        }
Beispiel #3
0
        /// <summary>
        /// 获取我的信息
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string getmyinfo(HttpContext context)
        {
            VoteObjectInfo voteObjectInfo = bllCardCoupon.Get <VoteObjectInfo>(string.Format("CreateUserId='{0}' And VoteID=120", CurrentUserInfo.UserID));

            return(ZentCloud.Common.JSONHelper.ObjectToJson(new {
                number = voteObjectInfo.Number,
                name = voteObjectInfo.VoteObjectName,
                rand = voteObjectInfo.Rank
            }));
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     model = bllVote.GetVoteObjectInfo(int.Parse(System.Configuration.ConfigurationManager.AppSettings["HaiMaVoteIDSale"]), CurrentUserInfo.UserID);
     if (model == null)
     {
         Response.Redirect("nosignup.htm");
     }
     else
     {
     }
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     model = bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID);
     if (model == null)
     {
         Response.Write("您还没有报名,请先报名");
         Response.End();
     }
     else
     {
     }
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     model = bllVote.GetVoteObjectInfo(currVote.AutoID, currentUserInfo.UserID);
     if (model == null)
     {
         Response.Redirect("SignUp.aspx?vid=" + currVote.AutoID);
         Response.Write("您还没有报名,请先报名");
         Response.End();
     }
     else
     {
     }
 }
Beispiel #7
0
        /// <summary>
        /// 检查是否中奖了
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string IsWin(HttpContext context)
        {
            if (!bllUser.IsLogin)
            {
                resp.errcode = (int)APIErrCode.UserIsNotLogin;
                resp.errmsg  = "请先登录";
                return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            }
            else
            {
                currentUserInfo = bllUser.GetCurrentUserInfo();
            }
            VoteInfo voteInfo = bllVote.GetVoteInfo(voteId);//主投票信息

            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > DateTime.Parse(voteInfo.StopDate))
                {
                    VoteObjectInfo model = bllVote.GetVoteObjectInfo(voteId, currentUserInfo.UserID);
                    if (model == null)
                    {
                        resp.errcode = 1;
                        resp.errmsg  = "未参加";
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                    if (model.Ex1 == "1")//Ex1 表示是否已领奖
                    {
                        resp.errcode = 1;
                        resp.errmsg  = "已领奖";
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                    if (model.Rank == 1)
                    {
                        resp.errcode = 0;
                        resp.errmsg  = voteInfo.Prize;
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "还未到截止时间";
                    return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                }
            }
            resp.errcode = 1;
            resp.errmsg  = "";
            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     aid       = Request["aid"];
     webAction = Request["Action"];
     actionStr = webAction == "add" ? "添加" : "编辑";
     if (webAction == "edit")
     {
         model = this.bll.GetVoteObjectInfo(int.Parse(aid));
         if (model == null)
         {
             Response.End();
         }
         else
         {
         }
     }
     votemodel = bll.GetVoteInfo(int.Parse(Request["vid"]));
     if (!string.IsNullOrEmpty(model.CreateUserId))
     {
         ObjUserInfo = new BLLUser().GetUserInfo(model.CreateUserId);
     }
 }
Beispiel #9
0
        /// <summary>
        /// 投票
        /// </summary>
        /// <param name="voteId">投票ID</param>
        /// <param name="voteObjectId">选手ID</param>
        /// <param name="userId">用户ID</param>
        /// <param name="count">票数</param>
        /// <param name="msg">信息</param>
        /// <returns></returns>
        public bool UpdateVoteObjectVoteCount(int voteId, int voteObjectId, string userId, int count, out string msg)
        {
            msg = "false";
            VoteInfo voteInfo = GetVoteInfo(voteId);

            if (voteInfo.VoteStatus.Equals(0))
            {
                msg = "投票停止";
                return(false);
            }
            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now >= (DateTime.Parse(voteInfo.StopDate)))
                {
                    msg = "投票结束";
                    return(false);
                }
            }

            VoteObjectInfo voteObj = GetVoteObjectInfo(voteObjectId);

            if (!voteObj.Status.Equals(1))
            {
                msg = "审核通过的选手才能投票";
                return(false);
            }
            //检查是否可以投票
            if (voteInfo.LimitType == 0)//每人最多可以投多少票
            {
                if ((GetCount <VoteLogInfo>(string.Format(" VoteId={0} And UserID='{1}' ", voteInfo.AutoID, userId)) >= voteInfo.FreeVoteCount))
                {
                    msg = "您已经投过票了";//总票数已经用完
                    return(false);
                }
            }
            else if (voteInfo.LimitType == 1)//每人每天可以投多少票
            {
                string toDay    = DateTime.Now.ToString("yyyy-MM-dd");
                string tomorrow = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
                if (GetCount <VoteLogInfo>(string.Format(" VoteId={0} And UserID='{1}' And InsertDate>='{2}' And InsertDate<'{3}'", voteInfo.AutoID, userId, toDay, tomorrow)) >= voteInfo.FreeVoteCount)
                {
                    msg = "今天票数已经用完,明天再来吧";//总票数已经用完
                    return(false);
                }
            }
            if ((voteInfo.LimitType == 0) && GetCount <VoteLogInfo>(string.Format(" VoteId={0} And UserID='{1}' And VoteObjectID={2}", voteInfo.AutoID, userId, voteObjectId)) >= voteInfo.VoteObjectLimitVoteCount)
            {
                msg = "您已经投过票了";//每个选手最多可以投多少票
                return(false);
            }
            //检查是否可以投票
            ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();
            try
            {
                VoteLogInfo log = new VoteLogInfo();
                log.UserID       = userId;
                log.VoteID       = voteId;
                log.VoteObjectID = voteObjectId;
                log.InsertDate   = DateTime.Now;
                log.CreateUserID = voteInfo.CreateUserID;
                log.WebsiteOwner = WebsiteOwner;
                log.VoteCount    = count;
                log.IP           = System.Web.HttpContext.Current.Request.UserHostAddress;
                log.IPLocation   = Common.MySpider.GetIPLocation(log.IP);
                if (!Add(log, tran))
                {
                    tran.Rollback();
                    return(false);
                }

                if (Update(voteObj, string.Format(" VoteCount+={0}", count), string.Format(" AutoID={0}", voteObj.AutoID)) > 0)
                {
                    tran.Commit();
                    msg = "投票成功";
                    return(true);
                }
                else
                {
                    tran.Rollback();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                msg = ex.Message;
                return(false);
            }
        }
Beispiel #10
0
 /// <summary>
 /// 修改投票对象
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool DeleteVoteObjectInfo(VoteObjectInfo model)
 {
     return(Delete(model) > 0);
 }
Beispiel #11
0
        ///// <summary>
        ///// 更新投票数 OLD VERSION
        ///// </summary>
        ///// <returns></returns>
        //public bool UpdateVoteObjectVoteCount(int voteId,int voteObjectId,string userId,int count){
        //    ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();
        //    try
        //    {
        //        VoteInfo VoteInfo = GetSingleVoteInfo(voteId);
        //        int VoteLogCount = GetVoteLogCount(voteId, userId);
        //        int AddCount = 0;
        //        if (VoteLogCount<=VoteInfo.FreeVoteCount)
        //        {
        //            AddCount = VoteInfo.FreeVoteCount - VoteLogCount;
        //        }

        //        if (VoteInfo==null||VoteInfo.VoteStatus.Equals(0))
        //        {
        //            return false;
        //        }

        //        bool logresult = false;
        //        int logcount = 0;
        //        for (int i =1; i <=count; i++)
        //        {
        //            VoteLogInfo log = new VoteLogInfo();
        //            log.UserID = userId;
        //            log.VoteID = voteId;
        //            log.VoteObjectID = voteObjectId;
        //            log.InsertDate = DateTime.Now;
        //            log.CreateUserID = VoteInfo.CreateUserID;
        //            log.WebsiteOwner = WebsiteOwner;
        //            log.VoteCount = count;
        //            if (Add(log,tran))
        //            {
        //                logcount++;
        //                VoteLogCount++;

        //            }

        //        }
        //        if (count!=logcount)
        //        {
        //            tran.Rollback();
        //            return false;
        //        }
        //        else
        //        {
        //            logresult = true;
        //        }

        //        if (logresult)
        //        {
        //            VoteObjectInfo model = GetSingleVoteObjectInfo(voteObjectId);
        //            model.VoteCount += count;
        //            if (Update(model))
        //            {

        //                if (VoteInfo.IsFree.Equals(0))//收费 检查是否需要扣除用户剩余票数
        //                {

        //                    int FreeVoteCount = VoteInfo.FreeVoteCount-VoteLogCount;
        //                    //计算应该扣除的点数



        //                    //计算应该扣除的点数
        //                    if (FreeVoteCount<0)//剩余票数不够,减掉用户购买的的票数
        //                    {

        //                        //
        //                        UserInfo userInfo = new BLLUser("").GetUserInfo(userId);
        //                        userInfo.AvailableVoteCount -=count-AddCount;

        //                        if (userInfo.AvailableVoteCount<0)
        //                        {
        //                            userInfo.AvailableVoteCount = 0;
        //                        }
        //                        if (Update(userInfo,tran))
        //                        {
        //                            tran.Commit();
        //                            return true;
        //                        }
        //                        else
        //                        {
        //                            tran.Rollback();
        //                            return false;
        //                        }


        // /                    }
        //                    else
        //                    {
        //                        tran.Commit();
        //                        return true;

        //                    }


        //                }
        //                else
        //                {
        //                    tran.Commit();
        //                    return true;

        //                }


        //            }
        //            else
        //            {
        //                tran.Rollback();
        //                return false;

        //            }
        //        }
        //        else
        //        {
        //            tran.Rollback();
        //            return false;

        //        }

        //    }
        //    catch (Exception)
        //    {

        //        tran.Rollback();
        //        return false;
        //    }


        //}


        /// <summary>
        /// 更新投票数 20140917
        /// </summary>
        /// <returns></returns>
        public bool UpdateVoteObjectVoteCount(int voteId, int voteObjectId, string userId, int count)
        {
            ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();
            try
            {
                VoteInfo voteInfo = GetVoteInfo(voteId);



                //int voteLogCount = GetVoteLogCount(voteId, userId);
                //int addCount = 0;
                //if (voteLogCount <= voteInfo.FreeVoteCount)
                //{
                //    addCount = voteInfo.FreeVoteCount - voteLogCount;
                //}

                if (voteInfo == null || voteInfo.VoteStatus.Equals(0))
                {
                    return(false);
                }

                bool        logResult = false;//是否可以投票标识
                VoteLogInfo log       = new VoteLogInfo();
                log.UserID       = userId;
                log.VoteID       = voteId;
                log.VoteObjectID = voteObjectId;
                log.InsertDate   = DateTime.Now;
                log.CreateUserID = voteInfo.CreateUserID;
                log.WebsiteOwner = WebsiteOwner;
                log.VoteCount    = count;
                log.IP           = System.Web.HttpContext.Current.Request.UserHostAddress;
                log.IPLocation   = Common.MySpider.GetIPLocation(log.IP);
                if (!Add(log, tran))
                {
                    tran.Rollback();
                    return(false);
                }
                else
                {
                    //voteLogCount += count;
                    logResult = true;
                }



                if (logResult)
                {
                    VoteObjectInfo model = GetVoteObjectInfo(voteObjectId);
                    model.VoteCount += count;
                    if (Update(model))
                    {
                        //if (voteInfo.IsFree.Equals(0))//收费 检查是否需要扣除用户剩余票数
                        //{

                        //    int freeVoteCount = voteInfo.FreeVoteCount - voteLogCount;
                        //    //计算应该扣除的点数



                        //    //计算应该扣除的点数
                        //    if (freeVoteCount < 0)//剩余票数不够,减掉用户购买的的票数
                        //    {

                        //        //
                        //        UserInfo userInfo =  bllUser.GetUserInfo(userId);
                        //        userInfo.AvailableVoteCount -= count - addCount;
                        //        if (userInfo.AvailableVoteCount < 0)
                        //        {
                        //            userInfo.AvailableVoteCount = 0;
                        //        }
                        //        if (Update(userInfo, string.Format(" AvailableVoteCount={0}", userInfo.AvailableVoteCount), string.Format(" AutoID={0}", userInfo.AutoID), tran) > 0)
                        //        {
                        //            tran.Commit();
                        //            return true;
                        //        }
                        //        else
                        //        {
                        //            tran.Rollback();
                        //            return false;
                        //        }


                        //    }
                        //    else
                        //    {
                        //        tran.Commit();
                        //        return true;

                        //    }


                        //}
                        //else
                        //{
                        tran.Commit();
                        return(true);

                        //}
                    }
                    else
                    {
                        tran.Rollback();
                        return(false);
                    }
                }
                else
                {
                    tran.Rollback();
                    return(false);
                }
            }
            catch (Exception)
            {
                tran.Rollback();
                return(false);
            }
        }
Beispiel #12
0
 /// <summary>
 /// 新建投票对象
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool AddVoteObjectInfo(VoteObjectInfo model)
 {
     return(Add(model));
 }
Beispiel #13
0
 /// <summary>
 /// 修改投票对象
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateVoteObjectInfo(VoteObjectInfo model)
 {
     return(Update(model));
 }
Beispiel #14
0
        /// <summary>
        /// 系统添加票数 指定选手编号
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string SysAddvoteCount(HttpContext context)
        {
            if (CurrentUserInfo.UserType.Equals(1))//超级管理员才可以操作
            {
                int number   = int.Parse(context.Request["Number"]);
                int addCount = int.Parse(context.Request["AddCount"]);
                int voteId   = int.Parse(context.Request["VoteId"]);
                //
                VoteObjectInfo voteObj = bllVote.Get <VoteObjectInfo>(string.Format(" Number={0} And VoteID={1} And Status=1 ", number, voteId));
                if (voteObj != null)
                {
                    for (int i = 0; i < addCount; i++)
                    {
                        Random rand = new Random();
                        //注册用户
                        DateTime regTime = DateTime.Now.AddMinutes(new Random().Next(1, 10));

                        #region 注册用户
                        //注册用户
                        UserInfo userInfo = new ZentCloud.BLLJIMP.Model.UserInfo();
                        userInfo.UserID          = string.Format("WXUser{0}{1}", ZentCloud.Common.StringHelper.GetDateTimeNum(), ZentCloud.Common.Rand.Str(5));//WXUser+时间字符串+随机5位数字
                        userInfo.Password        = ZentCloud.Common.Rand.Str_char(12);
                        userInfo.UserType        = 2;
                        userInfo.WebsiteOwner    = bllVote.WebsiteOwner;
                        userInfo.Regtime         = regTime;
                        userInfo.WXOpenId        = "zc" + ZentCloud.Common.Rand.Str_char(12) + "cl";
                        userInfo.WXScope         = "snsapi_base";
                        userInfo.RegIP           = bllVote.GetLit <UserInfo>(1, new Random().Next(1, 10000), "RegIP IS NOT NULL")[0].RegIP;
                        userInfo.LastLoginIP     = userInfo.RegIP;
                        userInfo.LastLoginDate   = regTime;
                        userInfo.LoginTotalCount = 1;
                        if (bllVote.Add(userInfo))
                        {
                            VoteLogInfo log = new VoteLogInfo();
                            log.UserID       = userInfo.UserID;
                            log.VoteID       = voteId;
                            log.VoteObjectID = voteObj.AutoID;
                            log.InsertDate   = ((DateTime)(userInfo.Regtime)).AddSeconds(rand.Next(2, 10));
                            log.CreateUserID = bllVote.WebsiteOwner;
                            log.WebsiteOwner = bllVote.WebsiteOwner;
                            log.VoteCount    = 1;
                            log.IP           = userInfo.RegIP;
                            log.IPLocation   = Common.MySpider.GetIPLocation(log.IP);
                            if (bllVote.Add(log))
                            {
                                if (bllVote.Update(new VoteObjectInfo(), "VoteCount+=1", string.Format(" AutoID={0}", voteObj.AutoID)) > 0)
                                {
                                    System.Threading.Thread.Sleep(100);
                                }
                            }
                        }

                        #endregion
                        //
                    }
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "选手编号不存在";
                }

                //
            }
            else
            {
                resp.errcode = 1;
            }
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #15
0
        public void ProcessRequest(HttpContext context)
        {
            string voteObjectId = context.Request["vote_object_id"];

            if (string.IsNullOrEmpty(voteObjectId))
            {
                resp.errcode = 1;
                resp.errmsg  = "vote_object_id 必传";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            VoteObjectInfo voteObjInfo = bllVote.GetVoteObjectInfo(int.Parse(voteObjectId));

            if (voteObjInfo == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "vote_object_id 不存在";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            VoteInfo voteInfo = bllVote.GetVoteInfo(voteObjInfo.VoteID);

            if (voteInfo.VoteStatus.Equals(0))
            {
                resp.errcode = 1;
                resp.errmsg  = "投票停止";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > (DateTime.Parse(voteInfo.StopDate)))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "投票结束";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
            }
            if (voteObjInfo.Status.Equals(0))
            {
                resp.errcode = 1;
                resp.errmsg  = "审核未通过";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            string dateTimeToDay    = DateTime.Now.ToString("yyyy-MM-dd");
            string dateTimeTomorrow = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            //检查是否可以投票 每天1票
            int logCount = bllVote.GetCount <VoteLogInfo>(string.Format("VoteID={0} And UserID='{1}' And InsertDate>='{2}' And InsertDate<'{3}'", voteInfo.AutoID, CurrentUserInfo.UserID, dateTimeToDay, dateTimeTomorrow));

            if (logCount >= 1)
            {
                resp.errcode = 1;
                resp.errmsg  = "今天已经投过票了,明天再来吧";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }

            if (bllVote.UpdateVoteObjectVoteCount(voteInfo.AutoID, voteObjInfo.AutoID, CurrentUserInfo.UserID, 1))
            {
                if (!bllVote.UpdateVoteObjectRank(voteInfo.AutoID, "1"))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "更新排名失败";
                    context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    return;
                }
                resp.errmsg = "ok";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "投票失败";
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #16
0
        /// <summary>
        /// 点赞
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteCount(HttpContext context)
        {
            if (!bllUser.IsLogin)
            {
                resp.errcode = (int)APIErrCode.UserIsNotLogin;
                resp.errmsg  = "请先登录";
                return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            }
            else
            {
                currentUserInfo = bllUser.GetCurrentUserInfo();
            }
            int      voteObjectId = int.Parse(context.Request["vote_object_id"]);
            VoteInfo voteInfo     = bllVote.GetVoteInfo(voteId);

            if (voteInfo.VoteStatus.Equals(0))
            {
                resp.errcode = 1;
                resp.errmsg  = "点赞停止";
                goto outoff;
            }
            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > (DateTime.Parse(voteInfo.StopDate)))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "点赞结束";
                    goto outoff;
                }
            }
            VoteObjectInfo voteObjInfo = bllVote.GetVoteObjectInfo(voteObjectId);

            if (voteObjInfo == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "选手编号不存在";
                goto outoff;
            }
            if (voteObjInfo.CreateUserId == currentUserInfo.UserID)
            {
                resp.errcode = 1;
                resp.errmsg  = "不可以为自己点赞哟";
                goto outoff;
            }

            if (!voteObjInfo.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "审核通过的选手才能点赞";
                goto outoff;
            }



            string dateTimeToDay    = DateTime.Now.ToString("yyyy-MM-dd");
            string dateTimeTomorrow = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");

            //检查是否可以投票每天1个选手1票
            int logCount = bllVote.GetCount <VoteLogInfo>(string.Format("VoteID={0} And UserID='{1}' And InsertDate>='{2}' And InsertDate<'{3}' And VoteObjectID={4}", voteId, currentUserInfo.UserID, dateTimeToDay, dateTimeTomorrow, voteObjectId));

            if (logCount >= 1)
            {
                resp.errcode = -2;
                resp.errmsg  = "已经点过赞,请确认是否使用积分点赞";
                goto outoff;
            }

            if (bllVote.UpdateVoteObjectVoteCount(voteId, voteObjectId, currentUserInfo.UserID, 1))
            {
                if (!bllVote.UpdateVoteObjectRank(voteId, "1"))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "更新排名失败";
                    goto outoff;
                }
                resp.errmsg = "点赞成功!";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "点赞失败";
            }
outoff:
            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #17
0
        public void ProcessRequest(HttpContext context)
        {
            string       data = context.Request["data"];
            RequestModel requestModel;

            try
            {
                requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(data);
            }
            catch (Exception)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "json格式错误,请检查。";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (requestModel.vote_object_id <= 0)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = " vote_id 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.vote_object_name))
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "vote_object_name 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.head_img_url))
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = " head_img_url 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            VoteObjectInfo model = bllVote.GetVoteObjectInfo(requestModel.vote_object_id);

            if (model == null)
            {
                resp.errmsg  = "投票对象不存在";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            model.Introduction        = requestModel.vote_object_introduction;
            model.VoteObjectName      = requestModel.vote_object_name;
            model.VoteObjectHeadImage = requestModel.head_img_url;
            model.Area = requestModel.vote_area;
            #region 展示图片
            if (requestModel.show_img_list != null)
            {
                for (int i = 0; i < requestModel.show_img_list.Count; i++)
                {
                    switch (i)
                    {
                    case 0:
                        model.ShowImage1 = requestModel.show_img_list[0];
                        break;

                    case 1:
                        model.ShowImage2 = requestModel.show_img_list[1];
                        break;

                    case 2:
                        model.ShowImage3 = requestModel.show_img_list[2];
                        break;

                    case 3:
                        model.ShowImage4 = requestModel.show_img_list[3];
                        break;

                    case 4:
                        model.ShowImage5 = requestModel.show_img_list[4];
                        break;

                    default:
                        break;
                    }
                }
            }
            #endregion
            model.Phone = requestModel.vote_object_phone;
            model.Ex1   = requestModel.ex1;
            model.Ex2   = requestModel.ex2;
            model.Ex3   = requestModel.ex3;
            model.Ex4   = requestModel.ex4;
            model.Ex5   = requestModel.ex5;
            model.Ex6   = requestModel.ex6;
            model.Ex7   = requestModel.ex7;
            model.Ex8   = requestModel.ex8;
            model.Ex9   = requestModel.ex9;
            model.Ex10  = requestModel.ex10;
            if (bllVote.Update(model))
            {
                resp.isSuccess = true;
                resp.errmsg    = "ok";
            }
            else
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                resp.errmsg  = "修改投票对象信息出错";
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #18
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string area           = context.Request["Area"];
            string introduction   = context.Request["Introduction"];
            string number         = (bllVote.GetVoteObjectMaxNumber(currVote.AutoID) + 1).ToString();
            string phone          = context.Request["Phone"];
            string height         = context.Request["height"];

            string showImage1 = context.Request["ShowImage1"];
            string showImage2 = context.Request["ShowImage2"];
            string showImage3 = context.Request["ShowImage3"];
            string showImage4 = context.Request["ShowImage4"];
            string showImage5 = context.Request["ShowImage5"];

            string schoolName          = context.Request["SchoolName"];
            string conatact            = context.Request["Conatact"];
            string ex1                 = context.Request["Ex1"];
            string ex2                 = context.Request["Ex2"];
            string ex3                 = context.Request["Ex3"];
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];

            VoteObjectInfo model = bllVote.GetVoteObjectInfo(currVote.AutoID, currentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "您还没有报名";
                goto outoff;
            }
            if (model.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "您已通过审核,不能修改个人资料";
                goto outoff;
            }
            //if (string.IsNullOrEmpty(introduction))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入参赛口号";
            //    goto outoff;
            //}
            //if (string.IsNullOrEmpty(voteObjectName))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入姓名";
            //    goto outoff;
            //}

            //if (string.IsNullOrEmpty(area))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入城市";
            //    goto outoff;
            //}


            //if (string.IsNullOrEmpty(phone))
            //{
            //    resp.errcode = 1;
            //    resp.errmsg = "请输入联系人电话";
            //    goto outoff;
            //}
            CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();
            if (!string.IsNullOrWhiteSpace(showImage1))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle1 = Convert.ToInt32(context.Request["imgAngle1"]);
                //imgAngle = 90;
                if (imgAngle1 != 0)
                {
                    imgAngle1 = RevertAngle(imgAngle1);
                    if (showImage1.StartsWith("http"))//远程图片
                    {
                        showImage1 = bllJuactivity.DownLoadRemoteImage(showImage1);
                    }
                    //获取源图片地址
                    string imgPath1 = context.Server.MapPath(showImage1);


                    var imgResult = imgHelper.RotateImg(imgPath1, imgAngle1, imgPath1);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage2))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle2 = Convert.ToInt32(context.Request["imgAngle2"]);

                if (imgAngle2 != 0)
                {
                    imgAngle2 = RevertAngle(imgAngle2);
                    if (showImage2.StartsWith("http"))//远程图片
                    {
                        showImage2 = bllJuactivity.DownLoadRemoteImage(showImage2);
                    }
                    //获取源图片地址
                    string imgPath2  = context.Server.MapPath(showImage2);
                    var    imgResult = imgHelper.RotateImg(imgPath2, imgAngle2, imgPath2);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage3))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle3 = Convert.ToInt32(context.Request["imgAngle3"]);

                if (imgAngle3 != 0)
                {
                    imgAngle3 = RevertAngle(imgAngle3);
                    if (showImage3.StartsWith("http"))//远程图片
                    {
                        showImage3 = bllJuactivity.DownLoadRemoteImage(showImage3);
                    }
                    //获取源图片地址
                    string imgPath3  = context.Server.MapPath(showImage3);
                    var    imgResult = imgHelper.RotateImg(imgPath3, imgAngle3, imgPath3);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage4))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle4 = Convert.ToInt32(context.Request["imgAngle4"]);

                if (imgAngle4 != 0)
                {
                    imgAngle4 = RevertAngle(imgAngle4);
                    if (showImage4.StartsWith("http"))//远程图片
                    {
                        showImage4 = bllJuactivity.DownLoadRemoteImage(showImage4);
                    }
                    //获取源图片地址
                    string imgPath4  = context.Server.MapPath(showImage4);
                    var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage5))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle5 = Convert.ToInt32(context.Request["imgAngle5"]);

                if (imgAngle5 != 0)
                {
                    imgAngle5 = RevertAngle(imgAngle5);
                    if (showImage5.StartsWith("http"))//远程图片
                    {
                        showImage5 = bllJuactivity.DownLoadRemoteImage(showImage5);
                    }
                    //获取源图片地址
                    string imgPath5  = context.Server.MapPath(showImage5);
                    var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                }
            }

            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Area         = area;
            model.Introduction = introduction;
            model.Phone        = phone;
            model.Height       = height;
            model.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            model.SchoolName   = schoolName;
            model.Contact      = conatact;
            model.Ex1          = ex1;
            model.Ex2          = ex2;
            model.Ex3          = ex3;
            if (!string.IsNullOrEmpty(voteObjectHeadImage))
            {
                model.VoteObjectHeadImage = voteObjectHeadImage;
            }
            if (bllVote.UpdateVoteObjectInfo(model))
            {
                resp.errmsg = "修改成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "修改失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #19
0
        public void ProcessRequest(HttpContext context)
        {
            string       data = context.Request["data"];
            RequestModel requestModel;

            try
            {
                requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(data);
            }
            catch (Exception)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "json格式错误,请检查。";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (requestModel.vote_id <= 0)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = " vote_id 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            var model = bllVote.GetVoteObjectInfo(requestModel.vote_id, currentUserInfo.UserID);

            if (model != null)
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsRepeat;
                resp.errmsg  = " 你已经报过名了";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.vote_object_name))
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = "vote_object_name 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.head_img_url))
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                resp.errmsg  = " head_img_url 为必填项,请检查";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            string         number     = (bllVote.GetVoteObjectMaxNumber(requestModel.vote_id) + 1).ToString();
            VoteObjectInfo voteObject = new VoteObjectInfo();

            voteObject.VoteID              = requestModel.vote_id;
            voteObject.Number              = number;
            voteObject.VoteObjectName      = requestModel.vote_object_name;
            voteObject.VoteObjectHeadImage = requestModel.head_img_url;
            voteObject.Area         = requestModel.vote_area;
            voteObject.Introduction = requestModel.vote_object_introduction;
            voteObject.CreateUserId = currentUserInfo.UserID;
            if (requestModel.show_img_list != null)
            {
                for (int i = 0; i < requestModel.show_img_list.Count; i++)
                {
                    switch (i)
                    {
                    case 0:
                        model.ShowImage1 = requestModel.show_img_list[0];
                        break;

                    case 1:
                        model.ShowImage2 = requestModel.show_img_list[1];
                        break;

                    case 2:
                        model.ShowImage3 = requestModel.show_img_list[2];
                        break;

                    case 3:
                        model.ShowImage4 = requestModel.show_img_list[3];
                        break;

                    case 4:
                        model.ShowImage5 = requestModel.show_img_list[4];
                        break;

                    default:
                        break;
                    }
                }
            }
            voteObject.Phone = requestModel.vote_object_phone;
            voteObject.Ex1   = requestModel.ex1;
            voteObject.Ex2   = requestModel.ex2;
            voteObject.Ex3   = requestModel.ex3;
            voteObject.Ex4   = requestModel.ex4;
            voteObject.Ex5   = requestModel.ex5;
            voteObject.Ex6   = requestModel.ex6;
            voteObject.Ex7   = requestModel.ex7;
            voteObject.Ex8   = requestModel.ex8;
            voteObject.Ex9   = requestModel.ex9;
            voteObject.Ex10  = requestModel.ex10;
            if (bllVote.Add(voteObject))
            {
                resp.isSuccess = true;
                resp.errmsg    = "ok";
            }
            else
            {
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.OperateFail;
                resp.errmsg  = "添加投票对象出错";
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #20
0
        /// <summary>
        /// 报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            try
            {
                string voteObjectName = context.Request["VoteObjectName"];
                string area           = context.Request["Area"];
                string introduction   = context.Request["Introduction"];
                string number         = (bllVote.GetVoteObjectMaxNumber(currVote.AutoID) + 1).ToString();//TODO:生成 number的算法可能会并发产生重复
                string phone          = context.Request["Phone"];
                string height         = context.Request["height"];

                string showImage1 = context.Request["ShowImage1"];
                string showImage2 = context.Request["ShowImage2"];
                string showImage3 = context.Request["ShowImage3"];
                string showImage4 = context.Request["ShowImage4"];
                string showImage5 = context.Request["ShowImage5"];

                string schoolName          = context.Request["SchoolName"];
                string conatact            = context.Request["Conatact"];
                string ex1                 = context.Request["Ex1"];
                string ex2                 = context.Request["Ex2"];
                string ex3                 = context.Request["Ex3"];
                string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];


                if (bllVote.GetVoteObjectInfo(currVote.AutoID, currentUserInfo.UserID) != null)
                {
                    resp.errcode = 1;
                    resp.errmsg  = "你已经报过名了";
                    goto outoff;
                }
                //if (string.IsNullOrEmpty(introduction))
                //{
                //    resp.errcode = 1;
                //    resp.errmsg = "请输入" + (string.IsNullOrWhiteSpace(currVote.SignUpDeclarationRename)? "参赛宣言": currVote.SignUpDeclarationRename);
                //    goto outoff;
                //}
                //if (string.IsNullOrEmpty(voteObjectName))
                //{
                //    resp.errcode = 1;
                //    resp.errmsg = "请输入姓名";
                //    goto outoff;
                //}

                //if (string.IsNullOrEmpty(area))
                //{
                //    resp.errcode = 1;
                //    resp.errmsg = "请输入城市";
                //    goto outoff;
                //}


                if (string.IsNullOrEmpty(phone))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "请输入联系人电话";
                    goto outoff;
                }
                if (bllVote.IsExitsVoteObjectNumber(currVote.AutoID, number))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "编号已经存在";
                    goto outoff;
                }

                CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();
                if (!string.IsNullOrWhiteSpace(showImage1))
                {
                    //图片处理:根据前端传入角度进行图片旋转处理
                    int imgAngle1 = Convert.ToInt32(context.Request["imgAngle1"]);
                    if (imgAngle1 != 0)
                    {
                        imgAngle1 = RevertAngle(imgAngle1);

                        //获取源图片地址
                        string imgPath1 = context.Server.MapPath(showImage1);

                        var imgResult = imgHelper.RotateImg(imgPath1, imgAngle1, imgPath1);
                    }
                }
                if (!string.IsNullOrWhiteSpace(showImage2))
                {
                    //图片处理:根据前端传入角度进行图片旋转处理
                    int imgAngle2 = Convert.ToInt32(context.Request["imgAngle2"]);
                    if (imgAngle2 != 0)
                    {
                        imgAngle2 = RevertAngle(imgAngle2);
                        //获取源图片地址
                        string imgPath2  = context.Server.MapPath(showImage2);
                        var    imgResult = imgHelper.RotateImg(imgPath2, imgAngle2, imgPath2);
                    }
                }
                if (!string.IsNullOrWhiteSpace(showImage3))
                {
                    //图片处理:根据前端传入角度进行图片旋转处理
                    int imgAngle3 = Convert.ToInt32(context.Request["imgAngle3"]);

                    if (imgAngle3 != 0)
                    {
                        imgAngle3 = RevertAngle(imgAngle3);
                        //获取源图片地址
                        string imgPath3  = context.Server.MapPath(showImage3);
                        var    imgResult = imgHelper.RotateImg(imgPath3, imgAngle3, imgPath3);
                    }
                }
                if (!string.IsNullOrWhiteSpace(showImage4))
                {
                    //图片处理:根据前端传入角度进行图片旋转处理
                    int imgAngle4 = Convert.ToInt32(context.Request["imgAngle4"]);

                    if (imgAngle4 != 0)
                    {
                        imgAngle4 = RevertAngle(imgAngle4);
                        //获取源图片地址
                        string imgPath4  = context.Server.MapPath(showImage4);
                        var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                    }
                }
                if (!string.IsNullOrWhiteSpace(showImage5))
                {
                    //图片处理:根据前端传入角度进行图片旋转处理
                    int imgAngle5 = Convert.ToInt32(context.Request["imgAngle5"]);

                    if (imgAngle5 != 0)
                    {
                        imgAngle5 = RevertAngle(imgAngle5);
                        //获取源图片地址
                        string imgPath5  = context.Server.MapPath(showImage5);
                        var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                    }
                }



                VoteObjectInfo model = new VoteObjectInfo();
                model.VoteID              = currVote.AutoID;
                model.Number              = number;
                model.VoteObjectName      = voteObjectName;
                model.VoteObjectHeadImage = showImage1;
                model.Area         = area;
                model.Introduction = introduction;
                model.Phone        = phone;
                model.Status       = 0;
                model.CreateUserId = currentUserInfo.UserID;
                model.Rank         = 0;
                model.ShowImage1   = showImage1;
                model.ShowImage2   = showImage2;
                model.ShowImage3   = showImage3;
                model.ShowImage4   = showImage4;
                model.ShowImage5   = showImage5;
                model.Height       = height;
                model.SchoolName   = schoolName;
                model.Contact      = conatact;
                model.Ex1          = ex1;
                model.Ex2          = ex2;
                model.Ex3          = ex3;
                if (!string.IsNullOrEmpty(voteObjectHeadImage))
                {
                    model.VoteObjectHeadImage = voteObjectHeadImage;
                }
                if (bllVote.AddVoteObjectInfo(model))
                {
                    resp.errmsg = "报名成功";
                    bllVote.UpdateVoteObjectRank(currVote.AutoID);
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "报名失败";
                }
            }
            catch (Exception ex)
            {
                bllVote.ToLog("投票报名异常" + ex.ToString());
                resp.errcode = 1;
                resp.errmsg  = "报名失败,请重试";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #21
0
        /// <summary>
        /// 我爱我班报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            string voteObjectName      = context.Request["VoteObjectName"];
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];
            string area          = context.Request["Area"];
            string introduction  = context.Request["Introduction"];
            string number        = (bllVote.GetVoteObjectMaxNumber(bllVote.TotemaVoteID) + 1).ToString();
            string schoolName    = context.Request["SchoolName"];
            string address       = context.Request["Address"];//Totema
            string contact       = context.Request["Contact"];
            string phone         = context.Request["Phone"];
            string comeonShareId = context.Request["ComeonShareId"];

            if (bllVote.GetVoteObjectInfo(bllVote.TotemaVoteID, CurrentUserInfo.UserID) != null)
            {
                resp.errcode = 1;
                resp.errmsg  = "你已经报过名了";
                goto outoff;
            }
            if (string.IsNullOrEmpty(introduction))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入参赛口号";
                goto outoff;
            }
            if (string.IsNullOrEmpty(voteObjectName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入班级名称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(schoolName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校全称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入所在区域";
                goto outoff;
            }
            if (string.IsNullOrEmpty(address))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校地址";
                goto outoff;
            }
            if (string.IsNullOrEmpty(contact))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人姓名";
                goto outoff;
            }
            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            if (bllVote.IsExitsVoteObjectNumber(bllVote.TotemaVoteID, number))
            {
                resp.errcode = 1;
                resp.errmsg  = "班级编号已经存在";
                goto outoff;
            }

            if (!string.IsNullOrWhiteSpace(voteObjectHeadImage))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle = Convert.ToInt32(context.Request["imgAngle"]);
                //imgAngle = 90;
                if (imgAngle != 0)
                {
                    //获取源图片地址
                    string imgPath = context.Server.MapPath(voteObjectHeadImage);

                    CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();

                    var imgResult = imgHelper.RotateImg(imgPath, imgAngle, imgPath);
                }
            }



            VoteObjectInfo model = new VoteObjectInfo();

            model.VoteID              = bllVote.TotemaVoteID;
            model.Number              = number;
            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = voteObjectHeadImage;
            model.Area          = area;
            model.Introduction  = introduction;
            model.SchoolName    = schoolName;
            model.Address       = address;
            model.Contact       = contact;
            model.Phone         = phone;
            model.Status        = 1;
            model.CreateUserId  = CurrentUserInfo.UserID;
            model.Rank          = 0;
            model.ComeonShareId = comeonShareId;
            if (bllVote.AddVoteObjectInfo(model))
            {
                resp.errmsg = "报名成功";
                bllVote.UpdateVoteObjectRank(bllVote.TotemaVoteID);
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "报名失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #22
0
        /// <summary>
        /// 编辑我们班的资料
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditVoteObjectInfo(HttpContext context)
        {
            string voteObjectName      = context.Request["VoteObjectName"]; //班级名称
            string area                = context.Request["Area"];           //地区
            string introduction        = context.Request["Introduction"];   //口号
            string schoolName          = context.Request["SchoolName"];     //学校名称
            string address             = context.Request["Address"];        //Totema
            string contact             = context.Request["Contact"];        //联系人
            string phone               = context.Request["Phone"];          //联系人电话
            string voteObjectHeadImage = context.Request["VoteObjectHeadImage"];

            if (string.IsNullOrEmpty(introduction))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入参赛口号";
                goto outoff;
            }
            if (string.IsNullOrEmpty(voteObjectName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入班级名称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(schoolName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校全称";
                goto outoff;
            }
            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入所在区域";
                goto outoff;
            }
            if (string.IsNullOrEmpty(address))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入学校地址";
                goto outoff;
            }
            if (string.IsNullOrEmpty(contact))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人姓名";
                goto outoff;
            }
            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            VoteObjectInfo model = bllVote.GetVoteObjectInfo(bllVote.TotemaVoteID, CurrentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "您还没有报名";
                goto outoff;
            }
            if (!string.IsNullOrWhiteSpace(voteObjectHeadImage))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle = Convert.ToInt32(context.Request["imgAngle"]);
                //imgAngle = 90;
                if (imgAngle != 0)
                {
                    //获取源图片地址
                    string imgPath = context.Server.MapPath(voteObjectHeadImage);

                    CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();

                    var imgResult = imgHelper.RotateImg(imgPath, imgAngle, imgPath);
                }
            }
            model.VoteObjectName      = voteObjectName;
            model.Area                = area;
            model.Introduction        = introduction;
            model.SchoolName          = schoolName;
            model.Address             = address;
            model.Contact             = contact;
            model.Phone               = phone;
            model.VoteObjectHeadImage = voteObjectHeadImage;
            if (bllVote.Update(model))
            {
                resp.errmsg = "保存成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "保存失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #23
0
        /// <summary>
        /// 编辑
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string EditVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string area           = context.Request["Area"];
            string introduction   = context.Request["Introduction"];
            string number         = (bllVote.GetVoteObjectMaxNumber(bllVote.BeachHoneyVoteID) + 1).ToString();
            string phone          = context.Request["Phone"];
            string showImage1     = context.Request["ShowImage1"];
            string showImage2     = context.Request["ShowImage2"];
            string showImage3     = context.Request["ShowImage3"];
            string showImage4     = context.Request["ShowImage4"];
            string showImage5     = context.Request["ShowImage5"];

            VoteObjectInfo model = bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID);

            if (model == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "您还没有报名";
                goto outoff;
            }
            if (model.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "您已通过审核,不能修改个人资料";
                goto outoff;
            }
            if (string.IsNullOrEmpty(introduction))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入参赛口号";
                goto outoff;
            }
            if (string.IsNullOrEmpty(voteObjectName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入姓名";
                goto outoff;
            }

            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入城市";
                goto outoff;
            }


            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();
            if (!string.IsNullOrWhiteSpace(showImage1))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle1 = Convert.ToInt32(context.Request["imgAngle1"]);
                //imgAngle = 90;
                if (imgAngle1 != 0)
                {
                    imgAngle1 = RevertAngle(imgAngle1);
                    //获取源图片地址
                    string imgPath1  = context.Server.MapPath(showImage1);
                    var    imgResult = imgHelper.RotateImg(imgPath1, imgAngle1, imgPath1);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage2))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle2 = Convert.ToInt32(context.Request["imgAngle2"]);

                if (imgAngle2 != 0)
                {
                    imgAngle2 = RevertAngle(imgAngle2);
                    //获取源图片地址
                    string imgPath2  = context.Server.MapPath(showImage2);
                    var    imgResult = imgHelper.RotateImg(imgPath2, imgAngle2, imgPath2);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage3))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle3 = Convert.ToInt32(context.Request["imgAngle3"]);

                if (imgAngle3 != 0)
                {
                    imgAngle3 = RevertAngle(imgAngle3);
                    //获取源图片地址
                    string imgPath3  = context.Server.MapPath(showImage3);
                    var    imgResult = imgHelper.RotateImg(imgPath3, imgAngle3, imgPath3);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage4))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle4 = Convert.ToInt32(context.Request["imgAngle4"]);

                if (imgAngle4 != 0)
                {
                    imgAngle4 = RevertAngle(imgAngle4);
                    //获取源图片地址
                    string imgPath4  = context.Server.MapPath(showImage4);
                    var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage5))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle5 = Convert.ToInt32(context.Request["imgAngle5"]);

                if (imgAngle5 != 0)
                {
                    imgAngle5 = RevertAngle(imgAngle5);
                    //获取源图片地址
                    string imgPath5  = context.Server.MapPath(showImage5);
                    var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                }
            }

            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Area         = area;
            model.Introduction = introduction;
            model.Phone        = phone;
            model.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            if (bllVote.UpdateVoteObjectInfo(model))
            {
                resp.errmsg = "修改成功";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "修改失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                int id = int.Parse(Request["id"]);
                //检查登录
                if (!bllVote.IsLogin)
                {
                    Response.Write("请用微信打开");
                    Response.End();
                    return;
                }
                else
                {
                    //if (id == 121)
                    //{
                    //    if (!Request.Url.Host.Equals("comeoncloud.comeoncloud.net"))
                    //    {
                    //        Response.Write("请用微信打开");
                    //        Response.End();
                    //    }
                    //}
                }
                //
                model = bllVote.GetVoteObjectInfo(id);
                if (model == null)
                {
                    Response.Write("选手不存在");
                    Response.End();
                    return;
                }
                VoteInfoModel = bllVote.GetVoteInfo(model.VoteID);
                //if ((!VoteInfoModel.WebsiteOwner.Equals(bllVote.WebsiteOwner)) && (VoteInfoModel.IsFree.Equals(0)))
                //{
                //    Response.Write("拒绝访问");
                //    Response.End();
                //    return;

                //}
                if (VoteInfoModel.VoteStatus.Equals(0))
                {
                    CanUseVoteCount = "投票已结束";
                    return;
                }
                if (!string.IsNullOrEmpty(VoteInfoModel.StopDate))
                {
                    if (DateTime.Now >= (Convert.ToDateTime(VoteInfoModel.StopDate)))
                    {
                        CanUseVoteCount = "投票已结束";
                        return;
                    }
                }
                //if (VoteInfoModel.IsFree.Equals(1) && VoteInfoModel.VoteType.Equals(1) && VoteInfoModel.VoteCountAutoUpdate.Equals(1))
                //{
                //    //检查是否更新票数
                //    bllVote.UpdateUserVoteCount(VoteInfoModel.AutoID, DataLoadTool.GetCurrUserModel());

                //}
                CanUseVoteCount = bllVote.GetCanUseVoteCount(model.VoteID, DataLoadTool.GetCurrUserID()).ToString();
            }
            catch (Exception)
            {
                Response.End();
            }
        }
Beispiel #25
0
        /// <summary>
        /// 投票
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string UpdateVoteObjectVoteCount(HttpContext context)
        {
            if (!bllVote.IsWeiXinBrowser)
            {
                resp.errcode = 2;
                resp.errmsg  = "";
                goto outoff;
            }


            int      voteObjectId = int.Parse(context.Request["id"]);
            VoteInfo voteInfo     = bllVote.GetVoteInfo(bllVote.BeachHoneyVoteID);

            if (voteInfo.VoteStatus.Equals(0))
            {
                resp.errcode = 1;
                resp.errmsg  = "投票停止";
                goto outoff;
            }
            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > (DateTime.Parse(voteInfo.StopDate)))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "投票结束";
                    goto outoff;
                }
            }
            VoteObjectInfo model = bllVote.GetVoteObjectInfo(voteObjectId);

            if (!model.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "审核通过的选手才能投票";
                goto outoff;
            }
            //检查是否可以投票
            if (bllVote.GetCount <VoteLogInfo>(string.Format("VoteObjectID={0} And UserID='{1}'", voteObjectId, CurrentUserInfo.UserID)) > 0)
            {
                resp.errcode = 1;
                resp.errmsg  = "您已经投过票了";
                goto outoff;
            }
            //

            //
            if (bllVote.UpdateVoteObjectVoteCount(bllVote.BeachHoneyVoteID, voteObjectId, CurrentUserInfo.UserID, 1))
            {
                if (!bllVote.UpdateVoteObjectRank(bllVote.BeachHoneyVoteID, "1"))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "更新排名失败";
                    goto outoff;
                }
                resp.errmsg = "投票成功!";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "投票失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #26
0
        public void ProcessRequest(HttpContext context)
        {
            string       data = context.Request["data"];
            RequestModel requestModel;

            try
            {
                requestModel = ZentCloud.Common.JSONHelper.JsonToModel <RequestModel>(data);
            }
            catch (Exception)
            {
                resp.errcode = 1;
                resp.errmsg  = "json格式错误,请检查。";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (requestModel.vote_id <= 0)
            {
                resp.errcode = 1;
                resp.errmsg  = " vote_id 必传";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            var voteObjectInfo = bllVote.GetVoteObjectInfo(requestModel.vote_id, CurrentUserInfo.UserID);

            if (voteObjectInfo != null)
            {
                resp.errcode = 1;
                resp.errmsg  = " 你已经报过名了";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.vote_object_name))
            {
                resp.errcode = 1;
                resp.errmsg  = " 名称必填";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            if (string.IsNullOrEmpty(requestModel.head_img_url))
            {
                resp.errcode = 1;
                resp.errmsg  = " 请上传主图";
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            string         number = (bllVote.GetVoteObjectMaxNumber(requestModel.vote_id) + 1).ToString();
            VoteObjectInfo model  = new VoteObjectInfo();

            model.CreateUserId        = CurrentUserInfo.UserID;
            model.Introduction        = requestModel.vote_object_introduction;
            model.VoteID              = requestModel.vote_id;
            model.Number              = number;
            model.VoteObjectName      = requestModel.vote_object_name;
            model.VoteObjectHeadImage = requestModel.head_img_url;
            #region 展示图片
            for (int i = 0; i < requestModel.show_img_list.Count; i++)
            {
                switch (i)
                {
                case 0:
                    model.ShowImage1 = requestModel.show_img_list[0];
                    break;

                case 1:
                    model.ShowImage2 = requestModel.show_img_list[1];
                    break;

                case 2:
                    model.ShowImage3 = requestModel.show_img_list[2];
                    break;

                case 3:
                    model.ShowImage4 = requestModel.show_img_list[3];
                    break;

                case 4:
                    model.ShowImage5 = requestModel.show_img_list[4];
                    break;

                default:
                    break;
                }
            }
            #endregion
            model.Phone = requestModel.vote_object_phone;
            model.Ex1   = requestModel.ex1;
            model.Ex2   = requestModel.ex2;
            model.Ex3   = requestModel.ex3;
            model.Ex4   = requestModel.ex4;
            model.Ex5   = requestModel.ex5;
            model.Ex6   = requestModel.ex6;
            model.Ex7   = requestModel.ex7;
            model.Ex8   = requestModel.ex8;
            model.Ex9   = requestModel.ex9;
            model.Ex10  = requestModel.ex10;
            if (bllVote.Add(model))
            {
                resp.errcode = 0;
                resp.errmsg  = "ok";
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "提交失败";
            }
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #27
0
        /// <summary>
        /// 报名
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteObjectInfo(HttpContext context)
        {
            string voteObjectName = context.Request["VoteObjectName"];
            string area           = context.Request["Area"];
            string introduction   = context.Request["Introduction"];
            string number         = (bllVote.GetVoteObjectMaxNumber(bllVote.BeachHoneyVoteID) + 1).ToString();
            string phone          = context.Request["Phone"];


            string showImage1 = context.Request["ShowImage1"];
            string showImage2 = context.Request["ShowImage2"];
            string showImage3 = context.Request["ShowImage3"];
            string showImage4 = context.Request["ShowImage4"];
            string showImage5 = context.Request["ShowImage5"];

            if (!context.Request.Url.Host.Equals("beachhoney.comeoncloud.net"))
            {
                resp.errcode = 1;
                resp.errmsg  = "请通过沙滩宝贝公众号进行报名";
                goto outoff;
            }
            if (bllVote.GetVoteObjectInfo(bllVote.BeachHoneyVoteID, CurrentUserInfo.UserID) != null)
            {
                resp.errcode = 1;
                resp.errmsg  = "你已经报过名了";
                goto outoff;
            }
            if (string.IsNullOrEmpty(introduction))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入参赛口号";
                goto outoff;
            }
            if (string.IsNullOrEmpty(voteObjectName))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入姓名";
                goto outoff;
            }

            if (string.IsNullOrEmpty(area))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入城市";
                goto outoff;
            }


            if (string.IsNullOrEmpty(phone))
            {
                resp.errcode = 1;
                resp.errmsg  = "请输入联系人电话";
                goto outoff;
            }
            if (bllVote.IsExitsVoteObjectNumber(bllVote.BeachHoneyVoteID, number))
            {
                resp.errcode = 1;
                resp.errmsg  = "编号已经存在";
                goto outoff;
            }

            CommonPlatform.Helper.ImageHandler imgHelper = new CommonPlatform.Helper.ImageHandler();
            if (!string.IsNullOrWhiteSpace(showImage1))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle1 = Convert.ToInt32(context.Request["imgAngle1"]);
                if (imgAngle1 != 0)
                {
                    imgAngle1 = RevertAngle(imgAngle1);
                    //获取源图片地址
                    string imgPath1  = context.Server.MapPath(showImage1);
                    var    imgResult = imgHelper.RotateImg(imgPath1, imgAngle1, imgPath1);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage2))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle2 = Convert.ToInt32(context.Request["imgAngle2"]);
                if (imgAngle2 != 0)
                {
                    imgAngle2 = RevertAngle(imgAngle2);
                    //获取源图片地址
                    string imgPath2  = context.Server.MapPath(showImage2);
                    var    imgResult = imgHelper.RotateImg(imgPath2, imgAngle2, imgPath2);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage3))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle3 = Convert.ToInt32(context.Request["imgAngle3"]);

                if (imgAngle3 != 0)
                {
                    imgAngle3 = RevertAngle(imgAngle3);
                    //获取源图片地址
                    string imgPath3  = context.Server.MapPath(showImage3);
                    var    imgResult = imgHelper.RotateImg(imgPath3, imgAngle3, imgPath3);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage4))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle4 = Convert.ToInt32(context.Request["imgAngle4"]);

                if (imgAngle4 != 0)
                {
                    imgAngle4 = RevertAngle(imgAngle4);
                    //获取源图片地址
                    string imgPath4  = context.Server.MapPath(showImage4);
                    var    imgResult = imgHelper.RotateImg(imgPath4, imgAngle4, imgPath4);
                }
            }
            if (!string.IsNullOrWhiteSpace(showImage5))
            {
                //图片处理:根据前端传入角度进行图片旋转处理
                int imgAngle5 = Convert.ToInt32(context.Request["imgAngle5"]);

                if (imgAngle5 != 0)
                {
                    imgAngle5 = RevertAngle(imgAngle5);
                    //获取源图片地址
                    string imgPath5  = context.Server.MapPath(showImage5);
                    var    imgResult = imgHelper.RotateImg(imgPath5, imgAngle5, imgPath5);
                }
            }



            VoteObjectInfo model = new VoteObjectInfo();

            model.VoteID              = bllVote.BeachHoneyVoteID;
            model.Number              = number;
            model.VoteObjectName      = voteObjectName;
            model.VoteObjectHeadImage = showImage1;
            model.Area         = area;
            model.Introduction = introduction;
            model.Phone        = phone;
            model.Status       = 0;
            model.CreateUserId = CurrentUserInfo.UserID;
            model.Rank         = 0;
            model.ShowImage1   = showImage1;
            model.ShowImage2   = showImage2;
            model.ShowImage3   = showImage3;
            model.ShowImage4   = showImage4;
            model.ShowImage5   = showImage5;
            if (bllVote.AddVoteObjectInfo(model))
            {
                resp.errmsg = "报名成功";
                bllVote.UpdateVoteObjectRank(bllVote.BeachHoneyVoteID);
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "报名失败";
            }
outoff:
            return(Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #28
0
        /// <summary>
        /// 获取奖品接口
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string GetPrize(HttpContext context)
        {
            if (!bllUser.IsLogin)
            {
                resp.errcode = (int)APIErrCode.UserIsNotLogin;
                resp.errmsg  = "请先登录";
                return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            }
            else
            {
                currentUserInfo = bllUser.GetCurrentUserInfo();
            }
            VoteInfo voteInfo = bllVote.GetVoteInfo(voteId);//主投票信息

            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > DateTime.Parse(voteInfo.StopDate))
                {
                    VoteObjectInfo myInfo = bllVote.GetVoteObjectInfo(voteId, currentUserInfo.UserID);
                    if (myInfo == null)
                    {
                        resp.errcode = 1;
                        resp.errmsg  = "未参加";
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                    if (myInfo.Ex1 == "1")//Ex1 表示是否已领奖
                    {
                        resp.errcode = 1;
                        resp.errmsg  = "已领奖";
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                    if (myInfo.Rank == 1)
                    {
                        //领取奖品
                        ZentCloud.ZCBLLEngine.BLLTransaction tran = new ZCBLLEngine.BLLTransaction();

                        try
                        {
                            #region 获得积分
                            if (voteInfo.Ex1 == "0")//获得积分
                            {
                                if (string.IsNullOrEmpty(voteInfo.Ex2) && (int.Parse(voteInfo.Ex2) > 0))
                                {
                                    int addScore = int.Parse(voteInfo.Ex2);//增加的积分
                                    if (bllUser.Update(currentUserInfo, string.Format(" TotalScore+={0}", addScore), string.Format(" AutoID={0}", currentUserInfo.AutoID), tran) <= 0)
                                    {
                                        tran.Rollback();
                                        resp.errcode = 1;
                                        resp.errmsg  = "更新用户积分失败";
                                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                                    }
                                    WBHScoreRecord scoreRecord = new WBHScoreRecord();
                                    scoreRecord.InsertDate   = DateTime.Now;
                                    scoreRecord.NameStr      = string.Format("参加今日我最美点赞,使用{0}积分", voteInfo.UseScore);
                                    scoreRecord.RecordType   = "1";
                                    scoreRecord.ScoreNum     = voteInfo.UseScore.ToString();
                                    scoreRecord.UserId       = currentUserInfo.UserID;
                                    scoreRecord.WebsiteOwner = bllUser.WebsiteOwner;
                                    if (!bllUser.Add(scoreRecord, tran))
                                    {
                                        tran.Rollback();
                                        resp.errcode = 1;
                                        resp.errmsg  = "插入积分记录表失败";
                                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                                    }

                                    #region 增加yike 积分

                                    if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, ""))
                                    {
                                        if (!string.IsNullOrEmpty(currentUserInfo.Phone))
                                        {
                                            yiKeClient.BonusUpdate(currentUserInfo.Ex2, (voteInfo.UseScore), "参加今日我最美获得积分" + voteInfo.UseScore);
                                        }
                                    }
                                    #endregion
                                }
                            }

                            #endregion



                            #region 获得优惠券
                            if (voteInfo.Ex1 == "1")//获得积分
                            {
                                if (string.IsNullOrEmpty(voteInfo.Ex2) && (int.Parse(voteInfo.Ex2) > 0))
                                {
                                    int           cardCouponId = int.Parse(voteInfo.Ex2);                   //优惠券编号
                                    CardCoupons   cardCoupon   = bllCardCoupon.GetCardCoupon(cardCouponId); //主卡券编号
                                    MyCardCoupons myCard       = new MyCardCoupons();
                                    myCard.CardCouponNumber = string.Format("No.{0}{1}", DateTime.Now.ToString("yyyyMMdd"), new Random().Next(11111, 99999).ToString());
                                    myCard.CardCouponType   = cardCoupon.CardCouponType;
                                    myCard.CardId           = cardCouponId;
                                    myCard.InsertDate       = DateTime.Now;
                                    myCard.UserId           = currentUserInfo.UserID;
                                    myCard.WebSiteOwner     = bllUser.WebsiteOwner;
                                    if (!bllCardCoupon.Add(myCard, tran))
                                    {
                                        tran.Rollback();
                                        resp.errcode = 1;
                                        resp.errmsg  = "领取优惠券失败";
                                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                                    }
                                }
                            }

                            #endregion
                        }
                        catch (Exception)
                        {
                            tran.Rollback();
                            resp.errcode = 1;
                            resp.errmsg  = "领取失败";
                            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        }


                        //最后更新选手领奖状态为已经领奖
                        myInfo.Ex1 = "1";
                        if (!bllVote.Update(myInfo))
                        {
                            tran.Rollback();
                            resp.errcode = 1;
                            resp.errmsg  = "更新领奖状态失败";
                            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                        }
                        tran.Commit();
                        resp.errcode = 0;
                        resp.errmsg  = voteInfo.Prize;
                        return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                    }
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "还未到截止时间";
                    return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                }
            }
            resp.errcode = 1;
            resp.errmsg  = "";
            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #29
0
        public void ProcessRequest(HttpContext context)
        {
            string voteObjectId = context.Request["vote_object_id"];

            if (string.IsNullOrEmpty(voteObjectId))
            {
                resp.errmsg  = "vote_object_id 为必填项,请检查";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            VoteObjectInfo model = bllVote.GetVoteObjectInfo(int.Parse(voteObjectId));

            if (model == null)
            {
                resp.errmsg  = "投票对象不存在";
                resp.errcode = (int)BLLJIMP.Enums.APIErrCode.IsNotFound;
                context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
                return;
            }
            resp.isSuccess = true;
            List <string> showImgList = new List <string>();

            if (!string.IsNullOrEmpty(model.ShowImage1))
            {
                showImgList.Add(bllVote.GetImgUrl(model.ShowImage1));
            }
            if (!string.IsNullOrEmpty(model.ShowImage2))
            {
                showImgList.Add(bllVote.GetImgUrl(model.ShowImage2));
            }
            if (!string.IsNullOrEmpty(model.ShowImage3))
            {
                showImgList.Add(bllVote.GetImgUrl(model.ShowImage3));
            }
            if (!string.IsNullOrEmpty(model.ShowImage4))
            {
                showImgList.Add(bllVote.GetImgUrl(model.ShowImage4));
            }
            if (!string.IsNullOrEmpty(model.ShowImage5))
            {
                showImgList.Add(bllVote.GetImgUrl(model.ShowImage5));
            }
            resp.returnObj = new
            {
                vote_id            = model.VoteID,
                vote_object_id     = model.AutoID,
                vote_object_number = model.Number,
                vote_object_name   = model.VoteObjectName,
                head_img_url       = bllVote.GetImgUrl(model.VoteObjectHeadImage),
                rank                     = model.Rank,
                vote_count               = model.VoteCount,
                vote_object_status       = model.Status,
                vote_object_introduction = model.Introduction,
                show_img_list            = showImgList,
                vote_object_phone        = model.Phone,
                vote_area                = model.Area,
                ex1  = model.Ex1,
                ex2  = model.Ex2,
                ex3  = model.Ex3,
                ex4  = model.Ex4,
                ex5  = model.Ex5,
                ex6  = model.Ex6,
                ex7  = model.Ex7,
                ex8  = model.Ex8,
                ex9  = model.Ex9,
                ex10 = model.Ex10
            };
            context.Response.Write(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }
Beispiel #30
0
        /// <summary>
        /// 使用积分点赞
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        private string AddVoteCountByScore(HttpContext context)
        {
            if (!bllUser.IsLogin)
            {
                resp.errcode = (int)APIErrCode.UserIsNotLogin;
                resp.errmsg  = "请先登录";
                return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
            }
            else
            {
                currentUserInfo = bllUser.GetCurrentUserInfo();
            }
            int      voteObjectId = int.Parse(context.Request["vote_object_id"]);
            VoteInfo voteInfo     = bllVote.GetVoteInfo(voteId);

            if (voteInfo.VoteStatus.Equals(0))
            {
                resp.errcode = 1;
                resp.errmsg  = "点赞停止";
                goto outoff;
            }
            if (!string.IsNullOrEmpty(voteInfo.StopDate))
            {
                if (DateTime.Now > (DateTime.Parse(voteInfo.StopDate)))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "点赞结束";
                    goto outoff;
                }
            }
            if (voteInfo.UseScore <= 0)
            {
                resp.errcode = 1;
                resp.errmsg  = "暂未设置使用积分点赞";
                goto outoff;
            }
            #region 使用yike 积分

            if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, ""))
            {
                if (!string.IsNullOrEmpty(currentUserInfo.Phone))
                {
                    Open.EZRproSDK.Entity.BonusGetResp yikeUser = yiKeClient.GetBonus(currentUserInfo.Ex1, currentUserInfo.Ex2, currentUserInfo.Phone);
                    if (yikeUser != null)
                    {
                        currentUserInfo.TotalScore = yikeUser.Bonus;
                    }
                }
            }
            #endregion
            if (currentUserInfo.TotalScore < voteInfo.UseScore)
            {
                resp.errcode = 1;
                resp.errmsg  = "很遗憾,您的积分不足";
                goto outoff;
            }
            VoteObjectInfo voteObjInfo = bllVote.GetVoteObjectInfo(voteObjectId);
            if (voteInfo == null)
            {
                resp.errcode = 1;
                resp.errmsg  = "选手编号不存在";
                goto outoff;
            }
            if (voteObjInfo.CreateUserId == currentUserInfo.UserID)
            {
                resp.errcode = 1;
                resp.errmsg  = "不可以为自己点赞哟";
                goto outoff;
            }
            if (!voteObjInfo.Status.Equals(1))
            {
                resp.errcode = 1;
                resp.errmsg  = "审核通过的选手才能点赞";
                goto outoff;
            }
            if (bllVote.UpdateVoteObjectVoteCount(voteId, voteObjectId, currentUserInfo.UserID, 1))
            {
                if (!bllVote.UpdateVoteObjectRank(voteId, "1"))
                {
                    resp.errcode = 1;
                    resp.errmsg  = "更新排名失败";
                    goto outoff;
                }
                resp.errmsg = "点赞成功!";
                currentUserInfo.TotalScore -= voteInfo.UseScore;
                if (bllUser.Update(currentUserInfo, string.Format("TotalScore-={0}", currentUserInfo.TotalScore), string.Format(" AutoID={0}", currentUserInfo.AutoID)) > 0)
                {
                    //插入积分记录
                    WBHScoreRecord scoreRecord = new WBHScoreRecord();
                    scoreRecord.InsertDate   = DateTime.Now;
                    scoreRecord.NameStr      = string.Format("参加今日我最美点赞,使用{0}积分", voteInfo.UseScore);
                    scoreRecord.RecordType   = "1";
                    scoreRecord.ScoreNum     = voteInfo.UseScore.ToString();
                    scoreRecord.UserId       = currentUserInfo.UserID;
                    scoreRecord.WebsiteOwner = bllUser.WebsiteOwner;
                    if (!bllUser.Add(scoreRecord))
                    {
                        resp.errcode = 1;
                        resp.errmsg  = "插入积分记录失败";
                        goto outoff;
                    }
                    //积分记录
                    #region 扣除yike 积分

                    if (bllCommRelation.ExistRelation(BLLJIMP.Enums.CommRelationType.SyncYike, bllCommRelation.WebsiteOwner, ""))
                    {
                        if (!string.IsNullOrEmpty(currentUserInfo.Phone))
                        {
                            yiKeClient.BonusUpdate(currentUserInfo.Ex2, -(voteInfo.UseScore), "参加今日我最美使用积分" + voteInfo.UseScore);
                        }
                    }
                    #endregion
                }
                else
                {
                    resp.errcode = 1;
                    resp.errmsg  = "更新用户积分失败";
                    goto outoff;
                }
            }
            else
            {
                resp.errcode = 1;
                resp.errmsg  = "点赞失败";
            }
outoff:
            return(ZentCloud.Common.JSONHelper.ObjectToJson(resp));
        }