Exemplo n.º 1
0
        public ActionResult ResetShopState()
        {
            int id    = DoRequest.GetFormInt("id");
            int state = DoRequest.GetFormInt("state");

            int returnValue = -1;
            var res         = ModifyShopState.Do(id, state);

            if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null)
            {
                returnValue = Utils.StrToInt(res.Header.Result.Code, -1);
            }
            if (returnValue == 0)
            {
                DoCache cache = new DoCache();
                cache.RemoveCache("shoplist");
                return(Json(new { error = false, message = "操作成功!" }));
            }

            return(Json(new { error = true, message = "操作失败" }));
        }
Exemplo n.º 2
0
        public ActionResult PostShopData()
        {
            int      shopid = DoRequest.GetFormInt("shopid");
            ShopInfo shop   = GetShopDetail.Do(shopid).Body;

            if (shop == null)
            {
                shop         = new ShopInfo();
                shop.shop_id = 0;
            }
            shop.shop_name    = DoRequest.GetFormString("shopName");
            shop.company_name = DoRequest.GetFormString("Company");
            shop.shop_key     = DoRequest.GetFormString("skeyword");

            string pswd = DoRequest.GetFormString("spsword");

            if ((pswd.Equals("") || pswd == null) && shop.shop_id == 0)
            {
                return(Json(new { error = true, message = "[密码] 不能为空" }));
            }
            if (!pswd.Equals("") && pswd != null)
            {
                shop.shop_pswd = AES.Decode2(pswd, "5f9bf958d112f8668ac53389df8bceba");
            }
            int province = DoRequest.GetFormInt("province");
            int city     = DoRequest.GetFormInt("city");

            shop.area_id   = province;
            shop.shop_addr = GetArea.Do(province).Body.area_list[0].area_name;
            string cityName = GetArea.Do(city).Body.area_list[0].area_name;

            if (!cityName.StartsWith("市辖") && !cityName.StartsWith("直辖"))
            {
                shop.shop_addr += cityName;
            }
            shop.link_way        = DoRequest.GetFormString("linkway");
            shop.support_express = DoRequest.GetFormString("supportexpress");
            shop.delivery_intro  = DoRequest.GetFormString("deliveryintro");
            shop.service_intro   = DoRequest.GetFormString("serviceintro", false);

            string   sdate     = DoRequest.GetFormString("sdate").Trim();
            int      shours    = DoRequest.GetFormInt("shours");
            int      sminutes  = DoRequest.GetFormInt("sminutes");
            DateTime startDate = Utils.IsDateString(sdate) ? DateTime.Parse(sdate + " " + shours + ":" + sminutes + ":00") : DateTime.Now;

            string   edate    = DoRequest.GetFormString("edate").Trim();
            int      ehours   = DoRequest.GetFormInt("ehours");
            int      eminutes = DoRequest.GetFormInt("eminutes");
            DateTime endDate  = Utils.IsDateString(edate) ? DateTime.Parse(edate + " " + ehours + ":" + eminutes + ":59") : DateTime.Now.AddDays(7);

            shop.notice_btime = startDate.ToString("yyyy-MM-dd HH:mm:ss");
            shop.notice_etime = endDate.ToString("yyyy-MM-dd HH:mm:ss");
            shop.shop_notice  = DoRequest.GetFormString("shopnotice", false);
            shop.shop_remark  = DoRequest.GetFormString("remarks");
            shop.shop_type    = DoRequest.GetFormInt("shoptype");
            #region Checking
            if (shop.shop_name.Length < 1)
            {
                return(Json(new { error = true, message = "[店铺名称] 不能为空" }));
            }
            if (shop.shop_name.Length > 50)
            {
                return(Json(new { error = true, message = "[店铺名称] 不能大于50个字符" }));
            }
            if (shop.company_name.Length < 0 && shop.company_name.Length > 100)
            {
                return(Json(new { error = true, message = "[公司名称] 不能为空或大于100个字符" }));
            }
            if (shop.shop_key.Length < 1)
            {
                return(Json(new { error = true, message = "[账号] 不能为空" }));
            }
            if (shop.shop_pswd.Length < 1)
            {
                return(Json(new { error = true, message = "[密码] 不能为空" }));
            }
            if (shop.area_id < 0)
            {
                return(Json(new { error = true, message = "[发货地址] 不能为空" }));
            }
            if (shop.shop_addr.Length < 1)
            {
                return(Json(new { error = true, message = "[联系方式] 不能为空" }));
            }
            if (shop.support_express.Length < 1)
            {
                return(Json(new { error = true, message = "[快递公司] 不能为空" }));
            }
            #endregion

            int returnValue = -1;
            var res         = OpShopInfo.Do(shop);
            if (res != null && res.Header != null && res.Header.Result != null && res.Header.Result.Code != null)
            {
                returnValue = Utils.StrToInt(res.Header.Result.Code, -1);
            }

            if (returnValue == 0)
            {
                DoCache cache = new DoCache();
                cache.RemoveCache("shoplist");
                return(Json(new { error = false, message = "操作成功" }));
            }
            return(Json(new { error = true, message = "操作失败" }));
        }
Exemplo n.º 3
0
        public ActionResult UserList()
        {
            UserResBody currResBody = new UserResBody();

            foreach (UserResBody item in base._userResBody)
            {
                if (item.res_path.Equals("0,1,107,118,121,"))
                {
                    currResBody = item;
                    break;
                }
            }

            HasPermission(currResBody.res_id);

            ViewData["currResBody"] = currResBody;//当前菜单
            string position = "";

            ViewData["pageTitle"] = base.FormatPageTile(currResBody, ref position);
            ViewData["position"]  = position;//页面位置

            int                  pagesize  = DoRequest.GetQueryInt("size", 60);
            int                  pageindex = DoRequest.GetQueryInt("page", 1);
            string               q         = DoRequest.GetQueryString("q");
            int                  state     = DoRequest.GetQueryInt("state", -1);
            int                  usertype  = DoRequest.GetQueryInt("usertype", -1);
            DateTime             date      = DateTime.Now.AddYears(-3);
            DateTime             sDate     = DoRequest.GetQueryDate("sDate", date);
            DateTime             eDate     = DoRequest.GetQueryDate("eDate", DateTime.Now);
            int                  dataCount = 0;
            int                  pageCount = 0;
            List <ShortUserInfo> infoList  = new List <ShortUserInfo>();
            DoCache              cache     = new DoCache();
            string               cachekey  = "user-QueryUserListindex=" + pageindex + "state=" + state + "type=" + usertype + "sdate=" + sDate.ToString("yyyy-MM-dd") + "edate=" + eDate.ToString("yyyy-MM-dd") + "q=" + q;

            if (cache.GetCache(cachekey) == null)
            {
                var resp = QueryUserList.Do(pagesize, pageindex, state, usertype, sDate.ToString("yyyy-MM-dd 00:00:00"), eDate.ToString("yyyy-MM-dd 23:59:59"), q, ref dataCount, ref pageCount);
                if (resp != null && resp.Body != null && resp.Body.user_list != null)
                {
                    infoList = resp.Body.user_list;
                    cache.SetCache(cachekey, infoList, 300);
                    cache.SetCache("userdatacount", dataCount, 300);
                    if (infoList.Count == 0)
                    {
                        cache.RemoveCache(cachekey);
                    }
                }
            }
            else
            {
                infoList  = (List <ShortUserInfo>)cache.GetCache(cachekey);
                dataCount = (int)cache.GetCache("userdatacount");
            }

            ViewData["infoList"] = infoList;                                         //数据列表

            System.Text.StringBuilder currPageUrl = new System.Text.StringBuilder(); //拼接当前页面URL
            currPageUrl.Append("/musers/userlist?");
            currPageUrl.Append("&size=" + pagesize);
            currPageUrl.Append("&page=" + pageindex);
            currPageUrl.Append("&q=" + DoRequest.UrlEncode(q));
            currPageUrl.Append("&state=" + state);
            currPageUrl.Append("&usertype=" + usertype);
            currPageUrl.Append("&sdate=" + sDate.ToString("yyyy-MM-dd"));
            currPageUrl.Append("&edate=" + eDate.ToString("yyyy-MM-dd"));
            ViewData["currPageUrl"] = currPageUrl;//当前页面的URL
            ViewData["pagesize"]    = pagesize;
            ViewData["pageindex"]   = pageindex;
            ViewData["dataCount"]   = dataCount;

            ViewData["pageIndexLink"]  = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());
            ViewData["pageIndexLink2"] = this.FormatPageIndex(dataCount, pagesize, pageindex, currPageUrl.ToString());

            return(View());
        }