예제 #1
0
        /// <summary>
        /// 后台指派订单给骑手
        /// </summary>
        public string AssignRider(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var orderId = req.orderId;
            var riderId = req.riderId;
            var msg     = OrderInfoOper.Instance.AssignRider(orderId, riderId);

            if (msg != "")
            {
                //return JsonHelperHere.JsonMsg(false, msg);
                r.Message  = msg;
                r.HttpCode = 500;
            }
            else
            {
                r.Message = msg;
            }
            //return JsonHelperHere.JsonMsg(true, msg);
            return(JsonConvert.SerializeObject(r));
        }
예제 #2
0
        /// <summary>
        /// 获取可指派的骑手
        /// </summary>
        /// <returns></returns>
        public string GetAssignRider(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var orderId  = req.orderId;
            var order    = OrderInfoOper.Instance.GetById(orderId);
            var ua       = UserAddressOper.Instance.GetById((int)order.addressId);
            var listArea = AreaInfoOper.Instance.GetAreaByLocation(Convert.ToDecimal(ua.lat), Convert.ToDecimal(ua.lng));

            List <AssignRiderRes> listR = new List <AssignRiderRes>();

            foreach (var item in listArea)
            {
                var list = RiderInfoOper.Instance.GetOnlineByAreaId(item.areaId);

                foreach (var item2 in list)
                {
                    AssignRiderRes res = new AssignRiderRes(item2);
                    listR.Add(res);
                }
            }

            r.data = JsonConvert.SerializeObject(listR);
            return(JsonConvert.SerializeObject(r));
        }
예제 #3
0
        /// <summary>
        /// page错误,这里拦截
        /// </summary>
        /// <param name="filterContext"></param>
        protected override void OnException(ExceptionContext filterContext)
        {
            //JsonResult jsonResult = new JsonResult();

            LogHelper.WriteLog(typeof(MvcExceptionAttribute), filterContext.Exception);

            // 此处进行异常记录,可以记录到数据库或文本,也可以使用其他日志记录组件。
            // 通过filterContext.Exception来获取这个异常。
            filterContext.ExceptionHandled = true;                                            //组织web.config配置customerror处理
            string    requestType = filterContext.HttpContext.Request.RequestType.ToString(); //获取请求类型
            UrlHelper url         = new UrlHelper(filterContext.RequestContext);

            //判断是否为get请求,如果为get请求,跳转指定页面,如果不是返回json

            var seewhat = ConfigurationManager.AppSettings.Get("seewhat");

            if (seewhat != "error")
            {
                filterContext.Result = new RedirectResult(url.Action("error", "Main"));//跳转到新页面
            }
            else
            {
                JsonResult   jsonResult = new JsonResult();
                ResultForWeb result     = new ResultForWeb();
                result.HttpCode = 500;
                result.Message  = filterContext.Exception.Message;
                LogHelper.WriteLog(typeof(MvcExceptionAttribute), filterContext.Exception);
                jsonResult.Data                = result;
                jsonResult.ContentType         = "application/json";
                jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
                filterContext.Result           = jsonResult;
                filterContext.ExceptionHandled = true;
            }
        }
예제 #4
0
        public string GetByAreaId(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            if (Session["pfId"] == null)
            {
                r.HttpCode = 300;
                return(JsonConvert.SerializeObject(r));
            }
            int index             = req.index;
            int pages             = 0;  //总页数
            int size              = 12; //一页size条数据
            int areaId            = req.areaId;
            List <RiderInfo> list = RiderInfoOper.Instance.GetByAreaId(areaId);

            list   = list.OrderByDescending(p => p.id).Where(p => p.isDeleted == false).ToList();
            pages  = list.Count / size;
            pages  = pages * size == list.Count ? pages : pages + 1;//总页数
            list   = list.Skip((index - 1) * size).Take(size).ToList();
            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(list), index);
            return(JsonConvert.SerializeObject(r));
        }
예제 #5
0
        /// <summary>
        /// 更新所有配置
        /// </summary>
        /// <param name="req"></param>
        public string UpdateAll(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var couponSaveDays        = req.couponSaveDays;
            var riderCancelTips       = req.riderCancelTips;
            var recoveryBoxTips       = req.recoveryBoxTips;
            var orderSendingTips      = req.orderSendingTips;
            var orderArrivelTips      = req.orderArrivelTips;
            var boxGetTips            = req.boxGetTips;
            var serverAssignRiderTips = req.serverAssignRiderTips;
            var discount = req.discount;
            var shopNewReserveOrderTips = req.shopNewReserveOrderTips;
            var shopNewOrderTips        = req.shopNewOrderTips;

            Configuration cfa = WebConfigurationManager.OpenWebConfiguration("~");

            cfa.AppSettings.Settings["couponSaveDays"].Value          = couponSaveDays;
            cfa.AppSettings.Settings["riderCancelTips"].Value         = riderCancelTips;
            cfa.AppSettings.Settings["recoveryBoxTips"].Value         = recoveryBoxTips;
            cfa.AppSettings.Settings["orderSendingTips"].Value        = orderSendingTips;
            cfa.AppSettings.Settings["orderArrivelTips"].Value        = orderArrivelTips;
            cfa.AppSettings.Settings["boxGetTips"].Value              = boxGetTips;
            cfa.AppSettings.Settings["serverAssignRiderTips"].Value   = serverAssignRiderTips;
            cfa.AppSettings.Settings["shopNewReserveOrderTips"].Value = shopNewReserveOrderTips;
            cfa.AppSettings.Settings["shopNewOrderTips"].Value        = shopNewOrderTips;
            cfa.AppSettings.Settings["discount"].Value = discount;
            cfa.Save();
            return(JsonConvert.SerializeObject(r));
        }
예제 #6
0
        /// <summary>
        /// 改变rider所在的区域
        /// </summary>
        public string Change(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            if (Session["pfId"] == null)
            {
                r.HttpCode = 300;
                return(JsonConvert.SerializeObject(r));
            }
            var       sourceId = req.sourceId;
            var       riderId  = req.riderId;
            var       areaId   = req.areaId;
            RiderInfo rider1   = new RiderInfo();

            rider1.riderAreaId = 0;
            rider1.id          = sourceId;
            RiderInfoOper.Instance.Update(rider1);
            RiderInfo rider2 = new RiderInfo();

            rider2.id          = riderId;
            rider2.riderAreaId = areaId;
            RiderInfoOper.Instance.Update(rider2);
            return(JsonConvert.SerializeObject(r));
        }
예제 #7
0
        public string Get(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var tab = req.tab;

            if (tab == 0)
            {
                var settings = new SettingRes();
                //TipsSettingsRes res = new TipsSettingsRes(settings);
                r.data = JsonConvert.SerializeObject(settings);
                return(JsonConvert.SerializeObject(r));
            }
            else if (tab == 1)
            {
                var thisId = Convert.ToInt32(Session["pfId"]);
                var pf     = PlatformOper.Instance.GetById(thisId);
                var list   = PlatformOper.Instance.GetByLv(pf.level.ToString());
                var listR  = new List <PlatformRes>();
                foreach (var item in list)
                {
                    PlatformRes res = new PlatformRes(item);
                    listR.Add(res);
                }
                r.data = JsonConvert.SerializeObject(listR);
                return(JsonConvert.SerializeObject(r));
            }
            return(JsonConvert.SerializeObject(r));
        }
예제 #8
0
        public string Update(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            FoodTagInfo tag   = new FoodTagInfo();
            var         tagId = Convert.ToInt32(req.foodTagId);

            tag.foodTagName = req.foodTagName;
            var name = req.foodTagName;

            if (ControllerHelper.Instance.IsExists("foodtaginfo", "foodTagName", name, tagId.ToString()))
            {
                r.HttpCode = 500;
                r.data     = JsonHelperHere.JsonMsg(false, "已存在该标签");
                return(JsonConvert.SerializeObject(r));
            }

            bool isWeek = true;

            if (req.isWeek == "0")
            {
                isWeek = false;
            }
            tag.isWeek = isWeek;
            tag.id     = tagId;
            FoodTagInfoOper.Instance.Update(tag);
            r.data = JsonHelperHere.JsonMsg(true, "");
            return(JsonConvert.SerializeObject(r));
        }
예제 #9
0
        public string Update(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            string   tempImg    = req.tempImg;
            FoodInfo food       = new FoodInfo();
            var      foodName   = req.foodName;
            var      foodId     = req.foodId;
            var      isThisWeek = Convert.ToBoolean(req.isThisWeek);
            var      secondTag  = Convert.ToInt32(req.secondTag);

            food.secondTag = secondTag;
            var now      = Convert.ToInt32(DateTime.Now.DayOfWeek);
            var foodTime = DateTime.Now.AddDays(secondTag - now);

            if (!isThisWeek)
            {
                foodTime = foodTime.AddDays(7);
            }
            food.FoodTime = foodTime;


            food.foodName  = foodName;
            food.foodPrice = Convert.ToDecimal(req.foodPrice);
            food.foodTagId = Convert.ToInt32(req.foodTypeId);
            food.foodImg   = req.foodImg;
            food.foodText  = req.foodText;
            var stars = Convert.ToDecimal(req.foodStars);

            stars     = stars < 0 ? 0 : stars;
            stars     = stars > 5 ? 5 : stars;
            food.star = stars;
            food.id   = Convert.ToInt32(foodId);

            //if (req.isCycle == "0")
            //    food.isCycle = false;
            //else
            //    food.isCycle = true;
            food.deposit = Convert.ToDecimal(req.deposit);

            if (req.isMain == "0")
            {
                food.isMain = false;
            }
            else
            {
                food.isMain = true;
            }



            FoodInfoOper.Instance.Update(food);
            ControllerHelper.Instance.CopyFile(this.Server.MapPath(tempImg), this.Server.MapPath(food.foodImg));
            r.data = JsonHelperHere.JsonMsg(true, "");
            return(JsonConvert.SerializeObject(r));
        }
예제 #10
0
        /// <summary>
        /// 发布文章
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string UpArticle(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var id          = req.articleId;
            var articleTemp = ArticleInfoOper.Instance.GetById(id);

            if ((bool)articleTemp.status)
            {
                r.HttpCode = 500;
                r.Message  = "不能重复发布";
                return(JsonConvert.SerializeObject(r));
                //return JsonHelperHere.JsonMsg(false, "不能重复发布");
            }
            var article = new ArticleInfo();

            article.id       = id;
            article.status   = true;
            article.lastTime = DateTime.Now;
            //article.status = true;
            //article.lastTime = DateTime.Now;
            ArticleInfoOper.Instance.Update(article);
            CacheHelper.SetAllUserArticleNotClick();
            return(JsonConvert.SerializeObject(r));
            //return JsonHelperHere.JsonMsg(true, "发布成功");
        }
예제 #11
0
        public string Get(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            string search = req.search == null ? "" : req.search; //搜索内容
            int    index  = Convert.ToInt32(req.index);           //页码
            int    pages  = 0;                                    //总页数
            int    size   = 12;                                   //一页size条数据

            var condition = " isdeleted=0 and (areaName like '%" + search + "%' or areaNo like '%" + search + "%' ) ";
            var listAll   = CacheHelper.GetDistinctCount <AreaInfo>("areainfo", condition);

            if (listAll.Count < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }

            var ids = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray();

            var viewList = CacheHelper.GetByIds <AreaInfo>("AreaInfo", ids);

            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;

            r.data = JsonHelperHere.JsonResult(pages, viewList, index);
            return(JsonConvert.SerializeObject(r));
        }
예제 #12
0
        public string Update(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var createTime   = req.createTime;
            var status       = req.status;
            var isActual     = Convert.ToBoolean(req.isActual);
            var remarks      = req.remarks;
            var riderId      = req.riderId;
            var orderAreaId  = req.orderAreaId;
            var endTime      = req.endTime;
            var riderComment = req.riderComment;
            var useBalance   = req.useBalance;
            var useCoupon    = req.useCoupon;
            var deposit      = req.deposit;
            var payTime      = req.payTime;
            var payType      = req.payType;
            var payMoney     = req.payMoney;

            var foodIds = req.foodIds;
            var amounts = req.amounts;

            var       orderId = req.orderId;
            OrderInfo order   = new OrderInfo();

            order.createTime  = Convert.ToDateTime(createTime);
            order.status      = Convert.ToInt32(status);
            order.isActual    = isActual;
            order.remarks     = remarks;
            order.riderId     = riderId;
            order.orderAreaId = orderAreaId;
            if (endTime < new DateTime(2017, 1, 1))
            {
                order.endTime = Convert.ToDateTime(endTime);
            }
            order.riderComment = riderComment;
            order.useBalance   = useBalance;
            order.useCoupon    = useCoupon;
            order.deposit      = deposit;
            order.payTime      = Convert.ToDateTime(payTime);
            order.payType      = payType;
            order.payMoney     = payMoney;
            order.id           = orderId;
            OrderInfoOper.Instance.Update(order);
            var listFoods = new List <foodId_Amount>();

            for (int i = 0; i < foodIds.Length; i++)
            {
                foodId_Amount fa = new foodId_Amount(Convert.ToInt32(foodIds[i]), Convert.ToInt32(amounts[i]));
                listFoods.Add(fa);
            }
            OrderFoodsOper.Instance.UpdateOrderFoodsForWeb(orderId, listFoods);
            return(JsonConvert.SerializeObject(r));
        }
예제 #13
0
        public string CreateCode(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var money    = Convert.ToDecimal(req.couponMoney);
            var cname    = req.name;
            var isRepeat = req.isRepeat == "1" ? true : false;
            var amount   = Convert.ToInt32(req.amount);

            if (ControllerHelper.Instance.IsExists("coupon", "name", cname, "0"))
            {
                r.Message  = "已存在该名称";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }

            var url       = apiHost + "/coupon/download?#";
            var timeStamp = StringHelperHere.Instance.GetTimeStamp();

            var    lastId = CouponOper.Instance.GetLastCoupon();
            string key    = "fdCkey";
            var    now    = DateTime.Now;
            var    path   = Server.MapPath("~/") + "/img/coupon/" + cname;

            path = path.Replace('/', '\\');
            for (int i = 0; i < amount; i++)
            {
                Coupon coupon = new Coupon();
                lastId++;
                var no       = StringHelperHere.Instance.GetLastFiveStr(lastId.ToString());
                var ran      = RandHelper.Instance.Str_char(1, true).ToLower();
                var word     = StringHelperHere.Instance.IntToKey(no);
                var couponNo = StringHelperHere.Instance.Encrypt(word, ran + key) + ran;
                coupon.batch      = timeStamp;
                coupon.couponNo   = couponNo;
                coupon.createTime = now;
                coupon.money      = money;
                coupon.isRepeat   = isRepeat;
                coupon.name       = cname;
                CouponOper.Instance.Add(coupon);

                var bitmap           = QCodeHelper.Instance.Create_ImgCode(url + couponNo, 32);
                DirectorySecurity ds = new DirectorySecurity();
                ds.SetAccessRule(new FileSystemAccessRule("Everyone", FileSystemRights.FullControl, AccessControlType.Allow));
                Directory.CreateDirectory(path, ds);
                var name    = couponNo;
                var pathStr = path + "\\" + name + ".jpg";
                bitmap.Save(pathStr, System.Drawing.Imaging.ImageFormat.Jpeg);
            }

            QCodeHelper.Instance.PackageFolder(path, path + ".zip", true);
            return(JsonConvert.SerializeObject(r));
            //return JsonHelper.Instance.JsonMsg(true, "");
        }
예제 #14
0
        public string Add(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            if (Session["pfId"] == null)
            {
                r.HttpCode = 300;
                return(JsonConvert.SerializeObject(r));
            }
            var phone    = req.userPhone;
            var birthday = req.birthday;

            if (ControllerHelper.Instance.IsExists("userinfo", "userphone", phone, "0"))
            {
                r.Message  = "已存在该手机号的用户";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }
            UserInfo user = new UserInfo();

            user.userName = req.userName;
            var balance = Convert.ToDecimal(req.userBalance);
            var coupon  = Convert.ToDecimal(req.coupon);

            if (balance < 0)
            {
                r.Message  = "余额不能为负数";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }
            if (coupon < 0)
            {
                r.Message  = "优惠券不能为负数";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }


            //user.userBalance = balance;
            if (req.userPwd != null)
            {
                user.userPwd = MD5Helper.Instance.StrToMD5(req.userPwd);
            }
            user.userPhone = phone;
            if (!string.IsNullOrEmpty(birthday))
            {
                user.birthday = Convert.ToDateTime(birthday);
            }
            user.coupon = coupon;

            UserInfoOper.Instance.Add(user);
            r.data = "";
            return(JsonConvert.SerializeObject(r));
        }
예제 #15
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb();

            r.HttpCode = 200;
            r.Message  = "";
            r.data     = "{}";
            DoDelete(Convert.ToInt32(req.foodTagId));
            return(JsonConvert.SerializeObject(r));
        }
예제 #16
0
        public string GetDownloadList(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            string search    = req.search == null ? "" : req.search; //搜索内容
            int    index     = Convert.ToInt32(req.index);           //页码
            int    pages     = 0;                                    //总页数
            int    size      = 12;                                   //一页size条数据
            var    isRepeat  = Convert.ToInt32(req.isRepeat);
            var    condition = " ";

            if (isRepeat != 2)
            {
                condition += " isRepeat=" + isRepeat + " and ";
            }
            condition += " 1=1 and  name like '%" + search + "%' ";

            string str     = "select * from couponView where " + condition + " order by createTime desc";
            var    listAll = SqlHelperHere.ExecuteGetList <CouponView>(str);

            if (listAll.Count < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }
            //分页
            var list2 = listAll.Skip((index - 1) * size).Take(size).ToArray();

            if (list2.Length < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }

            var count = listAll.Count;

            pages = count / size;
            //总页数
            pages = pages * size == count ? pages : pages + 1;
            var listR = new List <DownList>();

            foreach (var item in list2)
            {
                DownList d = new DownList(item);
                listR.Add(d);
            }

            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(listR), index);
            return(JsonConvert.SerializeObject(r));
        }
예제 #17
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };

            CouponOper.Instance.Delete(Convert.ToInt32(req.couponId));
            return(JsonConvert.SerializeObject(r));
        }
예제 #18
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };

            DoDelete(Convert.ToInt32(req.areaId));
            return(JsonConvert.SerializeObject(r));
        }
예제 #19
0
        public string update(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var lv     = req.lv;
            var id     = req.id;
            var thisLv = Convert.ToInt32(Session["lv"]);

            if (thisLv < lv)
            {
                r.Message  = "权限不够";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }
            var account = req.account;

            if (!StringHelperHere.Instance.IsAccountValidate(account))
            {
                r.Message  = "账号应为5~16位英文字母、数字";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }
            if (ControllerHelper.Instance.IsExists("platform", "account", account, id.ToString()))
            {
                r.Message  = "已存在该账号";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }
            var pwd = req.pwd;

            if (!StringHelperHere.Instance.IsPwdValidate(pwd))
            {
                r.Message  = "密码应为6~16位英文字母、数字";
                r.HttpCode = 500;
                return(JsonConvert.SerializeObject(r));
            }


            Platform pf = new Platform();

            pf.id      = id;
            pf.level   = lv;
            pf.account = account;
            pf.pwd     = pwd;
            PlatformOper.Instance.Update(pf);
            //return JsonHelperHere.JsonMsg(true, "");
            return(JsonConvert.SerializeObject(r));
        }
예제 #20
0
        /// <summary>
        /// 获取周标签
        /// </summary>
        /// <returns></returns>
        public string GetWeekTags(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var list = CacheHelper.GetByCondition <FoodTagInfo>("foodtaginfo", " isdeleted=0 and isWeek=1");

            r.data = JsonHelperHere.JsonPlus(true, JsonConvert.SerializeObject(list), "");
            return(JsonConvert.SerializeObject(r));
        }
예제 #21
0
        public string DeleteByTs(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var timestamp = req.timestamp;

            CouponOper.Instance.DeleteByTs(timestamp);
            return(JsonConvert.SerializeObject(r));
        }
예제 #22
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var id = req.riderId;

            RiderInfoOper.Instance.Delete(id);
            return(JsonConvert.SerializeObject(r));
        }
예제 #23
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var rsId = Convert.ToInt32(req.rsId);

            RiderStockOper.Instance.Delete(rsId);
            return(JsonConvert.SerializeObject(r));
        }
예제 #24
0
        public string BatchDel(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var ids = req.ids;

            SqlHelperHere.DeleteByIds("orderinfo", ids);
            return(JsonConvert.SerializeObject(r));
        }
예제 #25
0
        /// <summary>
        /// 发生错误之后
        /// </summary>
        /// <param name="filterContext">条件内容</param>
        //public  void OnException(ExceptionContext filterContext)
        //{
        //    JsonResult jsonResult = new JsonResult();
        //    ResultForWebRes result = new ResultForWebRes();
        //    result.status = false;
        //    result.message = filterContext.Exception.Message;
        //    jsonResult.Data = result;
        //    filterContext.Result = jsonResult;
        //    filterContext.ExceptionHandled = true;//这样表示异常已经处理,status code会是200,然后我的result也能返回给ajax的success
        //}

        /// <summary>
        /// 发生错误之后
        /// </summary>
        /// <param name="filterContext">条件内容</param>
        public void OnException(ExceptionContext filterContext)
        {
            JsonResult   jsonResult = new JsonResult();
            ResultForWeb result     = new ResultForWeb();

            result.HttpCode                = 500;
            result.Message                 = filterContext.Exception.Message;
            jsonResult.Data                = result;
            jsonResult.ContentType         = "application/json";
            jsonResult.JsonRequestBehavior = JsonRequestBehavior.AllowGet;
            filterContext.Result           = jsonResult;
            filterContext.ExceptionHandled = true;
        }
예제 #26
0
        public string Delete(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var serverPath = this.Server.MapPath("/");

            ArticleInfoOper.Instance.Delete(Convert.ToInt32(req.articleId), serverPath);
            return(JsonConvert.SerializeObject(r));
        }
예제 #27
0
        //用了
        public string GetFoodInfo(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var foodId = req.foodId;
            var food   = FoodInfoOper.Instance.GetById(foodId);

            r.data = JsonConvert.SerializeObject(food);
            return(JsonConvert.SerializeObject(r));
        }
예제 #28
0
        public string GetRiderPhone(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var riderId = req.riderId;
            var rider   = RiderInfoOper.Instance.GetById(riderId);

            r.data = rider.phone;//-txy
            return(JsonConvert.SerializeObject(r));
        }
예제 #29
0
        public string Get(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var riderType = req.riderType;
            var areaId    = req.areaId;

            Dictionary <int, string> dict = AreaInfoOper.Instance.GetAreaDict();
            string search = req.search ?? "";           //搜索内容
            int    index  = Convert.ToInt32(req.index); //页码
            int    pages  = 0;                          //总页数
            int    size   = 12;                         //一页size条数据

            var condition = " 1=1 and ";

            if (riderType != 3)
            {
                condition += "  ridertype=" + riderType + " and";
            }
            if (areaId != 0)
            {
                condition += "  riderareaid=" + areaId + " and";
            }

            condition += "  ( rideraccount like '%" + search + "%' or name like '%" + search + "%' or areaname like '%" + search + "%' or mapaddress like '%" + search + "%'  )";

            var listAll = CacheHelper.GetDistinctCount <RiderView>("RiderView", condition);

            if (listAll.Count < 1)
            {
                r.data = JsonHelperHere.EmptyJson();
                return(JsonConvert.SerializeObject(r));
            }
            var ids    = listAll.Skip((index - 1) * size).Take(size).Select(p => p.id).ToArray();
            var idsStr = string.Join(",", ids);

            var viewList = CacheHelper.GetByCondition <RiderView>("RiderView", " id in (" + idsStr + ")");

            var count = listAll.Count;

            pages = count / size;
            pages = pages * size == count ? pages : pages + 1;//总页数

            r.data = JsonHelperHere.JsonAddPage(pages, JsonConvert.SerializeObject(viewList.OrderByDescending(p => p.id)), index);
            return(JsonConvert.SerializeObject(r));
        }
예제 #30
0
        /// <summary>
        /// 获取最近使用的地址
        /// </summary>
        /// <param name="req"></param>
        /// <returns></returns>
        public string GetRecentlyAddress(webReq req)
        {
            ResultForWeb r = new ResultForWeb
            {
                HttpCode = 200,
                Message  = "",
                data     = "{}"
            };
            var userId = req.userId;
            var ua     = UserAddressOper.Instance.GetRecentlyAddr(userId).FirstOrDefault();

            r.data = JsonConvert.SerializeObject(ua);
            return(JsonConvert.SerializeObject(r));
        }