微信营销是一种新型的营销模式,由于微信更重视用户之间的互动,故而这种营销推广不不能盲目地套用微博营销的单纯大量广告推送方式。这种方式在微信营销中的效果非常差,会令用户反感,继而取消去企业或商家的微信公众账号关注。对于企业来说,做微信推广重要的一个方面就是提高用户和公众账号之间的黏度,而微信大转盘就是其中最为常见的活动。

下面详细介绍:

一、使用

1. 新建一个大转盘的活动:

2. 奖项设置

3. 保存后,在微信里给公众号发一个“大转盘”的消息, 就会收到大转盘的内容

4. 点击进入大转盘活动,然后点击中间的 “点击抽奖”:

    

二、实现

1. 页面

1.1 前台代码
[removed]
    [removed].href = "end.aspx?wid="+<%=wid%>+"&aid="+<%=aid%>+"&openid="+<%=openid%>+";";
[removed]nbsp;html>



    <meta>

    <meta>
    <meta>
    <meta>
    <meta>
    <meta>
    <meta>
    <meta>
    <meta>
    <title>幸运大转盘抽奖</title>
    [removed][removed]
    [removed][removed]
    [removed][removed]
    <link>
    <style>
        .activity-lottery-winning {
            background: url(images/beijing.gif) repeat scroll 0 0 #7E65AB;
            background-size: 120px auto;
            overflow: hidden;
        }
    </style>
    
登录后复制         

                                                   

                

                    

                        <>-.>                     </>                                   <>                     </> <>                         <>                     </>                                            <>                 </> <>                     </>

                        

恭喜你中奖了

                        

                            

你中了:

                            

兑奖SN码:

                            

                                                             

                            

                                                             

                                                         

                                                             

                                                                               

                    

                        

恭喜你中奖了

                        

                            

你中了:

                            

兑奖sn码为:

                            

你已经兑奖成功,本SN码自定作废!

                                                                               

                    

                        

奖项设置:

                        

                                                                                  

                                                      

                    

                        

活动说明:

                        

                            

                                本次活动每天可以转                                                              次,总共可以转                                                               次 你已经转了                                        次                             

                            

                                                             

                                                                                             [removed] var thisurl= document.URL; var wid = <%=wid%>; var aid =<%=aid%>; var status = $("#hidStatus").val(); var showInfo = $("#hidErrInfo").val(); var openid ="<%=openid%>"; var jxname=""; var jpname=""; var cjtip=""; var zhuantimes=parseInt( $("#zhuantimes").text()); var zjl = false;//没中奖为false中奖为true <% if (isZhJing) { %> $("#outercont").hide(); $("#result").show(); <%} %> if (status == "2") { $("#outercont").hide(); } else if(status=="100") { $("#outercont").hide(); $("#result").hide(); $("#zjl").show(); } $(function () { window.requestAnimFrame = (function () { return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (callback) { window.setTimeout(callback, 1000 / 60) } })(); var totalDeg = 360 * 3 + 0; var steps = []; var lostDeg = [360]; var prizeDeg = <%=shuzu%>; var prize, sncode; var count = 0; var now = 0; var a = 0.01; var outter, inner, timer, running = false; function countSteps() { var t = Math.sqrt(2 * totalDeg / a); var v = a * t; for (var i = 0; i < t xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed xss=removed cjtip=data.content; xss=removed xss=removed cjtip=data.content; xss=removed zjl=true; cjtip=data.content; xss=removed xss=removed jpname=data.jpname; jxname=data.jxname; cjtip=data.content; xss=removed xss=removed xss=removed xss=removed xss=removed pwd = "" xss=removed>0 && $.trim($("#parssword").val()) == "") { alert("请输入兑奖密码!"); return } if ($.trim(tel) == "") { alert("请输入手机号!"); return } if($("#parssword").length>0){ pwd= $("#parssword").val(); } var rad = Math.random(); var submitData = { id: hidAwardId, aid: aid, pwd: pwd, snumber:$("#sncode").text(), tel: tel, rad: rad, openid:openid }; $.post('dzpAct.ashx?myact=update', submitData, function (data) { if (data.success == "1") { alert("提交成功!"); $("#result").slideToggle(500); $("#zjl").slideToggle(500); $("#outercont").slideUp(500); } else { alert(data.msg); } }, "json") }); [removed]         [removed] document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { window.shareData = { "imgUrl": "", "timeLineLink": thisurl + "&is_share=1", "sendFriendLink": thisurl + "&is_share=1", "weiboLink": thisurl + "&is_share=1", "tTitle": "<%=dzpAction.actName%>", "tContent": "请关注后,再来抽奖。<%=dzpAction.brief%>", "fTitle": "请关注后,再来抽奖。<%=dzpAction.actName%>", "fContent": "请关注后,再来抽奖。<%=dzpAction.brief%>", "wContent": "请关注后,再来抽奖。<%=dzpAction.brief%>" }; // 发送给好友 WeixinJSBridge.on('menu:share:appmessage', function (argv) { WeixinJSBridge.invoke('sendAppMessage', { "img_url": window.shareData.imgUrl, "img_width": "640", "img_height": "640", "link": window.shareData.sendFriendLink, "desc": window.shareData.fContent, "title": window.shareData.fTitle }, function (res) { _report('send_msg', res.err_msg); }) }); // 分享到朋友圈 WeixinJSBridge.on('menu:share:timeline', function (argv) { WeixinJSBridge.invoke('shareTimeline', { "img_url": window.shareData.imgUrl, "img_width": "640", "img_height": "640", "link": window.shareData.timeLineLink, "desc": window.shareData.tContent, "title": window.shareData.tTitle }, function (res) { _report('timeline', res.err_msg); }); }); // 分享到微博 WeixinJSBridge.on('menu:share:weibo', function (argv) { WeixinJSBridge.invoke('shareWeibo', { "content": window.shareData.wContent, "url": window.shareData.weiboLink, }, function (res) { _report('weibo', res.err_msg); }); }); }, false) [removed]            

©微布斯科技提供 qq 121285904 www.webus.cn

2.1  后台代码
/// 
      /// ErrLevel:100表示正确无误,1表示严重错误,2表示业务方面有问题;3直接跳转到结束页面
      /// 
      public int ErrLevel = 100;
      public string ErrorInfo = "";
      public  Model.wx_dzpActionInfo dzpAction;
      public int picIndex = 0;
      public int aid = 0;
      public int wid = 0;
      public bool isZhJing = false;
      public string openid = "";
      public string shuzu = "";
      BLL.wx_dzpAwardUser ubll = new BLL.wx_dzpAwardUser();
      BLL.wx_dzpUsersTemp utbll = new BLL.wx_dzpUsersTemp();
      BLL.wx_dzpActionInfo actBll = new BLL.wx_dzpActionInfo();
      BLL.wx_dzpAwardItem itemBll = new BLL.wx_dzpAwardItem();
 
      protected void Page_Load(object sender, EventArgs e)
      {
          OnlyWeiXinLook();
          aid = MyCommFun.RequestInt("aid", 0);
          wid = MyCommFun.RequestInt("wid", 0);
          openid = MyCommFun.RequestOpenid();
 
          if (aid == 0 || wid == 0 || openid.Trim() == "")
          {
              ErrLevel = 1;
              ErrorInfo = "访问参数错误!";
              return;
          }
          BindData();
      }
 
 
      private void BindData()
      {
          dzpAction = actBll.GetModel(aid);
          IList itemlist = itemBll.GetModelList("actId=" + aid);
          if (dzpAction == null || itemlist == null || itemlist.Count " + item.jxName + ":" + item.jpName + "  数量:" + item.jpNum + "");
              ttJpNum += item.jpRealNum.Value;
              picIndex++;
              if (i  0)
          {
              litPwd.Text = "  

  <input>

";           }           if (dzpAction.beginDate > DateTime.Now)           {               hidStatus.Value = "-2";               ErrorInfo = hidErrInfo.Value = "活动尚未开始";           }           int hasCjTimes = utbll.getCJCiShu(aid, openid);//返回该用户的抽奖次数           this.litHasUsedTimes.Text = hasCjTimes.ToString();           int dayMaxTimes = dzpAction.dayMaxTimes == null ? 0 : dzpAction.dayMaxTimes.Value;           int perMaxTimes = dzpAction.personMaxTimes == null ? 0 : dzpAction.personMaxTimes.Value;           //判断是否中奖了           Model.wx_dzpAwardUser award = ubll.getZJinfoByOpenid(aid, openid);           if (award != null && award.id>0)           {    //您中奖了               if (award.uTel != null && award.uTel.ToString().Trim() != "")               {//已经中奖,并且提交了                   litJp.Text = "[" + award.jxName + "] " + award.jpName;                   litSNM.Text = award.sn;                   isZhJing = true;               }               else               { //已经中奖,但是未提交                   hidStatus.Value = "100";                   litzjlJP.Text = "[" + award.jxName + "] " + award.jpName;                   litzjlSN.Text = award.sn;                   hidAwardId.Value = award.id.ToString();                   litJp.Text = "[" + award.jxName + "] " + award.jpName;                   litSNM.Text = award.sn;               }           }           else           {               //判断每人最大抽奖次数,是否超过了               if (hasCjTimes >= dzpAction.personMaxTimes)               {                 hidStatus.Value = "2";                 //litOtherTip.Text = "

您已经抽了" + hasCjTimes + "次了。

";               }               if (isTodayOverSum(dayMaxTimes))               {                   hidStatus.Value = "2";                  // litOtherTip.Text = "

每人每天只有" + dayMaxTimes.ToString() + "次抽奖机会,您已经使用完了。

";               }           }       }       #region 方法       ///        /// 判断今天是否已经超出抽奖次数       /// todayTTTimes:能抽奖的总次数       ///        ///        /// 每天的抽奖总次数       ///        private bool isTodayOverSum( int todayTTTimes)       {           if (todayTTTimes ='" + todaybegin + "' and createDate= todayTTTimes)           {               return true;           }           else           {                              return false;           }         }         #endregion
登录后复制

2. 实现逻辑

public class dzpAct : IHttpHandler
    {
        BLL.wx_dzpActionInfo actbll = new BLL.wx_dzpActionInfo();
        BLL.wx_dzpAwardUser ubll = new BLL.wx_dzpAwardUser();
        BLL.wx_dzpUsersTemp utbll = new BLL.wx_dzpUsersTemp();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            int aid = MyCommFun.RequestInt("aid");
            string openid = MyCommFun.RequestOpenid();  //得到微信用户的openid
            if (_action == "choujiang")
            {
                Dictionary jsonDict = new Dictionary();
                try
                {
                    //抽奖
                    Model.wx_dzpActionInfo dzpAction = new Model.wx_dzpActionInfo();
                  
                    BLL.wx_dzpAwardItem itemBll = new BLL.wx_dzpAwardItem();
                    #region 判断
                    int wid = MyCommFun.RequestInt("wid");
                    if (aid == 0 || wid == 0 || openid.Trim() == "")
                    {
                        jsonDict.Add("error", "sys");
                        jsonDict.Add("content", "参数错误!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    dzpAction = actbll.GetModel(aid);
                    if (dzpAction == null)
                    {
                        jsonDict.Add("error", "sys");
                        jsonDict.Add("content", "参数错误!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    if (dzpAction.endDate  DateTime.Now)
                    {
                        //活动未开始
                        //非活动期间
                        jsonDict.Add("error", "nostart");
                        jsonDict.Add("content", "活动未开始");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    int dayMaxTimes = dzpAction.dayMaxTimes == null ? 0 : dzpAction.dayMaxTimes.Value;
                    int perMaxTimes = dzpAction.personMaxTimes == null ? 0 : dzpAction.personMaxTimes.Value;
                    //判断每人最大抽奖次数,是否超过了
                    if (personCJTimes(openid, aid) >= dzpAction.personMaxTimes)
                    {
                        jsonDict.Add("error", "notimes");
                        jsonDict.Add("content", "您已抽过奖了,欢迎下次再来!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    if (isTodayOverSum(aid, openid, dayMaxTimes))
                    {
                        jsonDict.Add("error", "notimes");
                        jsonDict.Add("content", "每人每天只有" + dayMaxTimes.ToString() + "次抽奖机会。");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    Model.wx_dzpAwardUser award = ubll.getZJinfoByOpenid(aid, openid);
                    if (award != null)
                    {
                        //您中奖了
                        jsonDict.Add("error", "notimes");
                        jsonDict.Add("content", "您中奖了,欢迎下次再来!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    #endregion
                    #region 计算中奖信息
                    /// 处理是否中奖
                    /// hidStatus 状态为-1:不能抽奖,直接跳转到end.aspx页面;
                    /// 0:抽奖次数超过设置的最高次数;
                    /// 1:还可以继续抽奖;
                    /// 2:中奖了;
                    List itemlist = itemBll.GetModelList("actId=" + aid);//该活动的所有奖项信息
                    int ttJpNum = 0;
                    for (int i = 0; i  auserlist = ubll.getHasZJList(aid);//已经中奖的人列表
                    int ZhongJiangNum = 0;
                    if (auserlist != null)
                    {
                        ZhongJiangNum = auserlist.Count; //已经中奖的人数
                    }
                    int syZjNum = ttJpNum - ZhongJiangNum; //剩余的奖品数量
                    if (syZjNum 0) &&( !actbll.ExistsPwd(aid, pwd)))
                    {
                        context.Response.Write("{"msg":"商家兑换密码错误!!","success":"0"}");
                        return;
                    }
                    BLL.wx_dzpAwardUser ubll = new BLL.wx_dzpAwardUser();
                    Model.wx_dzpAwardUser model = ubll.GetModel(id);
                    if (model == null)
                    {
                        context.Response.Write("{"msg":"提交出现异常2!!","success":"0"}");
                        return;
                    }
                    model.uTel = tel;
                    if (pwd.Length > 0)
                    {
                        model.hasLingQu = true;
                    }
                    else
                    {
                        model.hasLingQu = false;
                    }
                    ubll.Update(model);
 
                    context.Response.Write("{"msg":"提交成功!","success":"1"}");
                    return;
                    #endregion
                }
                catch
                {
                    context.Response.Write("{"msg":"提交出现异常!!","success":"0"}");
 
                    return;
                }
            }
        }
        #region 方法
        /// 
        /// 取中奖的项目
        /// 
        /// 所有的奖品信息
        /// 已经中奖的列表
        /// 
        private Model.wx_dzpAwardItem getZJItem(IList itemlist, IList haszjlist)
        {
            IList zjItemlist = new List();//剩余奖品列表
            Model.wx_dzpAwardItem tmpItem = new Model.wx_dzpAwardItem();
            Model.wx_dzpAwardItem stmpItem = new Model.wx_dzpAwardItem();
            IList thiszjRs;
            for (int i = 0; i ();
                int tmpSYNum = 0;
                if (thiszjRs != null)
                {
                    tmpSYNum = MyCommFun.Obj2Int(tmpItem.jpRealNum) - thiszjRs.Count;
                }
                if (tmpSYNum 
        /// 判断该用户的抽奖次数
        /// 
        /// 
        /// 
        private int personCJTimes(string openid, int aid)
        {
            int times = 0;
            times = utbll.GetRecordCount("actId=" + aid + " and openid='" + openid + "'");
            return times;
        }
        /// 
        /// 判断今天是否已经超出抽奖次数
        /// todayTTTimes:能抽奖的总次数
        /// 
        /// 
        /// 每天的抽奖总次数
        /// 
        private bool isTodayOverSum(int aid, string openid, int todayTTTimes)
        {
            if (todayTTTimes ='" + todaybegin + "' and createDate= todayTTTimes)
            {
                return true;
            }
            else
            {
                model.times += 1;
                utbll.Update(model);
                return false;
            }
        }
        /// 
        /// 返回中奖序列号
        /// 
        /// 
        /// 
        public string Get_snumber(int aid)
        {
            Random rd = new Random((int)DateTime.Now.Ticks);
            int radNum = rd.Next(0, 9);//从0到9里随机出一个值
 
            return "SNdzp" + aid + "_" + MyCommFun.ConvertDateTimeInt(DateTime.Now) + radNum;
        }
        #endregion
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
登录后复制

 【相关推荐】

1.微信公众号平台源码下载

2.阿狸子订单系统源码

以上就是微信开发之大转盘功能的详细内容,更多请关注慧达安全导航其它相关文章!

点赞(0)

评论列表 共有 0 条评论

暂无评论
立即
投稿
发表
评论
返回
顶部