Esempio n. 1
0
        private OtherResult UpGetTime(HttpContext con)
        {
            OtherResult res = new OtherResult();

            if (con.Request["id"] == null)
            {
                res.IsSuccess = false;
                res.Message   = "商品ID为必须参数";
            }
            DateTime dtNow = DateTime.Now;
            string   id    = con.Request["id"].ToString();

            BLL.TljInfo   bllTljInfo   = new BLL.TljInfo();
            Model.TljInfo ModelTljInfo = new Model.TljInfo();
            ModelTljInfo = bllTljInfo.GetModel(int.Parse(id));
            if (ModelTljInfo != null)
            {
                ModelTljInfo.ifget   = true;
                ModelTljInfo.gettime = dtNow;
            }
            bllTljInfo.Update(ModelTljInfo);

            object obj = new
            {
                ifget   = "是",
                gettime = dtNow.ToString("yyyy-MM-dd HH:mm:ss")
            };

            res.IsSuccess = true;
            res.Message   = JsonHelper.JsonSerializer <object>(obj);
            return(res);
        }
Esempio n. 2
0
        private OtherResult GetGoodsInfo(HttpContext con)
        {
            OtherResult res = new OtherResult();

            string siteid   = "";
            string adzoneid = "";
            string setname  = "";
            string appkeyid = "";


            if (con.Request["id"] == null)
            {
                res.IsSuccess = false;
                res.Message   = "商品ID为必须参数";
            }
            string activityid = "";


            if (con.Request["activityid"] != null)
            {
                activityid = con.Request["activityid"].ToString();
                if (activityid.IndexOf("activityId") > 0)
                {
                    activityid = activityid.Substring(activityid.IndexOf("activityId"));
                    if (activityid.IndexOf("&") > 0)
                    {
                        activityid = activityid.Substring(0, activityid.IndexOf("&"));
                    }
                    activityid = "&" + activityid;
                }
                else
                {
                    activityid = "";
                }
            }

            if (con.Request["appkeyid"] != null)
            {
                appkeyid    = con.Request["appkeyid"].ToString();
                modelAppKey = bllappkey.GetModel(int.Parse(appkeyid));

                //根据appkeyid 读取   三个基础参数
                siteid   = modelAppKey.SiteId;
                adzoneid = modelAppKey.AdzoneId;
                setname  = modelAppKey.TbAccount;
            }
            string id = con.Request["id"].ToString();

            if (id.IndexOf("http") != -1)
            {
                string link  = id;
                Regex  reg   = new Regex("id=(.+)&?");
                Match  match = reg.Match(link);
                id = match.Groups[1].Value;
            }

            string strContent = HttpHelper.HttpGet("http://g5.vipdamai.net/ZhuanKouLin.aspx?moshi=jiance&keyword=https://detail.tmall.com/item.htm?id=" + id + "&siteid=" + siteid + "&adzoneid=" + adzoneid + "&setname=" + setname + activityid);

            strContent = strContent.TrimStart("\"".ToArray()).TrimEnd("\"".ToArray());
            string temp = "";

            temp      += "<?xml version=\"1.0\" encoding=\"utf-16\"?>";
            temp      += "<goodsinfo xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">";
            strContent = temp + strContent + "</goodsinfo>";

            var obj = XmlUtil.DeserializeXml <Model.goodsinfo>(strContent);

            int      total  = 0;
            DateTime zcTime = DateTime.Now.AddMonths(-1);

            var plansList   = bllPlans.GetList(1, int.MaxValue, ref total, m => m.item_id != null && m.item_id == id && m.zctime >= zcTime, m => m.id);
            var plansListOk = plansList.Where(m => m.zhanghaos_ok != null && (m.zhanghaos_ok.StartsWith(modelAppKey.TbAccount) ||
                                                                              m.zhanghaos_ok.EndsWith(modelAppKey.TbAccount) || m.zhanghaos_ok.Contains("#" + modelAppKey.TbAccount + "#")) && m.ifok == "正常").ToList();

            if (plansListOk.Count > 0)
            {
                obj.campaignType = "DX";
            }
            else if (total > 0)
            {
                obj.campaignType = "MKT";
            }
            else
            {
                obj.campaignType = "";
            }
            res.IsSuccess = true;
            res.Message   = JsonHelper.JsonSerializer <object>(obj);

            return(res);
        }