示例#1
0
        private string SendSMS(string vaildphone, string content)
        {
            var webutils = new CySoft.Utility.WebUtils();
            var reqUrl   = string.Format("{0}", System.Configuration.ConfigurationManager.AppSettings["CyUserMsgUrl"]);
            var Md5Key   = string.Format("{0}", System.Configuration.ConfigurationManager.AppSettings["Md5KeySMS"]);
            IDictionary <string, string> ps = new Dictionary <string, string>();
            Random random = new Random();
            var    code   = random.Next(1000, 9999);

            ps.Add("phone", vaildphone);
            ps.Add("content", content);
            ps.Add("client", "window");
            ps.Add("client_ver", "7");
            ps.Add("flag_from", "YUNPOS");
            ps.Add("sign", SignUtils.SignRequestForCyUserSys(ps, Md5Key));
            return(webutils.DoPost(reqUrl, ps, 30000));
        }
示例#2
0
        public ActionResult GetServiceShopspByBarcodeDB()
        {
            var sr = RequestResult(res =>
            {
                #region 获取参数
                Hashtable param = base.GetParameters();
                ParamVessel p   = new ParamVessel();
                p.Add("id_shop", string.Empty, HandleType.ReturnMsg);       //id_shop
                p.Add("id_masteruser", string.Empty, HandleType.ReturnMsg); //id_masteruser
                p.Add("barcode", string.Empty, HandleType.ReturnMsg);       //barcode
                p.Add("sign", string.Empty, HandleType.ReturnMsg);          //sign
                #endregion
                #region 验证参数
                try
                {
                    param = param.Trim(p);
                }
                catch (Exception ex)
                {
                    res.State   = ServiceState.Fail;
                    res.Message = ServiceFailCode.A0001;
                    return(res);
                }
                #endregion
                #region 读取ticket
                //读取ticket
                Hashtable ht = new Hashtable();
                ht.Add("key_y", param["id_masteruser"].ToString() + "_" + param["id_shop"].ToString());
                var ticketBr = base.GetTicketInfo(param["id_masteruser"].ToString() + "_" + param["id_shop"].ToString());
                if (!ticketBr.Success)
                {
                    res.State   = ServiceState.Fail;
                    res.Message = ServiceFailCode.S0001;
                    return(res);
                }
                var ticketModel = (Tb_Ticket)ticketBr.Data;
                if (ticketModel == null)
                {
                    res.State   = ServiceState.Fail;
                    res.Message = ServiceFailCode.A0003;
                    return(res);
                }
                var ticket = ticketModel.ticket;
                #endregion
                #region 验证签名
                IDictionary <string, string> dic = base.GetParameters(new string[] { "id_shop", "id_masteruser", "barcode" });
                var validSign = SignUtils.SignRequest(dic, ticket);
                //验证签名
                if (param["sign"].ToString() != validSign)
                {
                    res.State   = ServiceState.Fail;
                    res.Message = ServiceFailCode.A0002;
                    return(res);
                }
                #endregion
                #region 调用接口获取数据

                var paramters = new Dictionary <string, string>();
                paramters.Add("barCode", param["barcode"].ToString());
                paramters.Add("sign", SignUtils.SignRequestForCyUserSys(paramters, PublicSign.shopspMD5Key));
                var webutils  = new CySoft.Utility.WebUtils();
                var respStr   = webutils.DoPost(PublicSign.shopspUrl, paramters, 30000);
                var respModel = JSON.Deserialize <ServiceResult>(respStr);

                if (respModel != null)
                {
                    if (respModel.State != ServiceState.Done)
                    {
                        res.State   = ServiceState.Fail;
                        res.Message = "操作失败,调用商品服务接口失败,Message:" + respModel.Message;
                        res.Data    = respModel;
                        return(res);
                    }
                    else
                    {
                        if (respModel.Data != null)
                        {
                            if (!string.IsNullOrEmpty(respModel.Data.ToString()))
                            {
                                var dbModel = JSON.Deserialize <Tb_Shopsp_Service>(respModel.Data.ToString());
                                if (dbModel.BarCode != null)
                                {
                                    dbModel.BarCode = dbModel.BarCode.Trim();
                                }
                                if (dbModel.ProductName != null)
                                {
                                    dbModel.ProductName = dbModel.ProductName.Trim();
                                }
                                if (dbModel.Unit != null)
                                {
                                    dbModel.Unit = dbModel.Unit.Trim();
                                }
                                if (dbModel.Picture != null)
                                {
                                    dbModel.Picture = dbModel.Picture.Trim();
                                }
                                res.Data = dbModel;
                            }
                        }
                    }
                }

                #endregion
                #region 返回
                res.State   = ServiceState.Done;
                res.Message = "操作成功";

                return(res);

                #endregion
            });

            #region 数据处理
            var            jsonString     = JSON.Serialize(sr);;
            string         rp             = @"\\/Date\((\d+)\)\\/";
            MatchEvaluator matchEvaluator = new MatchEvaluator(this.ConvertJsonDateToDateString);
            Regex          reg            = new Regex(rp);
            jsonString = reg.Replace(jsonString, matchEvaluator);

            string         p2 = @"\\/Date\(([/+/-]\d+)\)\\/";
            MatchEvaluator matchEvaluator2 = new MatchEvaluator(this.ConvertJsonDateToDateString);
            Regex          reg2            = new Regex(p2);
            jsonString = reg2.Replace(jsonString, matchEvaluator2);
            #endregion

            return(Content(jsonString));
        }
示例#3
0
        public BaseResult GetShopSpByTMK(Hashtable param)
        {
            BaseResult br = new BaseResult();

            br.Level = ErrorLevel.Question;
            #region 调用接口获取数据
            try
            {
                if (PublicSign.shopspCheckAPI == "1")
                {
                    #region 调用接口
                    var paramters = new Dictionary <string, string>();
                    paramters.Add("barCode", param["barcode"].ToString());
                    paramters.Add("sign", SignUtils.SignRequestForCyUserSys(paramters, PublicSign.shopspMD5Key));
                    var webutils  = new CySoft.Utility.WebUtils();
                    var respStr   = webutils.DoPost(PublicSign.shopspUrl, paramters, 30000);
                    var respModel = JSON.Deserialize <ServiceResult>(respStr);

                    if (respModel != null)
                    {
                        if (respModel.State != ServiceState.Done)
                        {
                            br.Success = false;
                            br.Message.Clear();
                            br.Message.Add(string.Format("查询接口失败"));
                            br.Data = null;
                            return(br);
                        }
                        else
                        {
                            br.Success = true;
                            br.Message.Clear();
                            br.Message.Add(string.Format("查询接口成功"));
                            br.Data = null;

                            if (respModel.Data != null)
                            {
                                if (!string.IsNullOrEmpty(respModel.Data.ToString()))
                                {
                                    var dbModel = JSON.Deserialize <Tb_Shopsp_Service>(respModel.Data.ToString());
                                    var rModel  = new ShopspList_Query()
                                    {
                                        bm       = dbModel.BarCode,
                                        barcode  = dbModel.BarCode,
                                        mc       = dbModel.ProductName,
                                        dw       = dbModel.Unit,
                                        dj_ls    = dbModel.SellingPrice,
                                        pic_path = dbModel.Picture,
                                        source   = "barcodedb"
                                    };
                                    if (rModel.bm != null)
                                    {
                                        rModel.bm = rModel.bm.Trim();
                                    }
                                    if (rModel.barcode != null)
                                    {
                                        rModel.barcode = rModel.barcode.Trim();
                                    }
                                    if (rModel.mc != null)
                                    {
                                        rModel.mc = rModel.mc.Trim();
                                    }
                                    if (rModel.dw != null)
                                    {
                                        rModel.dw = rModel.dw.Trim();
                                    }
                                    if (rModel.pic_path != null)
                                    {
                                        rModel.pic_path = rModel.pic_path.Trim();
                                    }

                                    br.Data = rModel;
                                    return(br);
                                }
                            }
                        }
                    }
                    else
                    {
                        br.Success = false;
                        br.Message.Clear();
                        br.Message.Add(string.Format("查询接口数据出现异常 请重试"));
                        br.Data = null;
                        return(br);
                    }
                    #endregion
                }
                else
                {
                    #region  需要调用接口直接返回成功
                    br.Success = true;
                    br.Message.Clear();
                    br.Message.Add(string.Format("查询接口成功"));
                    br.Data = null;
                    return(br);

                    #endregion
                }
            }
            catch (Exception ex)
            {
                br.Success = false;
                br.Message.Clear();
                br.Message.Add(string.Format("查询接口出现异常 请重试"));
                br.Data = null;
                return(br);
            }
            #endregion
            return(br);
        }
示例#4
0
        public ActionResult Home()
        {
            var       v     = version;
            Hashtable param = base.GetParameters();

            //if (!param.ContainsKey("controller") || !param.ContainsKey("action"))
            //{
            //TODO:菜单查库
            #region 后期查库

            int            index     = 0;
            List <Tb_Menu> list_menu = new List <Tb_Menu>();



            #endregion 后期查库

            //查询用户所有的菜单权限树
            var userPurview = BusinessFactory.AccountFunction.GetUserMenu(id_user);
            if (userPurview != null)
            {
                var tree      = userPurview.Data as List <Tb_Function_Tree>;
                var role_str  = GetLoginInfo <string>("role_str");
                var isManager = role_str.Split(',').ToList().Any(a => a == "2");
                if (tree != null && tree.Any())
                {
                    var menus = tree[0].children;
                    //遍历菜单权限树
                    foreach (var menu in menus)
                    {
                        if ((menu.version + "").Split(',').All(a => a != v))
                        {
                            continue;
                        }
                        List <Tb_Menu_Item> menuItems = new List <Tb_Menu_Item>();
                        if (menu.children.Any())
                        {
                            foreach (var subItem in menu.children)
                            {
                                if ((subItem.version + "").Split(',').All(a => a != v))
                                {
                                    continue;
                                }

                                //if (!string.IsNullOrEmpty(id_shop)
                                //    && id_shop != id_shop_master
                                //    && (
                                //        subItem.controller_name.ToLower() == "psck"
                                //        || subItem.controller_name.ToLower() == "psfprk"
                                //        || subItem.controller_name.ToLower() == "pscktzd"
                                //        || subItem.controller_name.ToLower() == "psfptzd"
                                //        ) //&& !isManager
                                //    )
                                //{
                                //    continue;
                                //}
                                if (!(id_shop_info.flag_type == 1 || id_shop_info.flag_type == 2) &&
                                    (
                                        subItem.controller_name.ToLower() == "psck" ||
                                        subItem.controller_name.ToLower() == "psfprk" ||
                                        subItem.controller_name.ToLower() == "pscktzd" ||
                                        subItem.controller_name.ToLower() == "psfptzd"
                                    )
                                    )
                                {
                                    continue;
                                }

                                if (id_shop_info.flag_type != 1 &&
                                    subItem.controller_name.ToLower() == "shop" && subItem.action_name.ToLower() == "shopinfo")
                                {
                                    continue;
                                }

                                if (!(id_shop_info.flag_type == 1 || id_shop_info.flag_type == 2) &&
                                    subItem.controller_name.ToLower() == "shop" && subItem.action_name.ToLower() == "list")
                                {
                                    continue;
                                }


                                menuItems.Add(new Tb_Menu_Item()
                                {
                                    ActionName     = subItem.action_name,
                                    ControllerName = subItem.controller_name,
                                    HasRemark      = false,
                                    ID             = subItem.id,
                                    Name           = subItem.name,
                                    Title          = subItem.name,
                                    TabTitle       = subItem.name,
                                    Remark         = subItem.name,
                                    TagName        = subItem.tag_name,
                                    sort_id        = subItem.sort_id == null ? 10000000 : subItem.sort_id.Value
                                });
                            }
                        }
                        list_menu.Add(new Tb_Menu()
                        {
                            ID    = menu.id,
                            Icon  = menu.icon,
                            Name  = menu.name,
                            Title = menu.name,
                            Items = menuItems
                        });
                    }
                }
            }

            ViewData["list_menu"] = list_menu;
            Hashtable ht = new Hashtable();
            ht.Add("id_masteruser", id_user_master);
            ht.Add("id_shop", id_shop);
            var date = DateTime.Now;
            ht.Add("lgrq", new DateTime(date.Year, date.Month, date.Day));
            ht.Add("bgrq", new DateTime(date.Year, date.Month, date.Day, 23, 59, 59, 999));
            ViewData["ShowData"]  = BusinessFactory.Td_Ls_1.Get(ht).Data;
            ViewData["date_type"] = "0";

            param.Clear();
            param.Add("flag_stop", 0);
            param.Add("flag_type", "action");
            ViewData["dialog_tab_ids"] = BusinessFactory.Function.GetAll(param).Data;

            #region 验服务以及获取购买服务地址

            if (PublicSign.flagCheckService == "1")
            {
                var bm = BusinessFactory.Account.GetServiceBM(version);
                if (!string.IsNullOrEmpty(bm))
                {
                    ht.Clear();
                    ht.Add("id_cyuser", id_cyuser);
                    ht.Add("bm", bm);
                    ht.Add("service", "GetService");
                    ht.Add("id_masteruser", id_user_master);
                    ht.Add("rq_create_master_shop", rq_create_master_shop.ToString());
                    var cyServiceHas = BusinessFactory.Account.GetCYService(ht);
                    if (cyServiceHas != null && cyServiceHas.ContainsKey("cyServiceList") && cyServiceHas.ContainsKey("endTime"))
                    {
                        var cyServiceList = (List <Schedule_UserService>)cyServiceHas["cyServiceList"];
                        if (cyServiceList.Count() == 0)
                        {
                            ViewData["vEndData"] = cyServiceHas["endTime"].ToString();
                        }
                        else
                        {
                            DateTime dt = DateTime.Now;
                            if (DateTime.TryParse(cyServiceHas["endTime"].ToString(), out dt))
                            {
                                if (dt > DateTime.Parse("1900-01-01 00:00:00"))
                                {
                                    ViewData["vEndData"] = cyServiceHas["endTime"].ToString();
                                }
                            }
                        }
                    }

                    ht.Clear();
                    ht.Add("id_cyuser", id_cyuser);
                    ht.Add("id", bm);
                    ht.Add("phone", phone_master);
                    ht.Add("service", "Detail");
                    ht.Add("id_masteruser", id_user_master);
                    string buyUrl = BusinessFactory.Tb_Shop.GetBuyServiceUrl(ht);
                    if (string.IsNullOrEmpty(buyUrl))
                    {
                        buyUrl = PublicSign.cyBuyServiceUrl;
                    }
                    ViewData["buyUrl"] = buyUrl;
                }
            }
            #endregion

            ViewData["downUrl"]  = PublicSign.downUrl;
            ViewData["cusName"]  = System.Configuration.ConfigurationManager.AppSettings["CUSTOMER_YUNPOS_CUS"];
            ViewData["cusPhone"] = System.Configuration.ConfigurationManager.AppSettings["CUSTOMER_YUNPOS_PHONE"];
            ViewData["cusTel"]   = System.Configuration.ConfigurationManager.AppSettings["CUSTOMER_YUNPOS_TEL"];
            ViewData["cusQQ"]    = System.Configuration.ConfigurationManager.AppSettings["CUSTOMER_YUNPOS_QQ"];
            ViewData["cusEamil"] = System.Configuration.ConfigurationManager.AppSettings["CUSTOMER_YUNPOS_EMAIL"];

            //生成购买历史的 登录地址
            var paramters = new Dictionary <string, string>();
            paramters.Add("uid", id_cyuser);
            string ps = MD5Encrypt.Encode(Encoding.UTF8, "cy.$" + id_cyuser + "+#" + phone_master + "*" + DateTime.Now.ToString("yyyyMMddHH"));
            paramters.Add("ps", ps);
            string mySign = SignUtils.SignRequestForCyUserSys(paramters, PublicSign.md5KeyBusiness);
            paramters.Add("sign", mySign);
            string url = PublicSign.cyBuyServiceHistoryUrl + "?" + WebUtils.BuildQuery2(paramters);
            ViewData["cyBuyServiceHistoryUrl"] = url;


            int pageIndex = 0;
            int limit     = 10;
            param.Clear();
            param.Add("flag_delete", (int)Enums.FlagDelete.NoDelete);
            param.Add("page", pageIndex);
            param.Add("pageSize", limit);
            param.Add("sort", "rq_create desc");
            param.Add("limit", limit);
            param.Add("start", pageIndex * limit);
            PageNavigate pn = new PageNavigate();
            pn = BusinessFactory.Ts_Notice.GetPage(param);
            var plist = new PageList <Ts_Notice_View>(pn, pageIndex, limit);
            ViewData["notice_list"]   = plist;
            ViewData["cyLoginOutUrl"] = PublicSign.cyLoginOutUrl;

            return(View("Home"));
        }