Exemplo n.º 1
0
        public string HariStyleListList([FromBody] SUIDPAGE model)
        {
            string value = CodeHelp.GetResults(0, "失败", "");

            if (string.IsNullOrEmpty(model.suid.ToString()))
            {
                value = CodeHelp.GetResults(0, "失败", "沙龙ID不能为空");
            }
            else
            {
                if (!CHKsal(model.suid.ToString()))
                {
                    value = CodeHelp.GetResults(0, "无法找到页面,该沙龙暂时不提供此服务。", "沙龙未开通");
                    return(value);
                }
                var str = CacheManage.GetCache("SearchHotHair" + model.suid);
                if (str == null)
                {
                    int                  pageindex = 1;
                    int                  pagesize  = 100;
                    int                  rowcount  = 0;
                    int                  pagecount = 0;
                    HairListService      hise      = new HairListService();
                    List <HariStyleList> list      = new List <HariStyleList>();
                    //获取沙龙发型师信息
                    list = hise.GetHariStyleListList(model.suid, pageindex, pagesize, out rowcount, out pagecount);
                    if (list != null && list.Count > 0)
                    {
                        string saloninfo = cacheInfo(model.suid.ToString());
                        if (!string.IsNullOrEmpty(saloninfo))
                        {
                            saloninfo = saloninfo.Replace("|*-*|", "`");
                            string[] info = saloninfo.Split('`');
                            list[0].salonname = info[0];
                            list[0].salonlogo = info[1];
                        }
                        value = CodeHelp.GetResults(1, "成功", list).ToLower();
                        CacheManage.SetCacheMinutes("SearchHotHair" + model.suid, value, 60);
                    }
                    else
                    {
                        value = CodeHelp.GetResults(0, "尚未绑定发型师", "");
                    }
                }
                else
                {
                    try
                    {
                        value = str.ToString();
                    }
                    catch
                    {
                        value = CodeHelp.GetResults(0, "失败", "未取到数据");
                    }
                }
            }
            return(value);
        }
Exemplo n.º 2
0
        public string ShowList([FromBody] SUIDPAGE model)
        {
            if (string.IsNullOrEmpty(model.suid.ToString()))
            {
                return("-1");
            }
            //if (string.IsNullOrEmpty(model.pageindex))
            //{
            //    return "-2";
            //}
            //int pageindex = 0;
            //int pagesize = 0;
            //try
            //{
            //    pageindex = int.Parse(model.pageindex);
            //    pagesize = int.Parse(model.pagesize);
            //}
            //catch
            //{
            //    return "-3";
            //}
            if (!CHKsal(model.suid.ToString()))
            {
                return(CodeHelp.GetResults(0, "无法找到页面,该沙龙暂时不提供此服务。", "沙龙未开通"));
            }
            HairListService hise = new HairListService();
            string          str  = "";

            try
            {
                //获取沙龙下所有发型师的UID
                str = hise.GetHariStyleListID(model.suid);
            }
            catch
            { }
            try
            {
                if (string.IsNullOrEmpty(str))
                {
                    return(CodeHelp.GetResults(0, "暂无作品", ""));
                }
                ///API地址
                string url1 = "/api/weisalon/gethairweibolist";
                ///API参数
                string paramstr1 = "uid=" + str;
                //获取返回值(Json)
                string responseBody1 = Common.GetResponseResult(url1, paramstr1).ToLower();
                //ViewBag.responseBody1 = responseBody1;
                string retvalue = responseBody1.Replace("\r\n", "").Replace(" ", "");
                if (!string.IsNullOrEmpty(retvalue))
                {
                    var data = JSONHelper.JSONToObject <Dictionary <string, object> >(retvalue);
                    if (data.ContainsKey("status") && data["status"].ToString() == "1")
                    {
                        string saloninfo = cacheInfo(model.suid.ToString());
                        if (!string.IsNullOrEmpty(saloninfo))
                        {
                            saloninfo = saloninfo.Replace("|*-*|", "`");
                            string[] info = saloninfo.Split('`');
                            retvalue = retvalue.Replace("\"integralchange\":null", "\"salonname\":\"" + info[0] + "\",\"salonlogo\":\"" + info[1] + "\"");
                        }
                    }
                }
                return(retvalue);
            }
            catch
            {
                return(CodeHelp.GetResults(0, "失败", ""));
            }
        }