Ejemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            int    id      = MyCommFun.RequestInt("id");
            string openid  = MyCommFun.RequestOpenid(); //得到微信用户的openid

            if (_action == "zf")
            {
                //转发
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();

                BLL.wx_cards_gl   countgbll   = new BLL.wx_cards_gl();
                Model.wx_cards_gl cardscountg = new Model.wx_cards_gl();
                BLL.wx_cards      gbll        = new BLL.wx_cards();

                gbll.update(id);
                //转发记录
                cardscountg.cardsid = id;
                cardscountg.openid  = MyCommFun.QueryString("openid");
                countgbll.Add(cardscountg);

                jsonDict.Add("error", "ok");
                jsonDict.Add("content", "ok");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }
Ejemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            int    wid     = MyCommFun.RequestInt("wid");

            if (_action == "search")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                BLL.wx_my_user bll    = new BLL.wx_my_user();
                string         name   = MyCommFun.QueryString("name");
                int            result = bll.GetRecordCount(" username='******' and wid=" + wid);
                if (result > 0)
                {
                    int id = bll.GetModelList(" username='******' and wid=" + wid)[0].id;
                    jsonDict.Add("sys", "0");
                    jsonDict.Add("content", id.ToString() + "&wid=" + wid);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                jsonDict.Add("sys", "err");
                jsonDict.Add("content", "此用户不存在");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                return;
            }
        }
Ejemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";



            #region   头像
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            string uploadFileRet             = UpLoadFile(context);
            Dictionary <string, object> dict = MyCommFun.JsonToDictionary(uploadFileRet);
            if (dict["status"].ToString() == "0")
            {
                //上传失败
                jsonDict.Add("result", "0");
                jsonDict.Add("content", dict["msg"].ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else
            {
                //同步成功
                jsonDict.Add("result", "1");
                jsonDict.Add("content", "头像上传成功!");
                jsonDict.Add("newPhotoUrl", dict["thumb"].ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }

            #endregion
        }
Ejemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            string where = context.Request.QueryString["where"];
            string openid   = context.Request.QueryString["openid"];
            string action   = context.Request.QueryString["action"];
            string order_id = context.Request.QueryString["order_dd"];

            if (action == "order")
            {
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(order_new(openid, where)));
            }
            else if (action == "delete_order")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                jsonDict = new Dictionary <string, string>();


                Update_delete("已删除", order_id);
                jsonDict.Add("errCode", "false");
                jsonDict.Add("recontent", "更新成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else if (action == "list")
            {
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(list()));
            }
        }
Ejemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            int number = MyCommFun.RequestInt("number");
            int page   = MyCommFun.RequestInt("page");

            string where = MyCommFun.RequestParam("where");
            string open_id     = MyCommFun.RequestParam("open_idss");
            string action      = MyCommFun.RequestParam("action");
            string mmm         = "Hg_number asc";
            int    recordCount = 0;
            int    ord         = MyCommFun.RequestInt("orderid");
            string order_123   = MyCommFun.RequestParam("order_123");
            string pic_name    = MyCommFun.RequestParam("pickname");

            if (action == "no_order")
            {
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(No_order(open_id, where)));
            }
            else if (action == "delete_order")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                jsonDict = new Dictionary <string, string>();

                BLL.HG.Hg_list order = new BLL.HG.Hg_list();
                order.DeleteList(ord);
                jsonDict.Add("errCode", "false");
                jsonDict.Add("recontent", "删除成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else if (action == "pay_update")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                jsonDict = new Dictionary <string, string>();

                BLL.HG.Hg_list order = new BLL.HG.Hg_list();
                order.update("已支付", order_123);
                jsonDict.Add("errCode", "false");
                jsonDict.Add("recontent", "更新成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else if (action == "File")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                jsonDict = new Dictionary <string, string>();

                BLL.HG.Hg_list order = new BLL.HG.Hg_list();
                WriteTextLog(DateTime.Now);
                jsonDict.Add("errCode", "false");
                jsonDict.Add("recontent", "更新成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else
            {
                context.Response.Write(MyCommFun.GetJsonByDataset(Hgdata(8, page)));
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 修改状态
        /// </summary>
        /// <param name="dingdanbll"></param>
        /// <param name="jsonDict"></param>
        /// <param name="context"></param>
        private void UpdateOrder(wx_hotel_dingdan dingdanbll, Dictionary <string, string> jsonDict,
                                 HttpContext context, int statusId, string msg)
        {
            int ddid = MyCommFun.RequestInt("dingdanidnum");

            dingdanbll.Update(ddid, statusId.ToString());
            jsonDict.Add("ret", "ok");
            jsonDict.Add("content", msg);
            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            return;
        }
Ejemplo n.º 7
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            string openid  = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (_action == "commit")
            { //提交投票
                int    wid    = MyCommFun.RequestInt("wid");
                int    baseid = MyCommFun.RequestInt("baseid");
                string itemid = MyCommFun.QueryString("itemid");

                BLL.wx_vote_result   resultBll = new BLL.wx_vote_result();
                Model.wx_vote_result result    = new Model.wx_vote_result();
                BLL.wx_vote_item     iBll      = new BLL.wx_vote_item();

                if (MyCommFun.QueryString("isradio") == "true")
                {
                    result.baseid     = baseid;
                    result.itemid     = Convert.ToInt32(itemid);
                    result.openId     = openid;
                    result.createDate = DateTime.Now;
                    resultBll.Add(result);
                    iBll.Update(result.itemid.Value, result.baseid.Value);
                }
                else
                {
                    string[] sArray = itemid.Split(',');
                    for (int i = 0; i < sArray.Length; i++)
                    {
                        result.baseid     = baseid;
                        result.itemid     = Convert.ToInt32(sArray[i]);
                        result.openId     = openid;
                        result.createDate = DateTime.Now;
                        resultBll.Add(result);
                        iBll.Update(result.itemid.Value, result.baseid.Value);
                    }
                }

                //AddAdminLog(MXEnums.ActionEnum.Add.ToString(), ""); //记录日志


                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "投票成功");

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }
Ejemplo n.º 8
0
        public void GetHongNao()
        {
            int    wid    = MyCommFun.RequestInt("wid");
            int    aid    = MyCommFun.RequestInt("aid");
            string openid = MyCommFun.RequestParam("openid");

            if (openid == "" && openid == null)
            {
                jsonDict.Add("re", "error");
                jsonDict.Add("remsg", "参数错误!");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            Model.wx_hb_base hb    = new Model.wx_hb_base();
            BLL.wx_hb_base   hbbll = new BLL.wx_hb_base();
            hb = hbbll.GetModel(aid);
            Random ran      = new Random();
            int    RandKey  = ran.Next(int.Parse(hb.pricemin.ToString()), int.Parse(hb.pricemax.ToString()));
            string nonceStr = "";
            string paySign  = "";

            //      NormalRedPackResult normalReturn = new NormalRedPackResult();
            //      normalReturn = RedPayApi.SendNormalRedPack(hb.appID, hb.paynum, hb.paypass, hb.payZSadd, openid, hb.payname, hb.payreIP, RandKey, hb.zftxt, hb.title, hb.depict, out nonceStr, out paySign);

            //     if (normalReturn.return_msg == "发送成功")
            //     {

            Model.wx_hb_userinfo hbuserM   = new Model.wx_hb_userinfo();
            DAL.wx_hb_userinfo   hbuserDAL = new DAL.wx_hb_userinfo();

            hbuserM.aid     = aid;
            hbuserM.openid  = openid;
            hbuserM.price   = RandKey;
            hbuserM.addtime = DateTime.Now;
            hbuserDAL.Add(hbuserM);

            //    }
            jsonDict.Add("re", "ok");
            //   jsonDict.Add("remsg", normalReturn.return_msg);
            content.Response.Write(MyCommFun.getJsonStr(jsonDict));
            return;
        }
Ejemplo n.º 9
0
        // string pass = MyCommFun.RequestParam("pass_1");

        public void ProcessRequest(HttpContext context)
        {
            string action = MyCommFun.RequestParam("action");
            int    user   = MyCommFun.RequestInt("Hg_number");
            string order  = MyCommFun.RequestParam("order_number");
            string text   = MyCommFun.RequestParam("text");

            if (action == "Suc_pay")
            {
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(Get_pay(user)));
            }
            else if (action == "all_suc")
            {
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(Get_all(user)));
            }
            else if (action == "upload_start")
            {
                if (Update_start(text, order) == true)
                {
                    context.Response.ContentType = "text/json";
                    Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                    jsonDict = new Dictionary <string, string>();
                    jsonDict.Add("errCode", "false");
                    jsonDict.Add("recontent", "更新成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    context.Response.ContentType = "text/json";
                    Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                    jsonDict = new Dictionary <string, string>();
                    jsonDict.Add("errCode", "false");
                    jsonDict.Add("recontent", "fail!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
        }
Ejemplo n.º 10
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MyCommFun.QueryString("act");
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (action == "orderRet")
            {
                #region   //跳转到结果页面,查询订单的最终结果信息
                string openid = MyCommFun.RequestOpenid();
                int    otid   = MyCommFun.RequestInt("otid");
                jsonDict = new Dictionary <string, string>();
                if (openid == "" || otid == 0)
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "抱歉,参数不正确!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                BLL.orders   otBll    = new BLL.orders();
                Model.orders ordertmp = otBll.GetModel(otid);
                if (ordertmp.payment_status == 2)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "下单已经成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "下单失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                #endregion
            }
        }
Ejemplo n.º 11
0
        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 <string, string> jsonDict = new Dictionary <string, string>();

                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", "end");
                        jsonDict.Add("content", "活动已结束");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    else if (dzpAction.beginDate > 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 <Model.wx_dzpAwardItem> itemlist = itemBll.GetModelList("actId=" + aid);//该活动的所有奖项信息
                    int ttJpNum = 0;
                    for (int i = 0; i < itemlist.Count; i++)
                    {
                        ttJpNum += itemlist[i].jpRealNum.Value;
                    }


                    IList <Model.wx_dzpAwardUser> auserlist = ubll.getHasZJList(aid);//已经中奖的人列表
                    int ZhongJiangNum = 0;
                    if (auserlist != null)
                    {
                        ZhongJiangNum = auserlist.Count; //已经中奖的人数
                    }

                    int syZjNum = ttJpNum - ZhongJiangNum; //剩余的奖品数量
                    if (syZjNum <= 0)
                    {                                      //说明已经没有奖品了
                        jsonDict.Add("error", "-1");
                        jsonDict.Add("content", dzpAction.cfcjhf);
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    dzpAction.personNum      = MyCommFun.Obj2Int(dzpAction.personNum, 1);
                    dzpAction.personMaxTimes = MyCommFun.Obj2Int(dzpAction.personMaxTimes, 1);
                    int fenmo = dzpAction.personNum.Value * dzpAction.personMaxTimes.Value;

                    Random rd     = new Random((int)DateTime.Now.Ticks);
                    int    radNum = rd.Next(0, fenmo);//从0到fenmo里随机出一个值
                    if (radNum < syZjNum)
                    {
                        //中奖了,再从剩余奖品里抽取一个奖品
                        Model.wx_dzpAwardItem dajiang = getZJItem(itemlist, auserlist);
                        if (dajiang != null)
                        {
                            //这是中的中奖了
                            string snumber = Get_snumber(aid);
                            int    uId     = ubll.Add(aid, "", "", openid, dajiang.jxName, dajiang.jpName, snumber);

                            jsonDict.Add("error", "succ");
                            jsonDict.Add("content", "恭喜你中奖了!");
                            jsonDict.Add("sortid", dajiang.sort_id.Value.ToString());
                            jsonDict.Add("jxname", dajiang.jxName);
                            jsonDict.Add("jpname", dajiang.jpName);
                            jsonDict.Add("uid", uId.ToString());
                            jsonDict.Add("sn", snumber);
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        else
                        {
                            //奖品已经全部中完了
                            jsonDict.Add("error", "-1");
                            jsonDict.Add("content", dzpAction.cfcjhf);
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                    }
                    else
                    {
                        //这个条件说明:未中奖
                        //抛出未中奖的数据

                        jsonDict.Add("error", "-1");
                        jsonDict.Add("content", dzpAction.cfcjhf);
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }



                    #endregion
                }
                catch (Exception ex)
                {
                    jsonDict.Add("error", "sys");
                    jsonDict.Add("content", "计算抽奖出现未知错误,请联系管理员!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
            }
            else if (_action == "update")
            {
                try
                {
                    #region 提交手机
                    /// 提交手机号码
                    string tel     = MyCommFun.QueryString("tel");
                    string pwd     = MyCommFun.QueryString("pwd");
                    string snumber = MyCommFun.QueryString("snumber");
                    int    id      = MyCommFun.RequestInt("id");

                    if (aid == 0 || id == 0 || snumber == "" || tel == "")
                    {
                        context.Response.Write("{\"msg\":\"提交出现异常!!\",\"success\":\"0\"}");
                        return;
                    }

                    if ((pwd.Length > 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;
                }
            }
        }
Ejemplo n.º 12
0
        public void ProcessRequest(HttpContext context)
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            context.Response.ContentType = "text/json";
            string _action   = MyCommFun.QueryString("myact");
            string username  = MyCommFun.QueryString("username");
            string parssword = MyCommFun.QueryString("parssword");
            string id        = MyCommFun.QueryString("id");
            string openid    = MyCommFun.QueryString("openid");
            string state     = MyCommFun.QueryString("state");
            string goodsData = QueryString("goodsData");
            int    shopid    = MyCommFun.RequestInt("shopid");


            BLL.wx_diancai_dianyuan   dianyuanbll = new BLL.wx_diancai_dianyuan();
            Model.wx_diancai_dianyuan dianyuan    = new Model.wx_diancai_dianyuan();


            BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category();

            BLL.wx_diancai_member   menberbll = new BLL.wx_diancai_member();
            Model.wx_diancai_member member    = new Model.wx_diancai_member();

            BLL.wx_diancai_dingdan_manage    manage      = new BLL.wx_diancai_dingdan_manage();
            Model.wx_diancai_dingdan_manage  managemodel = new Model.wx_diancai_dingdan_manage();
            BLL.wx_diancai_dingdan_caiping   caipinbll   = new BLL.wx_diancai_dingdan_caiping();
            Model.wx_diancai_dingdan_caiping caipin      = new Model.wx_diancai_dingdan_caiping();

            if (_action == "login")
            {
                if (dianyuanbll.Exists(username, parssword))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "登录成功!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "密码错误!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "setstatus")
            {
                //id

                if (manage.Updatestatus(id, state))
                {
                    managemodel = manage.GetModel(MyCommFun.Str2Int(id));
                    BLL.wx_diancai_member menbll = new BLL.wx_diancai_member();
                    if (state == "1")
                    {
                        menbll.Update(managemodel.openid);
                    }
                    if (state == "2")
                    {
                        menbll.Updatefail(managemodel.openid);
                    }

                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "addmember")
            {
                #region 用户基本信息管理
                member = menberbll.GetModel(shopid, openid);
                bool isAdd = false;
                if (member == null)
                {
                    isAdd = true;
                }
                else
                {
                    if (member.status.Value == 0)
                    {
                        //处于黑名单里
                        jsonDict.Add("ret", "fail");
                        jsonDict.Add("content", "您处于黑名单里!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }


                member.shopid         = shopid;
                member.openid         = openid;
                member.weixinName     = MyCommFun.QueryString("weixinName");
                member.Name           = MyCommFun.QueryString("username");
                member.memberName     = MyCommFun.QueryString("username");
                member.menberTel      = MyCommFun.QueryString("customerTel");
                member.memberAddress  = MyCommFun.QueryString("address");
                member.successDingdan = 0;
                member.failDingdan    = 0;
                member.cancelDingdan  = 0;
                member.zongjifen      = 0;
                member.zongcje        = 0;
                member.status         = 0;
                member.createDate     = DateTime.Now;

                if (isAdd)
                {
                    menberbll.Add(member);
                }
                else
                {
                    menberbll.Update(member);
                }

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "提交成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
            else if (_action == "addcaidan")
            {
                string deskNumber = MyCommFun.QueryString("deskNumber");//桌号
                //用户点菜完,提交订单
                #region 判断参数是否合法,判断用户是否处于黑名单里
                if (goodsData == "" || openid == "")
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "订单提交失败,参数为空值!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                member = menberbll.GetModel(shopid, openid);
                bool isAdd = false;
                if (member == null)
                {
                    isAdd  = true;
                    member = new Model.wx_diancai_member();
                }
                else
                {
                    if (member.status.Value == 0)
                    {
                        //处于黑名单里
                        jsonDict.Add("ret", "fail");
                        jsonDict.Add("content", "您处于黑名单里,不能下单!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }

                #endregion

                //获得商家信息
                BLL.wx_diancai_shopinfo   shopbll        = new BLL.wx_diancai_shopinfo();
                Model.wx_diancai_shopinfo shopinfoEntity = new Model.wx_diancai_shopinfo();
                shopinfoEntity = shopbll.GetModel(shopid);

                #region 计算商品总价格
                decimal  payAmount = 0;
                string[] sArray    = goodsData.Split(';');

                for (int i = 0; i < sArray.Length - 1; i++)
                {
                    string[] sAr = sArray[i].Split(',');
                    payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//总价
                }

                #endregion


                member.shopid = shopid;
                member.openid = openid;

                member.Name           = MyCommFun.QueryString("name");
                member.memberName     = MyCommFun.QueryString("name");
                member.menberTel      = MyCommFun.QueryString("phone");
                member.memberAddress  = MyCommFun.QueryString("address");
                member.successDingdan = 0;
                member.failDingdan    = 0;
                member.cancelDingdan  = 0;
                member.zongjifen      = 0;
                member.zongcje        = 0;
                member.status         = 0;
                member.createDate     = DateTime.Now;

                if (isAdd)
                {
                    menberbll.Add(member);
                }
                else
                {
                    menberbll.Update(member);
                }

                #region //订单信息
                managemodel.shopinfoid   = shopid;
                managemodel.openid       = openid;
                managemodel.orderNumber  = Utils.Number(13); //订单号
                managemodel.deskNumber   = deskNumber;       //桌号deskNumber
                managemodel.customerName = MyCommFun.QueryString("name");
                managemodel.customerTel  = MyCommFun.QueryString("phone");
                managemodel.address      = MyCommFun.QueryString("address");
                managemodel.oderRemark   = MyCommFun.QueryString("oderRemark");
                managemodel.payStatus    = 0;
                managemodel.oderRemark   = "";
                managemodel.oderTime     = DateTime.Now;
                managemodel.createDate   = DateTime.Now;
                int idf = manage.Add(managemodel);

                #endregion

                #region   //form表单提交
                BLL.wx_diancai_form_control           cBll        = new BLL.wx_diancai_form_control();
                IList <Model.wx_diancai_form_control> controlList = cBll.GetModelList("shopinfoId=" + shopid);
                if (controlList != null)
                {
                    BLL.wx_diancai_form_result   retBll = new BLL.wx_diancai_form_result();
                    Model.wx_diancai_form_result result = new Model.wx_diancai_form_result();
                    result.shopinfoId = shopid;
                    result.openid     = openid;
                    result.createDate = DateTime.Now;

                    Model.wx_diancai_form_control control = new Model.wx_diancai_form_control();
                    for (int i = 0; i < controlList.Count; i++)
                    {
                        control = controlList[i];
                        string reqControlIdValue = MyCommFun.QueryString("control_" + control.seq);
                        result.cId        = control.seq;
                        result.cName      = control.cName;
                        result.userResult = reqControlIdValue;
                        retBll.Add(result);
                    }
                }
                #endregion

                //菜品

                for (int i = 0; i < sArray.Length - 1; i++)
                {
                    string[] sAr = sArray[i].Split(',');
                    caipin.dingId  = idf;
                    caipin.caiId   = Convert.ToInt32(sAr[0]);                             //菜品ID
                    caipin.num     = Convert.ToInt32(sAr[1]);                             //菜品件数
                    caipin.price   = Convert.ToDecimal(sAr[2]);                           //菜品单价
                    caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //总价
                    //  payAmount += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]);//客户购买总价
                    caipinbll.Add(caipin);
                }
                //订单满多少免配送费
                if (payAmount < shopinfoEntity.freeSendcost)
                {
                    payAmount += Convert.ToDecimal(shopinfoEntity.sendCost);
                }

                bool isOk = manage.Update(idf, payAmount);
                if (isOk)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "订单提交成功!请到订单查看!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "订单提交失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                context.Response.End();
            }
        }
Ejemplo n.º 13
0
        public void ProcessRequest(HttpContext context)
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            context.Response.ContentType = "text/json";
            string _action   = MyCommFun.QueryString("myact");
            string username  = MyCommFun.QueryString("username");
            string parssword = MyCommFun.QueryString("parssword");
            string id        = MyCommFun.QueryString("id");
            string openid    = MyCommFun.QueryString("openid");
            string state     = MyCommFun.QueryString("state");
            string goodsData = QueryString("goodsData");
            int    shopid    = MyCommFun.RequestInt("shopid");


            BLL.wx_diancai_dianyuan   dianyuanbll = new BLL.wx_diancai_dianyuan();
            Model.wx_diancai_dianyuan dianyuan    = new Model.wx_diancai_dianyuan();


            BLL.wx_diancai_caipin_category categorybll = new BLL.wx_diancai_caipin_category();

            BLL.wx_diancai_member   menberbll = new BLL.wx_diancai_member();
            Model.wx_diancai_member member    = new Model.wx_diancai_member();

            BLL.wx_diancai_dingdan_manage    manage      = new BLL.wx_diancai_dingdan_manage();
            Model.wx_diancai_dingdan_manage  managemodel = new Model.wx_diancai_dingdan_manage();
            BLL.wx_diancai_dingdan_caiping   caipinbll   = new BLL.wx_diancai_dingdan_caiping();
            Model.wx_diancai_dingdan_caiping caipin      = new Model.wx_diancai_dingdan_caiping();

            if (_action == "login")
            {
                if (dianyuanbll.Exists(username, parssword))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "登录成功!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "密码错误!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "setstatus")
            {
                //id

                if (manage.Updatestatus(id, state))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "addmember")
            {
                member.shopid         = shopid;
                openid                = Utils.Number(18);
                member.openid         = openid;
                member.weixinName     = MyCommFun.QueryString("weixinName");
                member.memberName     = MyCommFun.QueryString("username");
                member.menberTel      = MyCommFun.QueryString("customerTel");
                member.memberAddress  = MyCommFun.QueryString("address");
                member.successDingdan = 0;
                member.failDingdan    = 0;
                member.cancelDingdan  = 0;
                member.zongjifen      = 0;
                member.zongcje        = 0;
                member.status         = 1;
                member.createDate     = DateTime.Now;
                menberbll.Add(member);

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "提交成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            else if (_action == "addcaidan")
            {
                if (goodsData == "")
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "goodsData为空值!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (openid == "")
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "订单提交失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                //用户信息

                managemodel.shopinfoid  = shopid;
                managemodel.openid      = openid;
                managemodel.orderNumber = Utils.Number(13); //订单号
                managemodel.deskNumber  = "";               //桌号
                // manage.customerName = this.name.Value;
                //manage.customerTel = this.phone.Value;
                managemodel.payStatus  = 0;
                managemodel.oderRemark = "";
                managemodel.oderTime   = DateTime.Now;
                managemodel.createDate = DateTime.Now;
                int idf = manage.Add(managemodel);

                decimal payAmount = 0;

                //菜品
                string[] sArray = goodsData.Split(';');
                for (int i = 0; i < sArray.Length - 1; i++)
                {
                    string[] sAr = sArray[i].Split(',');
                    caipin.dingId  = idf;
                    caipin.caiId   = Convert.ToInt32(sAr[0]);                             //菜品ID
                    caipin.num     = Convert.ToInt32(sAr[1]);                             //菜品件数
                    caipin.price   = Convert.ToDecimal(sAr[2]);                           //菜品单价
                    caipin.totpric = Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //总价
                    payAmount     += Convert.ToInt32(sAr[1]) * Convert.ToDecimal(sAr[2]); //客户购买总价
                    caipinbll.Add(caipin);
                }
                bool isOk = manage.Update(idf, payAmount);
                if (isOk)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "订单提交成功!请到订单查看!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "订单提交失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                context.Response.End();
            }
        }
Ejemplo n.º 14
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            Dictionary <string, string> jsondict = new Dictionary <string, string>();

            #region 注册观众信息
            if (_action == "addGz")
            {
                BLL.wx_zh_gz gzBll   = new BLL.wx_zh_gz();
                string       tel     = MyCommFun.QueryString("tel");
                string       fax     = MyCommFun.QueryString("fax");
                string       mobile  = MyCommFun.QueryString("mobile");
                string       qq      = MyCommFun.QueryString("qq");
                string       linkman = MyCommFun.QueryString("linkman");
                string       email   = MyCommFun.QueryString("email");
                string       company = MyCommFun.QueryString("company");

                try
                {
                    Model.wx_zh_gz gzModel = new Model.wx_zh_gz
                    {
                        company_name = company,
                        tel          = tel,
                        createdate   = DateTime.Now,
                        fax          = fax,
                        linkman      = linkman,
                        mobile       = mobile,
                        qq           = qq,
                        email        = email
                    };

                    string gzid = gzBll.Add(gzModel).ToString();
                    MyCommFun.setCookie("gz_id", gzid, 30);
                    jsondict.Add("res", "1");
                    jsondict.Add("content", gzid);
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
                catch (Exception)
                {
                    jsondict.Add("res", "0");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
            }
            #endregion

            #region 注册展商信息
            if (_action == "addZs")
            {
                BLL.wx_zh_zs zsBll   = new BLL.wx_zh_zs();
                string       tel     = MyCommFun.QueryString("tel");
                string       fax     = MyCommFun.QueryString("fax");
                string       mobile  = MyCommFun.QueryString("mobile");
                string       qq      = MyCommFun.QueryString("qq");
                string       linkman = MyCommFun.QueryString("linkman");
                string       email   = MyCommFun.QueryString("email");
                string       company = MyCommFun.QueryString("company");
                string       type    = MyCommFun.QueryString("type");
                string       area    = MyCommFun.QueryString("area");

                try
                {
                    Model.wx_zh_zs zsModel = new Model.wx_zh_zs
                    {
                        company_name = company,
                        tel          = tel,
                        createdate   = DateTime.Now,
                        fax          = fax,
                        linkman      = linkman,
                        mobile       = mobile,
                        qq           = qq,
                        email        = email,
                        sq_area      = area,
                        type         = type
                    };

                    string zsid = zsBll.Add(zsModel).ToString();
                    MyCommFun.setCookie("zs_id", zsid, 30);
                    jsondict.Add("res", "1");
                    jsondict.Add("content", zsid);
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
                catch (Exception)
                {
                    jsondict.Add("res", "0");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
            }
            #endregion

            if (_action == "getqrcode")
            {
                #region 生成二维码
                //if (Request["chl"] == null) { return; }
                //string url = "http://" + HttpContext.Current.Request.Url.Authority + "/weixin/ucard/checkFX.aspx?" + Request["chl"].ToString().Replace("_", "&");
                string url = MyCommFun.getWebSite() + "/weixin/zhanhui/gzReg_ret.aspx";

                //创建二维码生成类
                QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
                try
                {
                    qrCodeEncoder.QRCodeScale = 4;
                }
                catch { }
                String data = url;
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                qrCodeEncoder.QRCodeBackgroundColor = System.Drawing.Color.White; //背景颜色
                // qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC;
                qrCodeEncoder.QRCodeForegroundColor = System.Drawing.Color.Black; //图像颜色
                //设置编码版本
                qrCodeEncoder.QRCodeVersion = 0;

                System.Drawing.Image myimg = qrCodeEncoder.Encode(data, System.Text.Encoding.UTF8); //kedee 增加utf-8编码,可支持中文汉字
                myimg.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
                context.Response.ClearContent();
                context.Response.ContentType = "image/Gif";
                context.Response.BinaryWrite(ms.ToArray());
                context.Response.End();
                #endregion
            }
        }
Ejemplo n.º 15
0
        public void ProcessRequest(HttpContext context)
        {
            Model.HG.A_HG_new_order Str = new Model.HG.A_HG_new_order();

            BLL.HG.Hg_list add = new BLL.HG.Hg_list();
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            jsonDict = new Dictionary <string, string>();
            string case_ = context.Request.QueryString["case_"];

            if (case_ == "save")
            {
                //  string openid=context.Request.QueryString["openid"];
                string name      = context.Request.QueryString["name"];
                string phone     = context.Request.QueryString["phone"];
                string sex       = context.Request.QueryString["sex"];
                string money     = context.Request.QueryString["money"];
                string type_     = context.Request.QueryString["type_"];
                string time      = context.Request.QueryString["time"];
                string day       = context.Request.QueryString["day"];
                string adress    = context.Request.QueryString["adress"];
                string weixiname = context.Request.QueryString["weixinname"];
                string openid    = context.Request.QueryString["openid"];
                //   string total=context.Request.QueryString["total"];
                //   Str.Openid_ = openid;
                Str.Name_       = name;
                Str.Tel_        = phone;
                Str.Sex_        = sex;
                Str.Pick_many   = money;
                Str.Type_       = type_;
                Str.Time_       = time;
                Str.start_time  = DateTime.Now.ToString();//开始时间
                Str.Pick_day    = day;
                Str.Weixin_name = weixiname;
                Str.Openid_     = openid;
                int day_   = int.Parse(day);
                int money_ = int.Parse(money);
                int total_ = day_ * money_;
                Str.total = total_.ToString();
                string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号
                Str.Order_dd   = bb;
                Str.Order_from = "小程序";
                Str.Fw_zt      = "未支付";
                Str.Delet_     = "未删除";
                Str.Adress     = adress;
                int fal = add.Add_order_new(Str);
                //   Str.total = total;
                if (fal == 0)
                {
                    jsonDict.Add("order_dd", bb);
                    jsonDict.Add("errCode", "false");
                    jsonDict.Add("recontent", fal.ToString());
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("order_dd", bb);
                    jsonDict.Add("errCode", "true");
                    jsonDict.Add("recontent", fal.ToString());
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
            else if (case_ == "jujia")
            {
                {
                    //  string openid=context.Request.QueryString["openid"];
                    string name      = context.Request.QueryString["name"];
                    string phone     = context.Request.QueryString["phone"];
                    string sex       = context.Request.QueryString["sex"];
                    string money     = context.Request.QueryString["money"];
                    string type_     = context.Request.QueryString["type_"];
                    string time      = context.Request.QueryString["time"];
                    string day       = context.Request.QueryString["day"];
                    string adress    = context.Request.QueryString["adress"];
                    string weixiname = context.Request.QueryString["weixinname"];
                    string openid    = context.Request.QueryString["openid"];
                    //   string total=context.Request.QueryString["total"];
                    //   Str.Openid_ = openid;
                    Str.Name_       = name;
                    Str.Tel_        = phone;
                    Str.Sex_        = sex;
                    Str.Pick_many   = money;
                    Str.Type_       = type_;
                    Str.Time_       = time;
                    Str.start_time  = DateTime.Now.ToString();//开始时间
                    Str.Pick_day    = day;
                    Str.Weixin_name = weixiname;
                    Str.Openid_     = openid;

                    Str.total = money;
                    string bb = DateTime.Now.Day.ToString() + GuidTo16String();//生成的订单号
                    Str.Order_dd   = bb;
                    Str.Order_from = "小程序";
                    Str.Fw_zt      = "未支付";
                    Str.Delet_     = "未删除";
                    Str.Adress     = adress;
                    int fal = add.Add_order_new(Str);
                    //   Str.total = total;
                    if (fal == 0)
                    {
                        jsonDict.Add("order_dd", bb);
                        jsonDict.Add("errCode", "false");
                        jsonDict.Add("recontent", fal.ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                    else
                    {
                        jsonDict.Add("order_dd", bb);
                        jsonDict.Add("errCode", "true");
                        jsonDict.Add("recontent", fal.ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                }
            }
            else if (case_ == "order")
            {
                string openid = context.Request.QueryString["openid"];
                context.Response.ContentType = "text/json";
                context.Response.Write(MyCommFun.GetJsonByDataset(order_new(openid)));
            }
            else
            {
                order_dd = MyCommFun.QueryString("order");
                BLL.HG.Hg_list          order_T = new BLL.HG.Hg_list();
                Model.HG.A_HG_new_order model   = order_T.getorder(order_dd);
                string timeStamp = "";
                string nonceStr  = "";
                string paySign   = "";
                //创建支付应答对象
                Senparc.Weixin.MP.TenPayLibV3.RequestHandler packageReqHandler = new Senparc.Weixin.MP.TenPayLibV3.RequestHandler(null);
                //初始化
                packageReqHandler.Init();

                timeStamp = TenPayV3Util.GetTimestamp();
                nonceStr  = TenPayV3Util.GetNoncestr();

                //设置package订单参数
                packageReqHandler.SetParameter("appid", "wx16650bedd9b0916a");                                                                  //公众账号ID
                packageReqHandler.SetParameter("mch_id", "1403543902");                                                                         //商户号
                packageReqHandler.SetParameter("nonce_str", nonceStr);                                                                          //随机字符串
                packageReqHandler.SetParameter("body", model.Name_ + "服务");                                                                     //商品信息
                packageReqHandler.SetParameter("out_trade_no", order_dd);                                                                       //商家订单号
                packageReqHandler.SetParameter("total_fee", ((double.Parse(model.total)) * 100).ToString());                                    //商品金额,以分为单位(money * 100).ToString()
                packageReqHandler.SetParameter("spbill_create_ip", context.Request.UserHostAddress);                                            //用户的公网ip,不是商户服务器IP
                packageReqHandler.SetParameter("notify_url", MyCommFun.getWebSite() + "/api/wxpay/notify_url.aspx?wid=" + 44 + "|" + order_dd); //接收财付通通知的URL
                packageReqHandler.SetParameter("trade_type", TenPayV3Type.JSAPI.ToString());                                                    //交易类型
                packageReqHandler.SetParameter("openid", model.Openid_);                                                                        //用户的openId

                string sign = packageReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q");
                packageReqHandler.SetParameter("sign", sign);                       //签名
                string data = packageReqHandler.ParseXML();


                var      result = TenPayV3.Unifiedorder(data);
                DateTime bb111  = new DateTime();
                WriteTextLog(bb111, result);
                var    res      = XDocument.Parse(result);
                string prepayId = res.Element("xml").Element("prepay_id").Value;

                //设置支付参数
                RequestHandler paySignReqHandler = new RequestHandler(null);
                paySignReqHandler.SetParameter("appId", "wx16650bedd9b0916a");
                paySignReqHandler.SetParameter("timeStamp", timeStamp);
                paySignReqHandler.SetParameter("nonceStr", nonceStr);
                paySignReqHandler.SetParameter("package", string.Format("prepay_id={0}", prepayId));
                paySignReqHandler.SetParameter("signType", "MD5");
                paySign         = paySignReqHandler.CreateMd5Sign("key", "70OvzuXGLFP7539B9zbvEMUBd1H1Tv8Q");
                payaddid        = "";
                paytimeStamp    = timeStamp;
                paynonceStr     = nonceStr;
                paypackageValue = string.Format("prepay_id={0}", prepayId);
                paypaySign      = paySign;
                litDate         = DateTime.Now.ToString();
                oreder_name     = model.Name_ + "服务预约";
                context.Response.ContentType = "text/json";
                pay_ bb = new pay_
                {
                    timeStamp = timeStamp,
                    nonceStr  = nonceStr,
                    paySign   = paySign,
                    signType  = "MD5",
                    package   = prepayId
                };
                string json_bill = JsonMapper.ToJson(bb);
                context.Response.Write(json_bill);
            }
        }
Ejemplo n.º 16
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            string _action = MyCommFun.QueryString("myact");

            if (_action == "uploadImg")
            {
                #region 图片上传
                try
                {
                    string uploadFileRet             = UpLoadFile(context);
                    Dictionary <string, object> dict = MyCommFun.JsonToDictionary(uploadFileRet);

                    if (dict["status"].ToString() == "0")
                    {
                        //上传失败
                        jsonDict.Add("res", "0");
                        jsonDict.Add("content", dict["msg"].ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                    else if (dict["status"].ToString() == "1")
                    {
                        //上传成功,修改用户的头像url
                        jsonDict.Add("res", "1");
                        jsonDict.Add("thumb", dict["thumb"].ToString());
                        jsonDict.Add("newPhotoUrl", dict["path"].ToString());
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }
                catch (Exception e)
                {
                    //上传失败
                    jsonDict.Add("res", "0");
                    jsonDict.Add("content", e.Message);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                #endregion
            }

            if (_action == "getAm")
            {
                int iid = MyCommFun.RequestInt("iid");
                BLL.wx_mz_animate amBll = new BLL.wx_mz_animate();
                BLL.wx_mz_img     iBll  = new BLL.wx_mz_img();
                try
                {
                    string  mzimg = iBll.GetModel(iid).url;
                    DataSet ds    = amBll.GetList("iid=" + iid);
                    if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder("{\"res\":1,\"content\":[");
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            DataRow dr = ds.Tables[0].Rows[i];
                            sb.Append("{");
                            sb.Append("\"id\":" + dr["id"] + ",");
                            sb.Append("\"width\":" + dr["width"] + ",");
                            sb.Append("\"height\":" + dr["height"] + ",");
                            sb.Append("\"x_lc\":" + dr["x_loaction"] + ",");
                            sb.Append("\"y_lc\":" + dr["y_location"] + ",");
                            sb.Append("\"img\":\"" + dr["animate_img"] + "\",");
                            sb.Append("\"type\":\"" + dr["animate_type"] + "\",");
                            sb.Append("\"s_sec\":" + dr["start_seconds"] + ",");
                            sb.Append("\"c_sec\":" + dr["continue_seconds"]);
                            sb.Append("},");
                        }
                        sb.Remove(sb.Length - 1, 1);
                        sb.Append("],\"img\":\"" + mzimg + "\"}");
                        context.Response.Write(sb.ToString());
                        return;
                    }
                    else
                    {
                        context.Response.Write("{\"res\":2,\"img\":\"" + mzimg + "\"}");
                        return;
                    }
                }
                catch (Exception)
                {
                    context.Response.Write("{\"res\":0}");
                    return;
                }
            }
        }
Ejemplo n.º 17
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string openid = MyCommFun.QueryString("openid");//openid
            int    bid    = MyCommFun.RequestInt("id");
            string tel    = MyCommFun.QueryString("telephone");
            string name   = MyCommFun.QueryString("userName");

            string type = MyCommFun.QueryString("type");
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (type == "bm")
            {
                int renshu = MyCommFun.RequestInt("count");
                //报名参与婚礼
                BLL.wx_xt_user   ubll = new BLL.wx_xt_user();
                Model.wx_xt_user user = new Model.wx_xt_user();
                user.bId        = bid;
                user.openid     = openid;
                user.phone      = tel;
                user.uName      = name;
                user.pNum       = renshu;
                user.createDate = DateTime.Now;
                int ret = ubll.Add(user);
                if (ret > 0)
                {
                    jsonDict.Add("ret", "报名成功!");
                }
                else
                {
                    jsonDict.Add("ret", "报名失败,请重新报名!");
                }

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
            else if (type == "zf")
            {
                string content = MyCommFun.QueryString("content");

                //祝福语
                BLL.wx_xt_zhufu   zbll = new BLL.wx_xt_zhufu();
                Model.wx_xt_zhufu zf   = new Model.wx_xt_zhufu();
                zf.message    = content;
                zf.openid     = openid;
                zf.phone      = tel;
                zf.uName      = name;
                zf.createDate = DateTime.Now;
                zf.bId        = bid;

                int ret = zbll.Add(zf);
                if (ret > 0)
                {
                    jsonDict.Add("ret", "评论成功!");
                }
                else
                {
                    jsonDict.Add("ret", "评论失败,请重新评论!");
                }

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }
Ejemplo n.º 18
0
        public void ProcessRequest(HttpContext context)
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");

            BLL.wx_hotel_dingdan   dingdanbll = new BLL.wx_hotel_dingdan();
            Model.wx_hotel_dingdan dingdan    = new Model.wx_hotel_dingdan();

            if (_action == "dingdan")
            {
                var isSuccess = this.CreateOrderProcess();

                if (isSuccess)
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                }
                else
                {
                    jsonDict.Add("ret", "err");
                    jsonDict.Add("content", "创建订单失败");
                }
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "dingdanedite")
            {
                dingdan.id       = MyCommFun.RequestInt("dingdanidnum");
                dingdan.oderName = MyCommFun.QueryString("truename");
                dingdan.tel      = MyCommFun.QueryString("tel");

                if (Convert.ToDateTime(MyCommFun.QueryString("arriveTime")) < DateTime.Now.AddDays(-1))
                {
                    jsonDict.Add("ret", "faile");
                    jsonDict.Add("content", "入住时间不能小于今天时间!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (MyCommFun.QueryString("arriveTime") != "")
                {
                    dingdan.arriveTime = Convert.ToDateTime(MyCommFun.QueryString("arriveTime"));
                }

                if (Convert.ToDateTime(MyCommFun.QueryString("leaveTime")) < dingdan.arriveTime)
                {
                    jsonDict.Add("ret", "faile");
                    jsonDict.Add("content", "离店时间不能小于入住时间!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (MyCommFun.QueryString("leaveTime") != "")
                {
                    dingdan.leaveTime = Convert.ToDateTime(MyCommFun.QueryString("leaveTime"));
                }



                dingdan.orderNum       = MyCommFun.RequestInt("nums");
                dingdan.price          = Convert.ToDecimal(MyCommFun.QueryString("xianjianum"));
                dingdan.yuanjia        = Convert.ToDecimal(MyCommFun.QueryString("yuanjianum"));
                dingdan.remark         = MyCommFun.QueryString("info");
                dingdan.IdentityNumber = MyCommFun.QueryString("identityNumber");
                dingdanbll.Updatehotel(dingdan);

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "修改成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "dingdandelete")
            {
                //                int ddid = MyCommFun.RequestInt("dingdanidnum");
                //                dingdanbll.Update(ddid);
                //                jsonDict.Add("ret", "ok");
                //                jsonDict.Add("content", "删除成功!");
                //                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                UpdateOrder(dingdanbll, jsonDict, context, HotelStatusManager.OrderStatus.Cancelled.StatusId, "订单取消成功!");
            }
            if (_action == "dingdancompleted")
            {
                //                int ddid = MyCommFun.RequestInt("dingdanidnum");
                //                dingdanbll.Update(ddid);
                //                jsonDict.Add("ret", "ok");
                //                jsonDict.Add("content", "删除成功!");
                //                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                UpdateOrder(dingdanbll, jsonDict, context, HotelStatusManager.OrderStatus.Completed.StatusId, "操作成功!");
            }
            //            if (_action == "paymentSuccess")
            //            {
            //                int ddid = MyCommFun.RequestInt("dingdanidnum");
            //                dingdanbll.Update(ddid, "3");
            //                jsonDict.Add("ret", "ok");
            //                jsonDict.Add("content", "订单支付成功!");
            //                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            //                return;
            //            }


            //            if (_action == "dingdanPayed")
            //            {
            //                UpdateOrder(dingdanbll, jsonDict, context, StatusManager.OrderStatus.Payed.StatusId, "订单支付成功!");
            //            }

            if (_action == "dingdanPaying")
            {
                GetPayUrl(dingdanbll, context);
            }
        }
Ejemplo n.º 19
0
        public void userinfoAdd()
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            //取值
            int?   wid     = MyCommFun.RequestInt("wid", 0);
            int    aid     = MyCommFun.RequestInt("aid");
            string openid  = MyCommFun.RequestOpenid();
            string atitle  = MyCommFun.QueryString("atitle");
            string usersum = MyCommFun.QueryString("usersum");
            bool   ISnum   = true;

            if (wid == 0 || aid == 0 || openid == "" || usersum == "")
            {
                jsonDict.Add("re", "err");
                jsonDict.Add("content", "参数错误!");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            BLL.wx_dati_user userBLL = new BLL.wx_dati_user();
            // Model.wx_dati_user usermodel = userBLL.GetModel(" openid='" + openid + "' ");
            int getcont = userBLL.GetRecordCount(" openid='" + openid + "' ");

            if (getcont == 3)
            {
                jsonDict.Add("re", "err");
                jsonDict.Add("content", "你已参加过了");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            int sy = 2 - getcont;


            BLL.wx_dati_base   baseBLL   = new BLL.wx_dati_base();
            Model.wx_dati_base baseModel = baseBLL.GetModel(aid);
            int?jf     = 0;
            int jftype = baseModel.jftype;
            int jfval  = baseModel.jfval;

            if (jftype == 0)
            {
                jf = 0;
            }
            else if (jftype == 1)
            {
                jf = jfval;
            }
            else if (jftype == 2)
            {
                jf = int.Parse(usersum);
            }
            BLL.wx_dati_user   dxBLL   = new BLL.wx_dati_user();
            Model.wx_dati_user dxmodel = new Model.wx_dati_user();
            dxmodel.wid     = wid;
            dxmodel.openid  = openid;
            dxmodel.aid     = aid;
            dxmodel.atitle  = atitle;
            dxmodel.usersum = usersum;
            dxmodel.score   = jf;
            dxmodel.addtime = DateTime.Now;
            dxBLL.Add(dxmodel);
            //得分
            if (jf == 5)
            {
                jsonDict.Add("re", "OK");
                jsonDict.Add("cjscore", jf.ToString());
                jsonDict.Add("content", "你获得了一次红包机会!");
                jsonDict.Add("isnum", "false");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
            else
            {
                jsonDict.Add("re", "OK");
                jsonDict.Add("cjscore", jf.ToString());
                jsonDict.Add("content", "答卷提交成功!(" + sy + ")次机会");
                jsonDict.Add("isnum", "true");
                content.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
        }
Ejemplo n.º 20
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            string openid  = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();
            int sid = MyCommFun.RequestInt("sid");
            int uid = 0;

            BLL.wx_ucard_store               storeBll = new BLL.wx_ucard_store();
            BLL.wx_ucard_users_consumeinfo   conBll   = new BLL.wx_ucard_users_consumeinfo();
            BLL.wx_ucard_score               scoreBll = new BLL.wx_ucard_score();
            BLL.wx_ucard_users               userBll  = new BLL.wx_ucard_users();
            Model.wx_ucard_users_consumeinfo consume  = new Model.wx_ucard_users_consumeinfo();
            Model.wx_ucard_score             score    = new Model.wx_ucard_score();
            Model.wx_ucard_store             store    = storeBll.GetModel(sid);
            if (store == null)
            {
                jsonDict.Add("ret", "err");
                jsonDict.Add("msg", "店铺不存在");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "userreg")
            {
                #region //用户第一次领取卡
                jsonDict = new Dictionary <string, string>();

                if (sid == 0)
                {
                    jsonDict.Add("ret", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                string tel      = MyCommFun.QueryString("tel");
                string realName = MyCommFun.QueryString("truename");

                XCWeiXin.Model.wx_ucard_users user = userBll.GetStoreUserInfo(openid, sid);
                if (user == null)
                { //第一次添加
                    user              = new Model.wx_ucard_users();
                    user.mobile       = tel;
                    user.realName     = realName;
                    user.regTime      = DateTime.Now;
                    user.sid          = sid;
                    user.openid       = openid;
                    user.ttScore      = 0;
                    user.consumeScore = 0;
                    user.qdScore      = 0;
                    user.consumeMoney = 0;
                    user.regIp        = MXRequest.GetIP();
                    int ret = userBll.Add(user);
                    if (ret > 0)
                    {
                        jsonDict.Add("ret", "succ");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                    else
                    {
                        jsonDict.Add("ret", "err");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                }
                else
                {
                    user.mobile   = tel;
                    user.realName = realName;
                    user.regTime  = DateTime.Now;
                    user.sid      = sid;
                    user.openid   = openid;
                    user.regIp    = MXRequest.GetIP();
                    bool ret = userBll.Update(user);
                    if (ret)
                    {
                        jsonDict.Add("ret", "succ");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                    else
                    {
                        jsonDict.Add("ret", "err");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    }
                }

                context.Response.End();
                #endregion
            }
            else if (_action == "qiandao")
            {
                #region 签到
                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid");
                uid      = MyCommFun.RequestInt("uid");
                if (sid == 0 || uid == 0)
                {
                    jsonDict.Add("ret", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                bool hasqd    = conBll.hasDayQD(sid, uid, DateTime.Now);
                int  retScore = 0;
                if (!hasqd)
                {
                    //新增
                    //取签到积分策略
                    score = scoreBll.GetStoreModel(sid);
                    if (score != null)
                    {
                        //判断是否6天连续签到,并且6天内没有给额外的奖励

                        DateTime day6before = DateTime.Now.AddDays(-6);

                        int record = conBll.GetRecordCount("sId=" + sid + " and uid=" + uid + " and moduleType='签到' and addTime>='" + day6before.ToShortDateString() + "' and addTime<'" + DateTime.Now.ToShortDateString() + "' and  moduleActionId=6 ");

                        if (record >= 5)
                        {
                            consume                  = new Model.wx_ucard_users_consumeinfo();
                            consume.sId              = sid;
                            consume.uid              = uid;
                            consume.moduleType       = "签到";
                            consume.moduleActionName = "连续6天签到奖励";
                            consume.moduleActionId   = 6;
                            consume.score            = MyCommFun.Obj2Int(score.qiandao6Score) + score.qiandaoScore.Value;
                            conBll.AddJiFen(consume, 0);
                            retScore = MyCommFun.Obj2Int(score.qiandao6Score) + score.qiandaoScore.Value;
                        }
                        else
                        {
                            consume            = new Model.wx_ucard_users_consumeinfo();
                            consume.sId        = sid;
                            consume.uid        = uid;
                            consume.moduleType = "签到";
                            consume.score      = score.qiandaoScore.Value;
                            conBll.AddJiFen(consume, 0);
                            retScore = score.qiandaoScore.Value;
                        }
                    }
                }

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "+" + retScore + "分,明天继续");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                #endregion
            }
            else if (_action == "tequan")
            {
                #region  //消费: 特权 ,注意,只有在新增这个的时候记录user表总积分,修改的时候 对user表的总积分和金额先减后加

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn    = MyCommFun.QueryString("sncode");
                string pwd   = MyCommFun.QueryString("parssword");
                float  money = MyCommFun.RequestFloat("money", 0);
                int    pid   = MyCommFun.RequestInt("pid");   //特权主键id
                string type  = MyCommFun.QueryString("type"); //tequan:特权
                if (sid == 0 || uid == 0 || pid == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_privileges   privBll    = new BLL.wx_ucard_privileges();
                Model.wx_ucard_privileges privileges = privBll.GetModel(pid);
                if (privileges == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "特权不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //积分策略
                score = scoreBll.GetStoreModel(sid);
                int avgScore = score.consumeMoneyScore.Value / score.consumeMoney.Value;
                //1先添加消费明细,和修改用户的总积分和总消费金额
                //IList<Model.wx_ucard_users_consumeinfo> conlist = conBll.GetModelList("moduleType='特权' and moduleActionId=" + privileges.id + " and sid=" + sid + " and uid=" + uid);
                //if (conlist == null || conlist.Count <= 0 || conlist[0] == null)
                //{
                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "特权";
                consume.moduleActionId   = privileges.id;
                consume.moduleActionName = privileges.pName;
                consume.sId          = sid;
                consume.uid          = uid;
                consume.consumeMoney = (decimal)money;
                consume.addTime      = DateTime.Now;
                consume.sn           = sn;
                consume.pwd          = pwd;
                consume.cMoneyType   = 2;
                consume.score        = (int)(avgScore * money);
                consume.cScoreType   = 1;
                conBll.Add(consume, true);

                //}
                //else
                //{
                //    //修改
                //    consume = conlist[0];
                //    decimal oldMoney = MyCommFun.Obj2Decimal(consume.consumeMoney, 0);
                //    int oldScore = MyCommFun.Obj2Int(consume.score);


                //    consume.moduleActionName = privileges.pName;
                //    consume.consumeMoney = (decimal)money;
                //    consume.sn = sn;
                //    consume.pwd = pwd;
                //    consume.cMoneyType = 2;
                //    consume.score = (int)(avgScore * money);
                //    conBll.UpdateInfoAndUserTT(consume, oldMoney, oldScore);
                //}
                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "获得" + consume.score.Value + "积分 ");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                #endregion
            }
            else if (_action == "lq_yhq")
            {
                #region 领取优惠券

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn       = MyCommFun.QueryString("sncode");
                string pwd      = MyCommFun.QueryString("parssword");
                float  money    = MyCommFun.RequestFloat("money", 0);
                int    ticketId = MyCommFun.RequestInt("cid");//优惠券主键id

                if (sid == 0 || uid == 0 || ticketId == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_ticket   ticketBll = new BLL.wx_ucard_ticket();
                Model.wx_ucard_ticket ticket    = ticketBll.GetModel(ticketId);
                if (ticket == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "优惠券不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int syTimes = ticketBll.getsyTimesByTicket(uid, ticketId);
                if (syTimes <= 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "已没有使用次数");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //积分策略
                score = scoreBll.GetStoreModel(sid);
                int avgScore = score.consumeMoneyScore.Value / score.consumeMoney.Value;
                //1先添加消费明细,和修改用户的总积分和总消费金额

                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "优惠券";
                consume.moduleActionId   = ticket.id;
                consume.moduleActionName = ticket.tName;
                consume.sId          = sid;
                consume.uid          = uid;
                consume.consumeMoney = (decimal)money;
                consume.addTime      = DateTime.Now;
                consume.sn           = sn;
                consume.pwd          = pwd;
                consume.cMoneyType   = 2;
                consume.score        = (int)(avgScore * money);
                consume.cScoreType   = 1;
                conBll.Add(consume, true);
                syTimes -= 1;

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "获得" + consume.score.Value + "积分 ");
                jsonDict.Add("sy", syTimes.ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
            else if (_action == "gift")
            {
                #region 兑换礼品券

                jsonDict = new Dictionary <string, string>();
                sid      = MyCommFun.RequestInt("sid"); //店铺id
                uid      = MyCommFun.RequestInt("uid"); //用户id
                string sn     = MyCommFun.QueryString("sncode");
                string pwd    = MyCommFun.QueryString("parssword");
                float  money  = MyCommFun.RequestFloat("money", 0);
                int    giftId = MyCommFun.RequestInt("gid");//礼品主键id

                if (sid == 0 || uid == 0 || giftId == 0)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "error");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (pwd != store.consumePwd)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "密码错误");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int ssid = userBll.ExistsStoreAndUser(uid);
                if (ssid == 0 || sid != ssid)
                {  //验证,用户存在,店铺存在,并且用户属于这个店铺
                    return;
                }
                BLL.wx_ucard_gift   giftBll = new BLL.wx_ucard_gift();
                Model.wx_ucard_gift gift    = giftBll.GetModel(giftId);
                if (gift == null)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "优惠券不存在");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                int userTTScore = userBll.GetUserJiFen(uid);
                if (userTTScore < gift.score.Value)
                {
                    jsonDict.Add("ret", "error");
                    jsonDict.Add("msg", "积分不够");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                //1先添加消费明细,和修改用户的总积分和总消费金额

                //新增
                consume = new Model.wx_ucard_users_consumeinfo();
                consume.moduleActionId   = 10;
                consume.moduleType       = "礼品券";
                consume.moduleActionId   = gift.id;
                consume.moduleActionName = gift.gName;
                consume.sId        = sid;
                consume.uid        = uid;
                consume.addTime    = DateTime.Now;
                consume.sn         = sn;
                consume.pwd        = pwd;
                consume.score      = -gift.score.Value;
                consume.cScoreType = 1;
                conBll.Add(consume, false);

                jsonDict.Add("ret", "succ");
                jsonDict.Add("msg", "成功兑换礼品扣除 " + gift.score.Value + " 积分 ");

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                #endregion
            }
        }
Ejemplo n.º 21
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            BLL.wx_shop_cart            cartBll  = new BLL.wx_shop_cart();
            string                      _action  = MyCommFun.QueryString("myact");
            string                      openid   = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (_action == "addCart")
            {
                #region 添加购物车
                try
                {
                    int     wid        = MyCommFun.RequestInt("wid");
                    int     productId  = MyCommFun.RequestInt("productid");
                    int     skuId      = MyCommFun.RequestInt("mid");
                    string  skuInfo    = MyCommFun.QueryString("attr");
                    int     productNum = MyCommFun.RequestInt("bc");
                    decimal totalPrice = (decimal)MyCommFun.RequestFloat("totprice", 0);

                    Model.wx_shop_cart cart = new Model.wx_shop_cart();

                    IList <Model.wx_shop_cart> cartList = cartBll.GetModelList("productId=" + productId + " and openid='" + openid + "' and skuId=" + skuId);
                    bool isAdd = true;
                    if (cartList != null && cartList.Count > 0)
                    {
                        isAdd = false;
                        cart  = cartList[0];
                    }
                    if (isAdd)
                    {
                        cart.createDate = DateTime.Now;
                        cart.openid     = openid;
                        cart.productId  = productId;
                        cart.productNum = productNum;
                        cart.skuId      = skuId;
                        cart.skuInfo    = skuInfo;
                        cart.totPrice   = totalPrice * productNum;
                        cart.wid        = wid;
                        int ret = cartBll.Add(cart);
                        if (ret > 0)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }
                    else
                    {
                        cart.openid = openid;

                        cart.productNum += productNum;
                        cart.skuId       = skuId;
                        cart.skuInfo     = skuInfo;
                        cart.totPrice   += totalPrice * productNum;
                        cart.wid         = wid;
                        bool ret = cartBll.Update(cart);
                        if (ret)
                        {
                            jsonDict.Add("errCode", "false");
                        }
                        else
                        {
                            jsonDict.Add("errCode", "true");
                        }
                    }
                }
                catch (Exception ex)
                {
                    jsonDict.Add("errCode", "true");
                }
                finally
                {
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                #endregion
            }
            else if (_action == "pcount")
            {
                #region 购物车商品数量
                jsonDict = new Dictionary <string, string>();
                int wid   = MyCommFun.RequestInt("wid");
                int count = cartBll.GetRecordCount("wid=" + wid + " and openid='" + openid + "'");
                jsonDict.Add("data", count.ToString());
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "remove")
            {
                #region 移除购物车商品
                jsonDict = new Dictionary <string, string>();
                int cartId = MyCommFun.RequestInt("id");
                cartBll.Delete(cartId);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "modifyNum")
            {
                #region 修改购物车商品数量
                jsonDict = new Dictionary <string, string>();
                int cartId = MyCommFun.RequestInt("ic");
                int newNum = MyCommFun.RequestInt("bc");
                cartBll.UpdateNum(cartId, newNum);
                jsonDict.Add("errCode", "false");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
            else if (_action == "getCity")
            {
                #region  择省份,改变城市列表
                int privice = MyCommFun.RequestInt("pvid");
                BLL.pre_common_district           areaBll = new BLL.pre_common_district();
                IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + privice + " and level=2");
                Model.pre_common_district         dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "getArea")
            {
                #region  择城市,改变区域列表
                int ctid = MyCommFun.RequestInt("ctid");
                BLL.pre_common_district           areaBll = new BLL.pre_common_district();
                IList <Model.pre_common_district> disList = areaBll.GetModelList("upid=" + ctid + " and level=3");
                Model.pre_common_district         dis;
                StringBuilder jsonStr = new StringBuilder("{\"errCode\":0,\"retCode\":0,\"msgType\":0,\"errMsg\":\"\",\"data\":[");
                for (int i = 0; i < disList.Count; i++)
                {
                    dis = new Model.pre_common_district();
                    if (i != disList.Count - 1)
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"},");
                    }
                    else
                    {
                        jsonStr.Append("{\"id\":" + disList[i].id + ",\"name\":\"" + disList[i].name + "\"}");
                    }
                }
                jsonStr.Append("]}");
                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "order_save")
            {
                #region 保存订单信息
                //获得传参信息
                int wid = MyCommFun.RequestInt("wid");

                int payment_id = MyCommFun.RequestInt("pc");    //支付方式:1货到付款;3微支付
                int express_id = MyCommFun.RequestInt("mtype"); //物流方式
                // string orderStrList = MyCommFun.QueryString("orderStrList");

                //检查物流方式
                if (express_id == 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,请选择配送方式!\"}");
                    return;
                }
                BLL.wx_shop_user_addr           uAddrBll  = new BLL.wx_shop_user_addr();
                IList <Model.wx_shop_user_addr> uaddrList = uAddrBll.GetOpenidAddrName(openid, wid);
                if (uaddrList == null || uaddrList.Count <= 0 || uaddrList[0].id <= 0)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"收货地址不存在,无法结算!\"}");
                    return;
                }


                //检查购物车商品
                IList <Model.cartProduct> cartList = cartBll.GetCartList(openid, wid);
                if (cartList == null)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"对不起,购物车为空,无法结算!\"}");
                    return;
                }
                //统计购物车
                decimal payable_amount = cartList.Sum(c => c.totPrice);
                //物流费用
                BLL.express   expressBll = new BLL.express();
                Model.express expModel   = expressBll.GetModel(express_id);
                //支付方式
                BLL.payment   pbll     = new BLL.payment();
                Model.payment payModel = pbll.GetModelBypTypeId(payment_id);
                //保存订单=======================================================================
                Model.orders model = new Model.orders();
                model.order_no = "b" + Utils.GetOrderNumber(); //订单号B开头为商品订单

                model.wid             = wid;
                model.openid          = openid;
                model.modelName       = "微商城";
                model.modelCode       = "shop";
                model.modelActionName = "";
                model.modelActionId   = 0;
                model.user_id         = 0;
                model.user_name       = "";
                model.payment_id      = payment_id;
                model.express_id      = express_id;
                model.accept_name     = uaddrList[0].contractPerson;
                model.post_code       = "";
                model.telphone        = uaddrList[0].tel;
                model.mobile          = uaddrList[0].tel;
                model.area            = uaddrList[0].province;
                model.city            = uaddrList[0].city;
                model.district        = uaddrList[0].area;
                model.address         = uaddrList[0].province + " " + uaddrList[0].city + " " + uaddrList[0].area + " " + uaddrList[0].addrDetail;
                model.message         = "";
                model.payable_amount  = payable_amount; //应付商品总金额
                model.real_amount     = payable_amount; //实际商品总金额,
                model.status          = 1;
                model.express_status  = 1;
                model.express_fee     = expModel.express_fee; //物流费用

                if (payment_id == 1)
                {                             //货到付款,需要确认订单
                    model.payment_status = 0; //标记未付款
                }
                else
                {                             //先款后货
                    model.payment_status = 1; //标记未付款
                }
                bool quicklyFH = false;
                //如果是先款后货的话
                if (payment_id == 3)
                {
                    if (payModel.poundage_type == 1) //百分比
                    {
                        model.payment_fee = model.real_amount * payModel.poundage_amount / 100;
                    }
                    else //固定金额
                    {
                        model.payment_fee = payModel.poundage_amount;
                    }
                    BLL.wx_payment_wxpay   wxBll = new BLL.wx_payment_wxpay();
                    Model.wx_payment_wxpay wxpay = wxBll.GetModelByWid(wid);
                    quicklyFH = wxpay.quicklyFH;
                }
                if (quicklyFH)
                {
                    model.express_status = 0;
                }
                //订单总金额=实付商品金额+运费+支付手续费
                model.order_amount = model.real_amount + model.express_fee + model.payment_fee;
                //购物积分,可为负数
                model.point    = 0;
                model.add_time = DateTime.Now;
                //商品详细列表
                List <Model.order_goods> gls = new List <Model.order_goods>();
                foreach (Model.cartProduct item in cartList)
                {
                    gls.Add(new Model.order_goods {
                        goods_id = item.productId, goods_title = item.productName, goods_price = item.avgPrice, real_price = item.avgPrice, quantity = item.productNum, point = 0
                    });
                }
                model.order_goods = gls;
                int result = new BLL.orders().Add(model);
                if (result < 1)
                {
                    context.Response.Write("{\"errCode\":3, \"msg\":\"订单保存过程中发生错误,请重新提交!\"}");
                    return;
                }

                //清空购物车,此步骤移到确认支付页面
                //
                //提交成功,返回URL  order_no
                context.Response.Write("{\"errCode\":true,\"payType\":\"" + payment_id + "\", \"order_no\":\"" + model.order_no + "\",\"orderid\":\"" + result + "\",\"wid\":\"" + wid + "\",\"openid\":\"" + openid + "\",\"payable_amount\":\"" + payable_amount + "\", \"msg\":\"恭喜您,订单已成功提交!\"}");
                return;

                #endregion
            }
            else if (_action == "order_canel")
            {
                #region  //取消订单
                int        orderid = MyCommFun.RequestInt("order_id");
                BLL.orders oBll    = new BLL.orders();
                oBll.UpdateField(orderid, "status=4");
                context.Response.Write("{\"errCode\":true, \"msg\":\"订单已取消!\"}");
                #endregion
            }
            else if (_action == "shouhuo")
            {
                #region  //确认收货
                int          orderid = MyCommFun.RequestInt("order_id");
                BLL.orders   oBll    = new BLL.orders();
                Model.orders order   = oBll.GetModel(orderid);
                if (order.payment_id == 1)
                {
                    //货到付款
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }
                else
                {
                    //在线支付
                    oBll.UpdateField(orderid, "express_status=2,payment_status=2 , status=3");
                }

                context.Response.Write("{\"errCode\":true, \"msg\":\"确认收货!\"}");
                #endregion
            }
            else if (_action == "clearMyOrder")
            {
                #region 清空我的购物车订单,在支付页面,支付成功后执行此功能
                int wid = MyCommFun.RequestInt("wid");
                cartBll.RemoveCartInfo(wid, openid);
                #endregion
            }
        }
Ejemplo n.º 22
0
        public void ProcessRequest(HttpContext context)
        {
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");

            BLL.wx_hotel_dingdan   dingdanbll = new BLL.wx_hotel_dingdan();
            Model.wx_hotel_dingdan dingdan    = new Model.wx_hotel_dingdan();
            string hotelid  = MyCommFun.QueryString("hotelid");
            string roomid   = MyCommFun.QueryString("roomid");
            string openid   = MyCommFun.QueryString("openid");
            string oderName = MyCommFun.QueryString("oderName");
            string tel      = MyCommFun.QueryString("tel");


            if (_action == "dingdan")
            {
                dingdan.hotelid     = Convert.ToInt32(hotelid);
                dingdan.roomid      = Convert.ToInt32(roomid);
                dingdan.openid      = openid;
                dingdan.oderName    = oderName;
                dingdan.tel         = tel;
                dingdan.orderStatus = 0;


                if (Convert.ToDateTime(MyCommFun.QueryString("arriveTime")) < DateTime.Now.AddDays(-1))
                {
                    jsonDict.Add("ret", "faile");
                    jsonDict.Add("content", "入住时间不能小于今天时间!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (Convert.ToDateTime(MyCommFun.QueryString("arriveTime")) > Convert.ToDateTime(MyCommFun.QueryString("leaveTime")))
                {
                    jsonDict.Add("ret", "faile");
                    jsonDict.Add("content", "入住时间必须小于离店时间!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (MyCommFun.QueryString("arriveTime") != "")
                {
                    dingdan.arriveTime = Convert.ToDateTime(MyCommFun.QueryString("arriveTime"));
                }
                if (MyCommFun.QueryString("leaveTime") != "")
                {
                    dingdan.leaveTime = Convert.ToDateTime(MyCommFun.QueryString("leaveTime"));
                }
                dingdan.roomType  = MyCommFun.QueryString("roomType");
                dingdan.orderTime = DateTime.Now;
                dingdan.orderNum  = MyCommFun.RequestInt("orderNum");
                dingdan.isDelete  = 0;
                dingdan.price     = MyCommFun.Str2Decimal(MyCommFun.QueryString("price"));
                dingdan.yuanjia   = MyCommFun.Str2Decimal(MyCommFun.QueryString("yuanjia"));
                dingdan.remark    = MyCommFun.QueryString("remark");
                dingdanbll.Add(dingdan);

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "提交成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "dingdanedite")
            {
                dingdan.id       = MyCommFun.RequestInt("dingdanidnum");
                dingdan.oderName = MyCommFun.QueryString("truename");
                dingdan.tel      = MyCommFun.QueryString("tel");

                if (Convert.ToDateTime(MyCommFun.QueryString("dateline")) < DateTime.Now.AddDays(-1))
                {
                    jsonDict.Add("ret", "faile");
                    jsonDict.Add("content", "入住时间不能小于今天时间!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                if (MyCommFun.QueryString("dateline") != "")
                {
                    dingdan.arriveTime = Convert.ToDateTime(MyCommFun.QueryString("dateline"));
                }



                dingdan.orderNum = MyCommFun.RequestInt("nums");
                dingdan.price    = Convert.ToDecimal(MyCommFun.QueryString("xianjianum"));
                dingdan.yuanjia  = Convert.ToDecimal(MyCommFun.QueryString("yuanjianum"));
                dingdan.remark   = MyCommFun.QueryString("info");
                dingdanbll.Updatehotel(dingdan);

                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "修改成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }

            if (_action == "dingdandelete")
            {
                int ddid = MyCommFun.RequestInt("dingdanidnum");
                dingdanbll.Update(ddid);
                jsonDict.Add("ret", "ok");
                jsonDict.Add("content", "删除成功!");
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                return;
            }
        }
Ejemplo n.º 23
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MXRequest.GetQueryString("myact");

            #region 根据品牌得到车系
            if (action == "chexi")
            {
                BLL.wx_wq_chexi          cxBll  = new BLL.wx_wq_chexi();
                int                      pid    = MyCommFun.RequestInt("pid");
                int                      wid    = MyCommFun.RequestInt("wid");
                List <Model.wx_wq_chexi> cxList = cxBll.GetModelList(string.Format(" wid={0} and pid={1}", wid, pid));
                context.Response.Write(MyCommFun.SwitchToJson <Model.wx_wq_chexi>(cxList));
                return;
            }
            #endregion

            #region 根据车系得到车型
            if (action == "chexing")
            {
                BLL.wx_wq_chexing cxBll = new BLL.wx_wq_chexing();
                int xid = MyCommFun.RequestInt("xid");
                int wid = MyCommFun.RequestInt("wid");
                List <Model.wx_wq_chexing> cxList = cxBll.GetModelList(string.Format(" wid={0} and xid={1}", wid, xid));
                context.Response.Write(MyCommFun.SwitchToJson <Model.wx_wq_chexing>(cxList));
                return;
            }
            #endregion


            #region 添加预约订单
            if (action == "addorder")
            {
                Dictionary <string, string> jsondict = new Dictionary <string, string>();
                BLL.wx_wq_yyOrder           yoBll    = new BLL.wx_wq_yyOrder();
                Model.wx_wq_yyOrder         yoModel  = new Model.wx_wq_yyOrder();
                try
                {
                    int    wid    = MyCommFun.RequestInt("wid");
                    string name   = MyCommFun.QueryString("truename");
                    string openid = MyCommFun.QueryString("openid");
                    string tel    = MyCommFun.QueryString("tel");
                    string date   = MyCommFun.QueryString("dateline");
                    string part   = MyCommFun.QueryString("timepart");
                    string xid    = MyCommFun.QueryString("xid");
                    string pid    = MyCommFun.QueryString("pid");
                    int    type   = MyCommFun.RequestInt("type");
                    string carnum = MyCommFun.QueryString("carnum");
                    string km     = MyCommFun.QueryString("km");
                    string remark = MyCommFun.QueryString("info");
                    yoModel.Name       = name;
                    yoModel.remark     = remark;
                    yoModel.sort_id    = 99;
                    yoModel.telephone  = tel;
                    yoModel.xid        = MyCommFun.Str2Int(xid);
                    yoModel.pid        = MyCommFun.Str2Int(pid);
                    yoModel.wid        = wid;
                    yoModel.yid        = type;
                    yoModel.km         = MyCommFun.Str2Decimal(km);
                    yoModel.carnum     = carnum;
                    yoModel.yydate     = MyCommFun.Obj2DateTime(date);
                    yoModel.yytime     = part;
                    yoModel.openid     = openid;
                    yoModel.ddstatus   = "待回复";
                    yoModel.createdate = DateTime.Now;
                    int res = yoBll.Add(yoModel);
                    if (res < 1)
                    {
                        jsondict.Add("errno", "1");
                        context.Response.Write(MyCommFun.getJsonStr(jsondict));
                        return;
                    }
                    jsondict.Add("errno", "0");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
                catch (Exception)
                {
                    jsondict.Add("errno", "1");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
            }
            #endregion

            #region  除订单
            if (action == "delorder")
            {
                Dictionary <string, string> jsondict = new Dictionary <string, string>();
                int id  = MyCommFun.RequestInt("id");
                int wid = MyCommFun.RequestInt("wid");
                BLL.wx_wq_yyOrder yoBll = new BLL.wx_wq_yyOrder();
                yoBll.Delete(id);

                return;
            }
            #endregion

            if (action == "addChezhu")
            {
                Dictionary <string, string> jsondict = new Dictionary <string, string>();
                BLL.wx_wq_chezhu            czBll    = new BLL.wx_wq_chezhu();
                try
                {
                    int    pid           = MyCommFun.RequestInt("car_model");
                    int    wid           = MyCommFun.RequestInt("wid");
                    int    xid           = MyCommFun.RequestInt("car_type");
                    int    xingid        = MyCommFun.RequestInt("car_xing");
                    string car_no        = MyCommFun.QueryString("car_no");
                    string tel           = MyCommFun.QueryString("tel");
                    string car_userName  = MyCommFun.QueryString("car_userName");
                    string car_startTime = MyCommFun.QueryString("car_startTime");
                    string car_buyTime   = MyCommFun.QueryString("car_buyTime");
                    string openid        = MyCommFun.QueryString("openid");
                    int    res           = czBll.GetRecordCount(" openid='" + openid + "' and wid=" + wid);

                    Model.wx_wq_chezhu czModel = new Model.wx_wq_chezhu();
                    if (res > 0)
                    {
                        czModel = czBll.GetModelList(" openid='" + openid + "' and wid=" + wid)[0];
                    }
                    czModel.cpNum      = car_no;
                    czModel.cxingid    = xingid;
                    czModel.gcdate     = MyCommFun.Obj2DateTime(car_buyTime);
                    czModel.Name       = car_userName;
                    czModel.ppid       = pid;
                    czModel.cxid       = xid;
                    czModel.cxingid    = xingid;
                    czModel.spdate     = MyCommFun.Obj2DateTime(car_startTime);
                    czModel.teltephone = tel;
                    czModel.sort_id    = 99;
                    czModel.wid        = wid;
                    czModel.createdate = DateTime.Now;
                    czModel.openid     = openid;
                    if (res > 0)
                    {
                        czBll.Update(czModel);
                        jsondict.Add("content", "修改车主信息成功");
                        context.Response.Write(MyCommFun.getJsonStr(jsondict));
                        return;
                    }
                    else
                    {
                        czBll.Add(czModel);
                        jsondict.Add("content", "添加车主信息成功");
                        context.Response.Write(MyCommFun.getJsonStr(jsondict));
                        return;
                    }
                }
                catch (Exception)
                {
                    jsondict.Add("content", "操作失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }
            }
        }
Ejemplo n.º 24
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string action = MXRequest.GetQueryString("myact");
            int    wid    = MyCommFun.RequestInt("wid");
            string openid = MyCommFun.RequestOpenid();

            #region 添加印象
            if (action == "fyyx")
            {
                BLL.wx_fc_fyImpression      fBll     = new BLL.wx_fc_fyImpression();
                Dictionary <string, string> jsondict = new Dictionary <string, string>();
                string imp_user = MyCommFun.QueryString("imp_user");
                int    fid      = MyCommFun.RequestInt("fid");
                int    record   = fBll.GetRecordCount(" content='" + imp_user + "'");
                int    allrw    = fBll.GetRecordCount(" id>0 ");
                int    rep      = fBll.GetRecordCount(" openid='" + openid + "'");
                if (rep > 0)
                {
                    jsondict.Add("errno", "2");
                    jsondict.Add("res", "你已经添加过印象了");
                    context.Response.Write(MyCommFun.getJsonStr(jsondict));
                    return;
                }

                if (record > 0)//有过此类印象
                {
                    double re = (Convert.ToDouble(record) / allrw) * 100;
                    jsondict.Add("res", re.ToString() + "%");
                }
                else           //独特印象
                {
                    jsondict.Add("res", "1");
                }
                Model.wx_fc_fyImpression fModel = new Model.wx_fc_fyImpression();
                fModel.content    = imp_user;
                fModel.createDate = DateTime.Now;
                fModel.fid        = fid;
                fModel.openid     = openid;
                fModel.sort_id    = 1;
                fModel.wid        = wid;
                fModel.quantity   = 1;
                fBll.Add(fModel);
                jsondict.Add("errno", "1");
                context.Response.Write(MyCommFun.getJsonStr(jsondict));
                return;
            }
            #endregion

            #region 添加预约订单信息
            if (action == "addyydd")
            {
                Dictionary <string, string> jsondict = new Dictionary <string, string>();
                BLL.wx_fc_yyInfo            yBll     = new BLL.wx_fc_yyInfo();
                BLL.wx_fc_floor             fBll     = new BLL.wx_fc_floor();
                string             linkman           = MyCommFun.QueryString("truename");
                string             dateline          = MyCommFun.QueryString("dateline");
                string             timepart          = MyCommFun.QueryString("timepart");
                int                housetype         = MyCommFun.RequestInt("housetype");
                string             info      = MyCommFun.QueryString("info");
                string             tel       = MyCommFun.QueryString("tel");
                int                fid       = MyCommFun.RequestInt("fid");
                int                addOrEdit = MyCommFun.RequestInt("addOrEdit");
                int                yid       = MyCommFun.Obj2Int(fBll.GetModel(fid).yid);
                Model.wx_fc_yyInfo yyinfo    = new Model.wx_fc_yyInfo()
                {
                    createdate  = DateTime.Now,
                    hid         = housetype,
                    telephone   = tel,
                    remark      = info,
                    name        = linkman,
                    yydate      = MyCommFun.Obj2DateTime(dateline),
                    yydatepart  = timepart,
                    wid         = wid,
                    fid         = fid,
                    yid         = yid,
                    openid      = openid,
                    orderStatus = "待回复",
                    sort_id     = 99
                };
                if (addOrEdit > 0)
                { //修改
                    yyinfo.Id = addOrEdit;
                    yBll.Update(yyinfo);
                }
                else                  //添加
                {
                    yBll.Add(yyinfo);
                }
                jsondict.Add("errno", "0");
                jsondict.Add("content", "");
                context.Response.Write(MyCommFun.getJsonStr(jsondict));
                return;
            }
            #endregion

            #region 加载相册信息
            if (action == "xiangce")
            {
                BLL.wx_fc_album      bll   = new BLL.wx_fc_album();
                BLL.wx_albums_photo  pBll  = new BLL.wx_albums_photo();
                BLL.wx_albums_info   aBll  = new BLL.wx_albums_info();
                Model.wx_albums_info model = new Model.wx_albums_info();
                int           fid          = MyCommFun.RequestInt("fid");
                StringBuilder sb           = new StringBuilder("");
                sb.Append("showPics([");
                //获得楼盘相册
                DataTable artlist = bll.GetList(" fid=" + fid).Tables[0];

                int a_rowsNum = 0;                                                        //每行显示的图片数量
                List <Model.wx_albums_photo> allist = new List <Model.wx_albums_photo>(); //图片表
                if (artlist != null && artlist.Rows.Count > 0)
                {
                    DataRow dr;
                    for (int i = 0; i < artlist.Rows.Count; i++)//循环楼盘相册
                    {
                        dr    = artlist.Rows[i];
                        model = aBll.GetModel(int.Parse(dr["aid"].ToString()));//根据楼盘相册得到该相册基本信息表

                        //if (model.albums == null || model.albums.Count <= 0)
                        //{
                        //    continue;
                        //}
                        allist = pBll.GetModelList(" aId=" + model.id);
                        sb.Append("{\"title\":\"" + model.aName + "\",");
                        a_rowsNum = (allist.Count) / 2;
                        //第一行
                        sb.Append(" \"ps1\":[");
                        sb.Append(" { \"type\":\"title\", \"title\":\"" + model.aName + "\", \"subTitle\":\"" + model.aContent + "\"}");
                        if (a_rowsNum > 0)
                        {
                            sb.Append(",");
                        }
                        for (int h = 0; h < a_rowsNum; h++)
                        {
                            if (h < (a_rowsNum - 1))
                            {
                                sb.Append(" {\"type\":\"img\",\"name\":\"" + allist[h].pContent + "\",\"img\":\"" + MyCommFun.getWebSite() + allist[h].photoPic + "\",\"size\":[480,450]},");
                            }
                            else
                            {
                                sb.Append(" {\"type\":\"img\",\"name\":\"" + allist[h].pContent + "\",\"img\":\"" + MyCommFun.getWebSite() + allist[h].photoPic + "\",\"size\":[480,450]}");
                            }
                        }
                        sb.Append("],");

                        //第二行
                        sb.Append(" \"ps2\":[");
                        int h_cishu = 0;
                        for (int h = a_rowsNum; h < allist.Count; h++)
                        {
                            if (h_cishu == 1)
                            {
                                sb.Append(" {\"type\":\"text\",\"content\":\"" + model.aContent + "\"},");
                            }

                            if (h < (allist.Count - 1))
                            {
                                sb.Append(" {\"type\":\"img\",\"name\":\"" + allist[h].pContent + "\",\"img\":\"" + MyCommFun.getWebSite() + allist[h].photoPic + "\",\"size\":[480,450]},");
                                h_cishu++;
                            }
                            else
                            {
                                sb.Append(" {\"type\":\"img\",\"name\":\"" + allist[h].pContent + "\",\"img\":\"" + MyCommFun.getWebSite() + allist[h].photoPic + "\",\"size\":[480,450]}");
                            }
                        }
                        if (h_cishu == 0)
                        {
                            if (allist.Count > 0)
                            {
                                sb.Append(",");
                            }
                            sb.Append("{\"type\":\"text\",\"content\":\"" + model.aContent + "\"}");
                        }

                        sb.Append("]");

                        if (i < (artlist.Rows.Count - 1))
                        {
                            sb.Append("},");
                        }
                        else
                        {
                            sb.Append("}");
                        }
                    }
                }

                sb.Append("]);");
                context.Response.Write(sb.ToString());
                return;
            }
            #endregion

            #region 加载户型图片
            if (action == "htImg")
            {
                BLL.wx_fc_houseType htBll = new BLL.wx_fc_houseType();
                BLL.wx_fc_floor     fBll  = new BLL.wx_fc_floor();
                int fid  = MyCommFun.RequestInt("fid");
                int htid = MyCommFun.RequestInt("htid");

                if (htBll.GetRecordCount(string.Format(" fid={0} and wid={1} and id={2}", fid, wid, htid)) < 1)
                {
                    return;
                }

                Model.wx_fc_houseType htModel = htBll.GetModel(htid);
                Model.wx_fc_floor     fModel  = fBll.GetModel(fid);
                StringBuilder         sb      = new StringBuilder("showRooms({");//begin
                sb.Append("\"banner\":\"http://42.96.196.48/tpl/static/attachment/focus/default/../canyin/3.jpg\",");
                sb.Append("\"rooms\":[{");
                sb.Append("\"name\":\"" + htModel.Name + "\",");
                sb.Append("\"desc\":\"" + fModel.newsTitle + "\",");
                sb.Append("\"bimg\":\"" + MyCommFun.getWebSite() + htModel.htimgA + "\",");
                sb.Append("\"rooms\":\"" + htModel.houseType + "\",");
                sb.Append("\"area\":\" " + htModel.jzmj + "平方米\",");
                sb.Append("\"floor\":\"" + htModel.storey + "\",");
                sb.Append("\"width\":1600,");
                sb.Append("\"height\":1600,");
                sb.Append("\"pics\":[");
                //图片区,A
                List <string> ls = imgstr(htModel);
                for (int i = 0; i < ls.Count; i++)
                {
                    sb.Append("{\"img\":\"" + MyCommFun.getWebSite() + htModel.htimgA + "\",");
                    sb.Append("\"width\":760,");
                    sb.Append("\"height\":760,");
                    sb.Append("\"name\":\"" + htModel.Name + "\"}");
                    if (i != ls.Count)
                    {
                        sb.Append(",");
                    }
                }

                sb.Append("],");
                //图片end
                sb.Append("\"dtitle\":[\"建筑面积约" + htModel.jzmj + "平方米\"],");
                sb.Append("\"dlist\":[\"" + htModel.Jieshao + "\"]");
                sb.Append("}]})");//end
                context.Response.Write(sb.ToString());
                return;
            }
            #endregion
        }
Ejemplo n.º 25
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action   = MyCommFun.QueryString("myact");
            string username  = MyCommFun.QueryString("username");
            string parssword = MyCommFun.QueryString("parssword");
            string id        = MyCommFun.QueryString("id");

            openid = MyCommFun.QueryString("openid");
            string state = MyCommFun.QueryString("state");

            goodsData = QueryString("goodsData");
            shopid    = MyCommFun.RequestInt("shopid");


            BLL.wx_diancai_dianyuan         dianyuanbll = new BLL.wx_diancai_dianyuan();
            BLL.wx_diancai_dingdan_manage   manage      = new BLL.wx_diancai_dingdan_manage();
            Model.wx_diancai_dingdan_manage managemodel = new Model.wx_diancai_dingdan_manage();


            if (_action == "login")
            {
                if (dianyuanbll.Exists(username, parssword))
                {
                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "登录成功!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
                else
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "密码错误!");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }

            else if (_action == "setstatus")
            {
                //id

                if (manage.Updatestatus(id, state))
                {
                    managemodel = manage.GetModel(MyCommFun.Str2Int(id));
                    BLL.wx_diancai_member menbll = new BLL.wx_diancai_member();
                    if (state == "1")
                    {
                        menbll.Update(managemodel.openid);
                    }
                    if (state == "2")
                    {
                        menbll.Updatefail(managemodel.openid);
                    }

                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "提交成功!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
            else if (_action == "addcaidan")
            {
                var orderProcessResult = this.ProcessOrder();

                if (!orderProcessResult.IsSuccess)
                {
                    this.jsonDict.Add("ret", "err");
                    this.jsonDict.Add("content", orderProcessResult.Message);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                var order = orderProcessResult.BusinessData as Model.wx_diancai_dingdan_manage;

                if (order != null)
                {
                    //this.jsonDict.Add("ret", "ok");
                    //this.jsonDict.Add("content", orderProcessResult.Message);
                    //this.jsonDict.Add("orderid", order.id.ToString());
                    //this.jsonDict.Add("ordercode", order.orderNumber);
                    //this.jsonDict.Add("openid", openid);
                    //this.jsonDict.Add("payamount", order.payAmount.ToString());
                    //this.jsonDict.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName);
                    //this.jsonDict.Add("wid", order.wid.ToString());
                    //this.jsonDict.Add("orderNumber", order.orderNumber);
                    //context.Response.Write(MyCommFun.getJsonStr(this.jsonDict));

                    var shopInfo = new BLL.wx_diancai_shopinfo().GetModel(this.shopid);
                    var entity   = new UnifiedOrderEntity
                    {
                        OrderId      = order.id.ToString(),
                        wid          = order.wid,
                        total_fee    = order.payAmount == null ? 0 : (int)order.payAmount,
                        out_trade_no = order.orderNumber,
                        openid       = openid,
                        body         = string.Format("订单编号{0} {1}", order.orderNumber, shopInfo.hotelName),
                        PayModuleID  = (int)PayModuleEnum.Restaurant,
                        PayComplete  = "../restaurant/AfterPay.aspx"
                    };

                    entity.Extra.Add("content", orderProcessResult.Message);
                    entity.Extra.Add("shopname", new BLL.wx_diancai_shopinfo().GetModel(this.shopid).hotelName);
                    entity.Extra.Add("shopid", shopid.ToString());
                    entity.Extra.Add("wid", shopInfo.wid.ToString());

                    var ticket  = EncryptionManager.CreateIV();
                    var payData = EncryptionManager.AESEncrypt(entity.ToJson(), ticket);

                    context.Response.Write(AjaxResult.Success(PayHelper.GetPayUrl(payData, ticket)));
                }

                context.Response.End();
            }
            else if (_action == "productDetail")
            {
                var productId = MyCommFun.QueryString("productId");


                if (!string.IsNullOrEmpty(productId))
                {
                    var    model    = new BLL.wx_diancai_caipin_manage().GetModel(int.Parse(productId));
                    String useRange = string.Empty;
                    if (model.beginDate.HasValue || model.endDate.HasValue)
                    {
                        useRange = string.Format("{0}至{1}",
                                                 model.beginDate.HasValue ? model.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty,
                                                 model.endDate.HasValue ? model.endDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                    }
                    var data = new
                    {
                        shopIntroduction = model.shopIntroduction,
                        detailContent    = model.detailContent,
                        instructions     = model.instructions,
                        chargeback       = model.chargeback,
                        useRange         = useRange
                    };
                    context.Response.Write(AjaxResult.Success(data).ToCamelString());
                }

                context.Response.End();
            }
            else if (_action == "caipinDetail")
            {
                var caipinId    = MyCommFun.RequestInt("caipinId");
                var caipinModel = new BLL.wx_diancai_caipin_manage().GetModel(caipinId);

                String useRange = string.Empty;
                if (caipinModel.beginDate.HasValue || caipinModel.endDate.HasValue)
                {
                    useRange = string.Format("{0}至{1}",
                                             caipinModel.beginDate.HasValue ? caipinModel.beginDate.Value.ToString("yyyy-MM-dd") : string.Empty,
                                             caipinModel.endDate.HasValue ? caipinModel.endDate.Value.ToString("yyyy-MM-dd") : string.Empty);
                }

                String jianjie    = caipinModel.shopIntroduction;
                String tuidanRule = caipinModel.chargeback;
                string pictureUrl = caipinModel.picUrl;

                var result = new
                {
                    Name             = caipinModel.cpName,
                    Url              = MapUrl(pictureUrl),
                    Range            = useRange,
                    Intruduce        = jianjie,
                    Rule             = tuidanRule,
                    suoming          = caipinModel.detailContent,
                    shopIntroduction = caipinModel.shopIntroduction
                };

                context.Response.Write(AjaxResult.Success(result));
                context.Response.End();
            }
        }
Ejemplo n.º 26
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action = MyCommFun.QueryString("myact");
            string openid  = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            //黑名单权限openid


            BLL.wx_message_blacklist blackBll = new BLL.wx_message_blacklist();

            if (_action == "commit")
            {
                //留言



                if (blackBll.ExistsByOpenid(openid))
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "留言失败");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                    return;
                }
                else
                {
                    int    wid      = MyCommFun.RequestInt("wid");
                    string nickname = MyCommFun.QueryString("nickname");
                    string info     = MyCommFun.QueryString("info");
                    bool   hasSH    = Convert.ToBoolean(MyCommFun.QueryString("hasSH"));

                    BLL.wx_message_list   mBll    = new BLL.wx_message_list();
                    Model.wx_message_list message = new Model.wx_message_list();
                    message.wid        = wid;
                    message.title      = info;
                    message.userName   = nickname;
                    message.createDate = DateTime.Now;
                    message.openId     = openid;
                    message.parentId   = 0;
                    if (hasSH)
                    {
                        message.hasSH = false;
                    }
                    else
                    {
                        message.hasSH = true;
                    }
                    mBll.Add(message);

                    //AddAdminLog(MXEnums.ActionEnum.Add.ToString(), ""); //记录日志


                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "留言成功");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
            //回复
            if (_action == "setly")
            {
                if (blackBll.ExistsByOpenid(openid))
                {
                    jsonDict.Add("ret", "fail");
                    jsonDict.Add("content", "留言失败");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));

                    return;
                }
                else
                {
                    int    wid                    = MyCommFun.RequestInt("wid");
                    string info                   = MyCommFun.QueryString("info");
                    bool   hasSH                  = Convert.ToBoolean(MyCommFun.QueryString("hasSH"));
                    int    parentid               = MyCommFun.RequestInt("parentid");
                    string nickname               = MyCommFun.QueryString("nickname");
                    BLL.wx_message_list   mBll    = new BLL.wx_message_list();
                    Model.wx_message_list message = new Model.wx_message_list();
                    message.wid        = wid;
                    message.title      = info;
                    message.userName   = nickname;
                    message.createDate = DateTime.Now;
                    message.openId     = openid;
                    message.parentId   = parentid;

                    if (hasSH)
                    {
                        message.hasSH = false;
                    }
                    else
                    {
                        message.hasSH = true;
                    }
                    mBll.Add(message);

                    //AddAdminLog(MXEnums.ActionEnum.Add.ToString(), ""); //记录日志


                    jsonDict.Add("ret", "ok");
                    jsonDict.Add("content", "回复成功");

                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                }
            }
        }
Ejemplo n.º 27
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/html";
            BLL.wx_shop_cart            cartBll  = new BLL.wx_shop_cart();
            string                      _action  = MyCommFun.QueryString("myact");
            string                      openid   = MyCommFun.RequestOpenid(); //得到微信用户的openid
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            if (_action == "LoadProduct")
            {
                #region  择排序,改变商品列表
                string              sortColumn = MyCommFun.RequestParam("sortColumn");
                int                 wid        = MyCommFun.RequestInt("wid");
                int                 id         = MyCommFun.RequestInt("cid");
                string              name       = MyCommFun.RequestParam("name");
                string              flog       = MyCommFun.RequestParam("flog");
                string              gd         = MyCommFun.RequestParam("gd");
                DataSet             ds         = null;
                BLL.wx_shop_product proBll     = new BLL.wx_shop_product();
                StringBuilder       jsonStr    = new StringBuilder();
                if (id != 0)
                {
                    if (sortColumn == "priceDesc")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " order  by  marketPrice desc ");
                    }
                    if (sortColumn == "priceDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order  by  marketPrice desc ");
                    }
                    if (sortColumn == "priceAsc")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " order  by  marketPrice asc  ");
                    }
                    if (sortColumn == "priceAsc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and productName like " + "'%" + name + "%'" + "order  by  marketPrice asc ");
                    }
                    if (sortColumn == "newDesc")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " order  by  latest desc  ");
                    }
                    if (sortColumn == "newDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and latest=" + 1 + " and productName like " + "'%" + name + "%'" + "order  by  latest desc ");
                    }
                    if (sortColumn == "saleDesc")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " order  by  hotsale desc  ");
                    }
                    if (sortColumn == "saleDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, "categoryId=" + id + " and hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order  by hotsale desc ");
                    }
                }
                else
                {
                    if (sortColumn == "priceDesc")
                    {
                        ds = proBll.GetList(wid, 20, "1=1 order  by  marketPrice desc ");
                    }
                    if (sortColumn == "priceDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + "order  by  marketPrice desc ");
                    }
                    if (sortColumn == "priceAsc")
                    {
                        ds = proBll.GetList(wid, 20, " 1=1 order  by  marketPrice asc  ");
                    }
                    if (sortColumn == "priceAsc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 27, " productName like " + "'%" + name + "%'" + "order  by  marketPrice asc ");
                    }
                    if (sortColumn == "newDesc")
                    {
                        ds = proBll.GetList(wid, 20, " latest=" + 1 + " order  by  latest desc  ");
                    }
                    if (sortColumn == "newDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, " latest=" + 1 + "productName like " + "'%" + name + "%'" + "order  by  latest desc ");
                    }
                    if (sortColumn == "saleDesc")
                    {
                        ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " order  by  hotsale desc  ");
                    }
                    if (sortColumn == "saleDesc" && flog == "true")
                    {
                        ds = proBll.GetList(wid, 20, "hotsale=" + 1 + " and productName like " + "'%" + name + "%'" + "order  by hotsale desc ");
                    }
                }



                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    if (id != 0)
                    {
                        if (gd == "")
                        {
                            foreach (DataRow d in ds.Tables[0].Rows)
                            {
                                jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>");
                                jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>");
                                jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>");
                            }
                            jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>");
                        }
                        else
                        {
                            foreach (DataRow d in ds.Tables[0].Rows)
                            {
                                jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">");
                                jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评");
                                jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>");
                            }
                        }
                    }
                    else
                    {
                        if (gd == "")
                        {
                            foreach (DataRow d in ds.Tables[0].Rows)
                            {
                                jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>");
                                jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>");
                                jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span></p> </div>");
                            }
                            jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>");
                        }
                        else
                        {
                            foreach (DataRow d in ds.Tables[0].Rows)
                            {
                                jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">");
                                jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评");
                                jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>");
                            }
                        }
                    }
                }



                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "sousuo")
            {
                #region  择商品名称,改变商品列表

                string              name    = MyCommFun.RequestParam("name");
                int                 wid     = MyCommFun.RequestInt("wid");
                DataSet             ds      = null;
                BLL.wx_shop_product proBll  = new BLL.wx_shop_product();
                StringBuilder       jsonStr = new StringBuilder();

                ds = proBll.GetList(wid, 20, " productName like " + "'%" + name + "%'" + "");


                if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow d in ds.Tables[0].Rows)
                    {
                        jsonStr.Append("<div class=\"lists_items\"> <p class=\"pic\"> <a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"> <img src=\"" + d["productpic"] + "\"></a> </p>");
                        jsonStr.Append("<p class=\"list_tex\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><span><font>¥" + d["marketPrice"] + "</font></span><strong>" + d["productName"] + "</strong></br>" + d["sku"] + "</a> </p>");
                        jsonStr.Append("<p class=\"list_tex\"><a class=\"activemsg\" href=\"\"></a></p><p class=\"list_tex\" ><span class=\"txt_blue\">库存" + d["stock"] + "</span>1534人评价,96%好评</p> </div>");
                    }
                    jsonStr.Append("<div class=\"details_more\" style=\"float:left; width:100%;\"><A href=\"javascript:void(0);\" id=\"gengduo\" onclick=\"gengduo()\"><span>查看更多</span><br />可能产生较多流量<br /> </A>");
                }

                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "gengduo")
            {
                #region 查看更多

                int                 wid     = MyCommFun.RequestInt("wid");
                int                 id      = MyCommFun.RequestInt("cid");
                DataSet             ds      = null;
                BLL.wx_shop_product proBll  = new BLL.wx_shop_product();
                StringBuilder       jsonStr = new StringBuilder();
                if (id != 0)
                {
                    ds = proBll.GetList(wid, -1, "categoryId=" + id + " and p.hotsale=" + 1 + " order  by  p.hotsale desc  ");
                }
                else
                {
                    ds = proBll.GetList(wid, -1, "p.hotsale=" + 1 + " order  by  p.hotsale desc  ");
                }


                if (ds != null && ds.Tables[0] != null)
                {
                    foreach (DataRow d in ds.Tables[0].Rows)
                    {
                        jsonStr.Append("<div class=\"list_msg list_with_img\" style=\"margin-top:10px;font-size:12px;\"><a href=\"/shop/detail.aspx?wid=" + wid + "&pid=" + d["id"] + "&openid=" + openid + "\"><img style=\"top:16px;\" src=\"" + d["productpic"] + "\">");
                        jsonStr.Append("<p class=\"list_tex\">" + d["productName"] + "<span class=\"txt_red\" style=\"font-size:12px;\">¥" + d["marketPrice"] + "</span></p><p class=\"list_tex\">" + d["sku"] + "</p><p class=\"list_tex\">158人评价,98%好评");
                        jsonStr.Append("<span class=\"txt_blue\" style=\"font-size:12px;\">库存" + d["stock"] + "</span></p></a></div>");
                    }
                }

                context.Response.Write(jsonStr);
                #endregion
            }
            else if (_action == "checkid")
            {
                #region 是否存在该商品
                jsonDict = new Dictionary <string, string>();
                int wid = MyCommFun.RequestInt("wid");
                int id  = MyCommFun.RequestInt("id");
                BLL.wx_shop_product proBll = new BLL.wx_shop_product();
                DataSet             ds     = null;
                ds = proBll.GetList("wid=" + wid + " and id=" + id + "");
                BLL.wx_shop_sku   skuBll   = new BLL.wx_shop_sku();
                Model.wx_shop_sku skuModel = skuBll.GetModel(id);
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    jsonDict.Add("data", ds.Tables[0].Rows[0]["stock"].ToString());
                }
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                #endregion
            }
        }
Ejemplo n.º 28
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            string _action      = MyCommFun.QueryString("myact");
            string shopsPwd     = MyCommFun.QueryString("shopsPwd");
            string sn           = MyCommFun.QueryString("sn");
            int    id           = MyCommFun.RequestInt("baseid");
            int    baseid       = MyCommFun.RequestInt("baseid");
            string customerName = MyCommFun.QueryString("customerName");
            string tel          = MyCommFun.QueryString("tel");
            int    customerNum  = MyCommFun.RequestInt("customerNum");
            string address      = MyCommFun.QueryString("address");
            string Remark       = MyCommFun.QueryString("Remark");



            BLL.wx_purchase_base        basebll  = new BLL.wx_purchase_base();
            Dictionary <string, string> jsonDict = new Dictionary <string, string>();

            BLL.wx_purchase_customer   customerbll = new BLL.wx_purchase_customer();
            Model.wx_purchase_customer model       = new Model.wx_purchase_customer();
            string openid = MyCommFun.RequestOpenid();  //得到微信用户的openid

            if (_action == "commit")
            {
                basemodel = basebll.GetModel(id);
                if (basemodel != null)
                {
                    totalCount = Convert.ToInt32(basemodel.totalCount);
                    limitCount = Convert.ToInt32(basemodel.limitCount);
                    count      = totalCount - customerbll.GetRecordAmount(id); //剩余的商品数量
                    yg         = customerbll.GetRecordyg(openid, id);          //个人剩余的可购买数量

                    if (shopsPwd == "" && sn == "")
                    {
                        #region    //新增一次消费

                        if (count < customerNum)
                        {
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "超过数量!");

                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        int aa = limitCount - yg;
                        if (aa <= 0)
                        {
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "超过数量!");

                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }



                        baseid       = MyCommFun.RequestInt("baseid");
                        customerName = MyCommFun.QueryString("customerName");
                        tel          = MyCommFun.QueryString("tel");
                        customerNum  = MyCommFun.RequestInt("customerNum");
                        address      = MyCommFun.QueryString("address");

                        model.openid       = openid;
                        model.baseid       = baseid;
                        model.customerName = customerName;
                        model.tel          = tel;
                        model.customerNum  = customerNum;
                        model.address      = address;
                        sn           = Utils.Number(18);
                        model.sn     = sn;
                        model.status = 0;//未消费

                        model.craeteTime = DateTime.Now;
                        model.dateJoin   = DateTime.Now;
                        model.Remark     = Remark;

                        customerbll.Add(model);

                        jsonDict.Add("ret", "ok");
                        jsonDict.Add("content", "抢购成功!");

                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        #endregion
                    }
                    else
                    {
                        #region 确认消费

                        int oldNum = MyCommFun.RequestInt("oldNum"); //本次的原始消费数量
                        customerNum -= oldNum;
                        yg          -= oldNum;
                        if (count < customerNum)
                        {
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "超过数量!");

                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        int aa = limitCount - yg;
                        if (aa <= 0)
                        {
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "超过数量!");

                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }



                        model = customerbll.GetModellist(id);//最近一条记录

                        if (shopsPwd == "")
                        {
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "请输入密码!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }

                        if (basemodel == null || basemodel.shopsPwd != shopsPwd)
                        {
                            //JscriptMsg("消费密码不正确!", "back", "Error");
                            jsonDict.Add("ret", "fail");
                            jsonDict.Add("content", "密码错误!");

                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                            //消费
                        }



                        model.baseid  = id;
                        model.status  = 2;
                        model.dateUse = DateTime.Now;
                        customerbll.Update(model);

                        jsonDict.Add("ret", "ok");
                        jsonDict.Add("content", "消费成功!");

                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));


                        #endregion
                    }
                }
            }
            else
            {
                jsonDict.Add("ret", "fail");
                jsonDict.Add("content", "提交失败!");

                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }
Ejemplo n.º 29
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/json";
            int    aid     = MyCommFun.RequestInt("aid");
            int    wid     = MyCommFun.RequestWid();
            string openid  = MyCommFun.RequestOpenid();
            string _action = MXRequest.GetQueryString("mycat");

            BLL.wx_qp_base  actBll  = new wx_qp_base();
            BLL.wx_qp_users userBll = new BLL.wx_qp_users();
            //验证码
            if (_action == "sendCardCheckCode")
            {
                Model.wx_qp_base actModel  = actBll.GetModel(aid);
                string           actName   = actModel.bName;
                smsMgr           smgr      = null;
                string           Number    = string.Empty;
                string           smsStatus = string.Empty;
                string           telephone = MXRequest.GetQueryString("telephone");
                #region 验证码
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                IList <Model.wx_qp_users>   userList = userBll.GetModelList(string.Format(" (openid='{0}'and bId={2}) or (uTel='{1}' and bId={2})", openid, telephone, aid));
                try
                {
                    if (Regexlib.IsValidMobile(telephone))
                    {
                        //判断是否超过活动最大人数
                        if (actModel.cyPersonNum >= actModel.maxPersonNum)
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "活动人数已满!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }

                        if (userList.Count > 0)//已参加过本次活动,不发送验证码
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "你已参加过本次活动!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        smgr      = new smsMgr(wid);
                        Number    = Utils.Number(6, true);
                        smsStatus = smgr.SendSMS(telephone, Number + "(动态验证码),您于" + DateTime.Now.ToString("yyyy年MM月dd日 hh点mm分") + "参与\"" + actName + "\"抢票活动,请在10分钟内输入该验证码!", Number, actName, aid);
                        if (smsStatus == "成功")
                        {
                            //获取验证码
                            jsonDict.Add("errno", "0");
                            jsonDict.Add("content", "获取验证码成功");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                        else
                        {
                            jsonDict.Add("errno", "sys");
                            jsonDict.Add("content", "发送验证码失败!");
                            context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                            return;
                        }
                    }
                    else
                    {
                        jsonDict.Add("errno", "sys");
                        jsonDict.Add("content", "手机格式错误!");
                        context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                        return;
                    }
                }
                catch (Exception ex)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "发送验证码失败!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }

                #endregion
            }

            //index页面抢票时判断是否已参加过活动
            if (_action == "qp_ckJoined")
            {
                Dictionary <string, string> jsonDict = new Dictionary <string, string>();
                //判断此人是否已参与过活动
                bool joined = userBll.GetModelList(string.Format(" bId={0} and openid='{1}'", aid, openid)).Count > 0;
                if (joined)//已参与,跳转结果显示页面
                {
                    string goUrl = string.Format("order_Result.aspx?wid={0}&aid={1}&openid={2}&join=false", wid, aid, openid);
                    jsonDict.Add("errno", "0");
                    jsonDict.Add("content", goUrl);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                else//还未参与,跳转订单页面
                {
                    string goUrl = string.Format("order.aspx?wid={0}&aid={1}&openid={2}", wid, aid, openid);
                    jsonDict.Add("errno", "0");
                    jsonDict.Add("content", goUrl);
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
            }

            //抢票得到订单
            if (_action == "qp_ckOrder")
            {
                string                      identCode = MyCommFun.QueryString("identCode");
                string                      telephone = MyCommFun.QueryString("telephone");
                BLL.wx_sms_info             smsBll    = new BLL.wx_sms_info();
                Dictionary <string, string> jsonDict  = new Dictionary <string, string>();
                string                      goUrl     = "";
                //判断用户是否已经参与过活动
                IList <Model.wx_qp_users> userList = userBll.GetModelList(string.Format(" (openid='{0}'and bId={2}) or (uTel='{1}' and bId={2}) ", openid, telephone, aid));
                //判断验证码
                bool ckIdentcode = smsBll.ExistsYzm(telephone, identCode);

                Model.wx_qp_base actModel = actBll.GetModel(aid);

                //判断是否超过活动最大人数
                if (actModel.cyPersonNum >= actModel.maxPersonNum)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "活动人数已满!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (userList.Count > 0)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "你已参加过活动,每人只能参加一次!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (!Regexlib.IsValidMobile(telephone))
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "手机格式错误!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }
                if (!ckIdentcode)
                {
                    jsonDict.Add("errno", "sys");
                    jsonDict.Add("content", "验证码错误!");
                    context.Response.Write(MyCommFun.getJsonStr(jsonDict));
                    return;
                }



                Model.wx_qp_users model = new Model.wx_qp_users();
                model.bId        = aid;
                model.openid     = openid;
                model.uTel       = telephone;
                model.createDate = DateTime.Now;
                model.sn         = "sn_" + Utils.Number(6, true);
                //添加参与活动用户并给递加活动人数
                int res = userBll.Add(model);
                actModel.cyPersonNum  = actModel.cyPersonNum + 1;
                actModel.yingyuanlist = null;
                actBll.Update(actModel);

                //判断该活动是否发送SN码通知用户
                if (actModel.isSnSendsms && res > 0)//发送
                {
                    smsMgr smgr      = new smsMgr(wid);
                    string smsStatus = smgr.SendSMS("您于" + DateTime.Now.ToString("yyyy年MM月dd日 hh点mm分") + "参与\"" + actModel.bName + "\"抢票活动!恭喜你,抢票成功!(SN码)" + telephone, model.sn, model.sn, actModel.bName, aid);
                }
                goUrl = string.Format("order_Result.aspx?wid={0}&aid={1}&openid={2}&join=true", wid, aid, openid);
                jsonDict.Add("errno", "0");
                jsonDict.Add("content", goUrl);
                context.Response.Write(MyCommFun.getJsonStr(jsonDict));
            }
        }