コード例 #1
0
 private ITopRequest GetTopRequest(string query, bool?discount, bool?showCase, string type, string filter, int pageIndex, int pageSize)
 {
     if (type.Equals("onsale", StringComparison.OrdinalIgnoreCase))
     {
         ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
         req.Fields      = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query       = query;
         req.HasDiscount = discount;
         req.HasShowcase = showCase;
         req.PageNo      = pageIndex;
         req.PageSize    = pageSize;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.SellerCids = filter;
         }
         return(req);
     }
     else if (type.Equals("inventory", StringComparison.OrdinalIgnoreCase))
     {
         ItemsInventoryGetRequest req = new ItemsInventoryGetRequest();
         req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query  = query;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.Banner = filter;
         }
         req.PageNo   = pageIndex;
         req.PageSize = pageSize;
         return(req);
     }
     else
     {
         return(null);
     }
 }
コード例 #2
0
ファイル: html.aspx.cs プロジェクト: giagiigi/tete-for-taobao
    ///// <summary>
    ///// 清除店铺活动图片
    ///// </summary>
    ///// <param name="sender"></param>
    ///// <param name="e"></param>
    //protected void Button2_Click(object sender, EventArgs e)
    //{

    //}

    /// <summary>
    /// 增加活动图片到宝贝描述
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button3_Click(object sender, EventArgs e)
    {
        string appkey = "12159997";
        string secret = "614e40bfdb96e9063031d1a9e56fbed5";

        //保存到数据库
        string        name    = utils.NewRequest("detail", utils.RequestType.Form);
        string        istop   = utils.NewRequest("detailimgistop", utils.RequestType.Form);
        string        sql     = "UPDATE TCS_ShopConfig SET detailimgname = '" + name + "', detailimgistop = '" + istop + "' WHERE nick = '" + nick + "'";
        StringBuilder builder = new StringBuilder();

        utils.ExecuteNonQuery(sql);

        //上传到宝贝描述
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        for (int j = 1; j <= 500; j++)
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid";
            request.PageSize = 200;
            request.PageNo   = j;
            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            for (int i = 0; i < product.Content.Count; i++)
            {
                try
                {
                    //获取商品详细
                    ItemGetRequest requestItem = new ItemGetRequest();
                    requestItem.Fields = "desc";
                    requestItem.NumIid = product.Content[i].NumIid;
                    Item item = client.ItemGet(requestItem, session);

                    //判断是否增加过该图片
                    string newcontent = CreateDesc(item.Desc, istop);

                    //更新宝贝描述
                    IDictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("num_iid", product.Content[i].NumIid.ToString());
                    param.Add("desc", newcontent);
                    string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param);
                    builder.Append("宝贝ID:" + product.Content[i].NumIid.ToString() + "\r\n" + resultpro + "\r\n");
                }
                catch
                { }
            }

            if (product.Content.Count < 200)
            {
                break;
            }
        }

        File.WriteAllText(Server.MapPath("htmlLog/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + nick + ".txt"), builder.ToString());

        Response.Write("<script>alert('同步成功!');window.location.href='html.aspx';</script>");
        Response.End();
        return;
    }
コード例 #3
0
    private void BindData()
    {
        Common.Cookie cookie     = new Common.Cookie();
        string        taobaoNick = cookie.getCookie("nick");
        string        session    = cookie.getCookie("top_sessionblog");

        //COOKIE过期判断
        if (taobaoNick == "")
        {
            //SESSION超期 跳转到登录页
            Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
            Response.End();
        }

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取用户店铺商品列表
        TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();

        request.Fields   = "num_iid,title,price,pic_url";
        request.Q        = tbKey.Text;
        request.PageSize = 5;
        request.OrderBy  = "volume:desc";

        PageList <Item> product = new PageList <Item>();

        try
        {
            product = client.ItemsOnsaleGet(request, session);
        }
        catch (Exception e)
        {
            if (e.Message == "27:Invalid session:Session not exist")
            {
                //SESSION超期 跳转到登录页
                Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
                Response.End();
            }
            return;
        }
        rptProduct.DataSource = product.Content;
        rptProduct.DataBind();

        //数据绑定
        string    sqlNew = "SELECT TOP 10 * FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC";
        DataTable dtNew  = utils.ExecuteDataTable(sqlNew);

        rptAds.DataSource = dtNew;
        rptAds.DataBind();

        //数据绑定
        sqlNew = "SELECT * FROM TopBlogLink WHERE nick = '" + taobaoNick + "' ORDER BY id DESC";
        dtNew  = utils.ExecuteDataTable(sqlNew);

        rptLink.DataSource = dtNew;
        rptLink.DataBind();
    }
コード例 #4
0
    /// <summary>
    /// 数据绑定
    /// </summary>
    private void BindData()
    {
        Cookie cookie     = new Cookie();
        string taobaoNick = cookie.getCookie("nick");
        string session    = cookie.getCookie("top_sessiongroupbuy");

        //COOKIE过期判断
        if (taobaoNick == "")
        {
            //SESSION超期 跳转到登录页
            Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12287381'</script>");//12287381
            Response.End();
        }

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        string    sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
        DataTable dt  = utils.ExecuteDataTable(sql);

        rptShopCat.DataSource = dt;
        rptShopCat.DataBind();

        Repeater1.DataSource = dt;
        Repeater1.DataBind();

        //获取用户店铺商品列表
        TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");
        ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();

        request.Fields   = "num_iid,title,price,pic_url";
        request.PageSize = 10;

        PageList <Item> product = new PageList <Item>();

        try
        {
            product = client.ItemsOnsaleGet(request, session);
        }
        catch (Exception e)
        {
            if (e.Message == "27:Invalid session:Session not exist")
            {
                //SESSION超期 跳转到登录页
                Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12287381'</script>");
                Response.End();
            }
            return;
        }
        rptItems.DataSource = product.Content;
        rptItems.DataBind();

        //团购数据绑定
        string    sqlNew = "SELECT * FROM TopGroupBuy WHERE nick = '" + taobaoNick + "' AND isdelete = 0 ORDER BY id DESC";
        DataTable dtNew  = utils.ExecuteDataTable(sqlNew);

        rptAds.DataSource = dtNew;
        rptAds.DataBind();
    }
コード例 #5
0
    private void DeleteTaobaAutoOld(string session)
    {
        string appkey = "12132145";
        string secret = "1fdd2aadd5e2ac2909db2967cbb71e7f";
        //上传到宝贝描述
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        for (int j = 1; j <= 3; j++)
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid";
            request.PageSize = 200;
            request.PageNo   = j;
            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            for (int i = 0; i < product.Content.Count; i++)
            {
                try
                {
                    //获取商品详细
                    ItemGetRequest requestItem = new ItemGetRequest();
                    requestItem.Fields = "desc";
                    requestItem.NumIid = product.Content[i].NumIid;
                    Item item = client.ItemGet(requestItem, session);

                    //判断是否增加过该图片
                    string newcontent = CreateDescDel(item.Desc);

                    //Response.Write(newcontent);

                    if (newcontent == "")
                    {
                        continue;
                    }

                    //更新宝贝描述
                    IDictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("num_iid", product.Content[i].NumIid.ToString());
                    param.Add("desc", newcontent);
                    string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param);
                    Response.Write(product.Content[i].NumIid.ToString() + "----" + resultpro + "<br>");
                    //return;
                    //return;
                }
                catch (Exception e)
                {
                    Response.Write(e.Message);
                }
            }
            //Response.Write(product.Content.Count.ToString() + "<br>");
            if (product.Content.Count < 200)
            {
                break;
            }
        }

        Response.Write("<script>alert('清除成功!');</script>");
        Response.End();
    }
コード例 #6
0
    /// <summary>
    /// 删除团购
    /// </summary>
    /// <param name="gid">团购ID</param>
    private void DeleteTaobao(string gid)
    {
        //获取正在进行中的宝贝同步任务
        string           appkey    = "12287381";
        string           secret    = "d3486dac8198ef01000e7bd4504601a4";
        string           session   = string.Empty;
        string           id        = string.Empty;
        string           missionid = string.Empty;
        string           html      = string.Empty;
        TopXmlRestClient client    = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        string sql = "SELECT t.*, s.sessiongroupbuy FROM TopMission t INNER JOIN TopTaobaoShop s ON s.nick = t.nick WHERE groupbuyid=" + gid;

        DataTable dt = utils.ExecuteDataTable(sql);

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            id = dt.Rows[i]["groupbuyid"].ToString();
            clearGroupbuy(id);
            session   = dt.Rows[i]["sessiongroupbuy"].ToString();
            missionid = dt.Rows[i]["id"].ToString();
            html      = "";

            sql = "delete from TopWriteContent where groupbuyid =  '" + dt.Rows[i]["groupbuyid"].ToString() + "'";
            utils.ExecuteNonQuery(sql);
            if (dt.Rows[i]["itemid"] != null && dt.Rows[i]["itemid"].ToString() != "" && dt.Rows[i]["itemid"].ToString() != "NULL")
            {
                RecordMissionDetail(id, missionid, dt.Rows[i]["itemid"].ToString(), "");
            }
            for (int j = 1; j <= 500; j++)
            {
                ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                request.Fields   = "num_iid,title,price,pic_url";
                request.PageSize = 200;
                request.PageNo   = j;

                Common.Cookie cookie     = new Common.Cookie();
                string        taobaoNick = dt.Rows[i]["nick"].ToString();
                try
                {
                    PageList <Item> product = client.ItemsOnsaleGet(request, session);
                    for (int num = 0; num < product.Content.Count; num++)
                    {
                        RecordMissionDetail(id, missionid, product.Content[num].NumIid.ToString(), html);
                    }
                    if (product.Content.Count < 200)
                    {
                        break;
                    }
                }
                catch (Exception e)
                {
                    sql = "UPDATE TopMission SET fail = fail + 1,isok = -1 WHERE id = " + dt.Rows[i]["id"].ToString();
                    utils.ExecuteNonQuery(sql);
                    break;
                }
            }
        }
    }
コード例 #7
0
        /// <summary>
        /// 获取淘宝店铺销售中的商品
        /// </summary>
        /// <returns>返回店铺销售中的商品数量</returns>
        public int GetTaoShopOnSaleItems()
        {
            ITopClient            client = new DefaultTopClient(Url, Appkey, Appsecret);
            ItemsOnsaleGetRequest req    = new ItemsOnsaleGetRequest();

            req.Fields = "num_iid";
            ItemsOnsaleGetResponse response = client.Execute(req, Sessionkey);
            int temp = GetNumParms(response.TotalResults);

            return(temp);
        }
コード例 #8
0
    private string BindDataProduct()
    {
        string str = string.Empty;

        Common.Cookie cookie     = new Common.Cookie();
        string        taobaoNick = cookie.getCookie("nick");
        string        session    = cookie.getCookie("top_sessionblog");

        //COOKIE过期判断
        if (taobaoNick == "")
        {
            //SESSION超期 跳转到登录页
            Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
            Response.End();
        }

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取用户店铺商品列表
        TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();

        request.Fields   = "num_iid,title,price,pic_url";
        request.Q        = key;
        request.PageSize = 5;
        request.OrderBy  = "volume:desc";

        PageList <Item> product = new PageList <Item>();

        try
        {
            product = client.ItemsOnsaleGet(request, session);
        }
        catch (Exception e)
        {
            if (e.Message == "27:Invalid session:Session not exist")
            {
                //SESSION超期 跳转到登录页
                Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
                Response.End();
            }
            return("");
        }

        for (int i = 0; i < product.Content.Count; i++)
        {
            str += "<a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" title=\"" + product.Content[i].Title + "\" target=\"_blank\"><img src=\"" + product.Content[i].PicUrl + "\" border=\"0\" /></a><br />";
            str += "<a href=\"http://item.taobao.com/item.htm?id=" + product.Content[i].NumIid.ToString() + "\" title=\"" + product.Content[i].Title + "\" target=\"_blank\">" + product.Content[i].Title + "</a> 售价:" + product.Content[i].Price + "元<br><br>";
        }

        return(str);
    }
コード例 #9
0
    /// <summary>
    /// 数据绑定
    /// </summary>
    private void BindData()
    {
        Cookie cookie     = new Cookie();
        string taobaoNick = cookie.getCookie("nick");
        string session    = cookie.getCookie("top_session");

        //COOKIE过期判断
        if (taobaoNick == "")
        {
            //SESSION超期 跳转到登录页
            Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12132145'</script>");
            Response.End();
        }

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        string    sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
        DataTable dt  = utils.ExecuteDataTable(sql);

        rptShopCat.DataSource = dt;
        rptShopCat.DataBind();

        Repeater1.DataSource = dt;
        Repeater1.DataBind();

        //获取用户店铺商品列表
        TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");
        ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();

        request.Fields   = "num_iid,title,price,pic_url";
        request.PageSize = 10;

        PageList <Item> product = new PageList <Item>();

        try
        {
            product = client.ItemsOnsaleGet(request, session);
        }
        catch (Exception e)
        {
            if (e.Message == "27:Invalid session:Session not exist")
            {
                //SESSION超期 跳转到登录页
                Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12132145'</script>");
                Response.End();
            }
            return;
        }
        rptItems.DataSource = product.Content;
        rptItems.DataBind();
    }
コード例 #10
0
        /// <summary>
        /// 得到当前在售商品,最多个数为199
        /// </summary>
        /// <param name="search">查询条件</param>
        /// <returns></returns>
        public List <Item> GetOnSaleGoods(string search = null)
        {
            //得到当前用户的在售商品列表
            var req = new ItemsOnsaleGetRequest {
                Fields = "num_iid,num,cid,title,outer_id,price,pic_url", PageSize = 199
            };

            if (!search.IsNullOrEmpty())
            {
                req.Q = search;
            }

            return(GetOnSaleGoods(req));
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie cookie     = new Cookie();
        string taobaoNick = cookie.getCookie("nick");
        string session    = cookie.getCookie("top_sessionblog");

        //COOKIE过期判断
        if (taobaoNick == "")
        {
            //SESSION超期 跳转到登录页
            Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
            Response.End();
        }

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        string    sql = "SELECT * FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
        DataTable dt  = utils.ExecuteDataTable(sql);

        Repeater1.DataSource = dt;
        Repeater1.DataBind();

        //获取用户店铺商品列表
        TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();

        request.Fields   = "num_iid,title,price,pic_url";
        request.PageSize = 10;

        PageList <Item> product = new PageList <Item>();

        try
        {
            product = client.ItemsOnsaleGet(request, session);
        }
        catch (Exception ex)
        {
            if (ex.Message == "27:Invalid session:Session not exist")
            {
                //SESSION超期 跳转到登录页
                Response.Write("<script>parent.location.href='http://container.open.taobao.com/container?appkey=12159997'</script>");
                Response.End();
            }
            return;
        }
        rptItems.DataSource = product.Content;
        rptItems.DataBind();
    }
コード例 #12
0
        /// <summary>
        /// 获取淘宝店铺销售中的商品
        /// </summary>
        /// <param name="page">淘宝的分页序号</param>
        /// <param name="pageSize">淘宝分页每页显示的数量</param>
        /// <returns>返回店铺销售中的商品</returns>
        public List <Top.Api.Domain.Item> GetTaoShopOnSaleItems(int page, int pageSize)
        {
            ITopClient            client = new DefaultTopClient(Url, Appkey, Appsecret);
            ItemsOnsaleGetRequest req    = new ItemsOnsaleGetRequest();

            req.Fields = "approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id";
            //淘宝的分页序号
            req.PageNo = page;
            //淘宝分页每页显示的数量
            req.PageSize = pageSize;
            ItemsOnsaleGetResponse     response = client.Execute(req, Sessionkey);
            List <Top.Api.Domain.Item> saleList = response.Items;

            return(saleList);
        }
コード例 #13
0
ファイル: TBOnSalePro.cs プロジェクト: fubendong/--CTCRM
 /// <summary>
 /// 返回商品在售的总数
 /// </summary>
 /// <param name="sessionKey"></param>
 /// <returns></returns>
 public static string GetAllOnSalePro(string sessionKey)
 {
     try
     {
         ITopClient            client = TBManager.GetClient();
         ItemsOnsaleGetRequest req    = new ItemsOnsaleGetRequest();
         req.Fields = "num_iid";
         ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);
         return(response.TotalResults.ToString());
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TopApi);
         return("0");
     }
 }
コード例 #14
0
        /// <summary>
        /// 检查该产品是否已经上架
        /// taobao.items.onsale.get 获取当前会话用户出售中的商品列表
        /// </summary>
        /// <param name="goodsSn">款号</param>
        /// <returns></returns>
        public Item VerifyGoodsExist(string goodsSn)
        {
            goodsSn.ThrowIfNullOrEmpty(
                Resource.ExceptionTemplate_MethedParameterIsNullorEmpty.StringFormat(new StackTrace()));

            var req = new ItemsOnsaleGetRequest {
                Fields = "num_iid,num,cid,title,outer_id,price,pic_url", Q = goodsSn, PageSize = 10
            };
            List <Item> onSaleGoods = GetOnSaleGoods(req);

            if (onSaleGoods != null && onSaleGoods.Count > 0)
            {
                _log.LogWarning(Resource.Log_GoodsAlreadyExist, goodsSn);
                return(onSaleGoods[0]);
            }

            return(null);
        }
コード例 #15
0
 /// <summary>
 /// 获取当前会话用户出售中的商品列表
 /// </summary>
 /// <param name="strSessionKey"></param>
 /// <returns></returns>
 public static List <Item> GetItemsOnSale(string strSessionKey, string pageSize, string pageNo)
 {
     try
     {
         ITopClient            client = TBManager.GetClient();
         ItemsOnsaleGetRequest req    = new ItemsOnsaleGetRequest();
         req.Fields   = @"num_iid,outer_id,bar_code,price,seller_cids,pic_url,title";
         req.PageNo   = long.Parse(pageNo);
         req.PageSize = long.Parse("200");
         ItemsOnsaleGetResponse rsp = client.Execute(req, strSessionKey);
         return(rsp.Items);
     }
     catch (Exception ex)
     {
         ExceptionReporter.WriteLog(ex, ExceptionPostion.TopApi);
         return(null);
     }
 }
コード例 #16
0
        /// <summary>
        ///     获取当前会话用户出售中的商品列表
        ///     taobao.items.onsale.get
        /// </summary>
        /// <param name="req">要查询传入的参数</param>
        public List <Item> GetOnSaleGoods(ItemsOnsaleGetRequest req)
        {
            _log.LogInfo(Resource.Log_GetOnSaleGoodsing.StringFormat(req.Q));
            var tContext = InstanceLocator.Current.GetInstance <AuthorizedContext>();

            ItemsOnsaleGetResponse response = _client.Execute(req, tContext.SessionKey);

            if (response.IsError)
            {
                var ex = new TopResponseException(response.ErrCode, response.ErrMsg, response.SubErrCode,
                                                  response.SubErrMsg, response.TopForbiddenFields);

                _log.LogError(Resource.Log_GetOnSaleGoodsFailure, ex);

                throw ex;
            }

            _log.LogInfo(Resource.Log_GetOnSaleGoodsSuccess.StringFormat(req.Q));
            return(response.Items);
        }
コード例 #17
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="total"></param>
        /// <param name="pageNo"></param>
        /// <returns></returns>
        private List <TB.Item> GetItems(out long total, long pageNo, long pageSize)
        {
            total = 0;
            ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();

            req.Fields  = "num_iid,title,price,pic_url,outer_id,approve_status,num,created,modified,skus";
            req.PageNo  = pageNo;
            req.OrderBy = "list_time:desc";
            //req.IsTaobao = true;
            //req.IsEx = true;

            req.PageSize = pageSize;

            ItemsOnsaleGetResponse response = client.Execute(req, this.Access_Token.Access_Token1);

            if (!response.IsError)
            {
                total = response.TotalResults;
                return(response.Items);
            }

            return(null);
        }
コード例 #18
0
        public static List<Item> GetProductList(long page, long num, out long total)
        {
            List<Item> ret = new List<Item>();
            total = 0;
            try
            {
                ITopClient client = Global.DefulatClient();

                ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
                req.Fields = "num_iid,title,price";
                req.PageNo = page;
                req.PageSize = num;

                ItemsOnsaleGetResponse response = client.Execute(req, Global.SessionKey);
                total = response.TotalResults;

                ret.AddRange(response.Items);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            return ret;
        }
コード例 #19
0
 /// <summary>
 /// taobao.items.onsale.get
 /// 获取当前会话用户出售中的商品列表
 /// </summary>
 /// <param name="fields">需返回的字段列表。可选值:Item商品结构体中的以下字段: approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id;字段之间用“,”分隔。
 /// 不支持其他字段,如果需要获取其他字段数据,调用taobao.item.get。 </param>
 /// <param name="keywords">搜索字段。搜索商品的title。 </param>
 /// <param name="cid">商品类目ID。ItemCat中的cid字段。可以通过taobao.itemcats.get取到 </param>
 /// <param name="sellercids">卖家店铺内自定义类目ID。多个之间用“,”分隔。可以根据taobao.sellercats.list.get获得.(注:目前最多支持32个ID号传入) </param>
 /// <param name="pageno">页码。取值范围:大于零的整数。默认值为1,即默认返回第一页数据。用此接口获取数据时,当翻页获取的条数(page_no*page_size)超过10万,为了保护后台搜索引擎,接口将报错。所以请大家尽可能的细化自己的搜索条件,例如根据修改时间分段获取商品 </param>
 /// <param name="pagesize">每页条数。取值范围:大于零的整数;最大值:200;默认值:40。用此接口获取数据时,当翻页获取的条数(page_no*page_size)超过2万,为了保护后台搜索引擎,接口将报错。所以请大家尽可能的细化自己的搜索条件,例如根据修改时间分段获取商品 </param>
 /// <param name="hasdiscount">是否参与会员折扣。可选值:true,false。默认不过滤该条件 </param>
 /// <param name="hasshowcase">是否橱窗推荐。 可选值:true,false。默认不过滤该条件 </param>
 /// <param name="orderby">排序方式。格式为column:asc/desc ,column可选值:list_time(上架时间),delist_time(下架时间),num(商品数量),modified(最近修改时间);默认上架时间降序(即最新上架排在前面)。如按照上架时间降序排序方式为list_time:desc </param>
 /// <param name="istaobao">商品是否在淘宝显示 </param>
 /// <param name="isex">商品是否在外部网店显示 </param>
 /// <param name="startmodified">起始的修改时间 </param>
 /// <param name="endmodified">结束的修改时间</param>
 /// <returns></returns>
 public static List<Item> GetOnsaleItem(string fields, string keywords, long? cid, string sellercids, long? pageno, long? pagesize, bool? hasdiscount,
     bool? hasshowcase, string orderby, bool? istaobao, bool? isex, DateTime? startmodified, DateTime? endmodified)
 {
     ITopClient client = TopClientService.GetTopClient();
     ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
     req.Fields = fields;
     req.Q = keywords;
     req.Cid = cid;
     req.SellerCids = sellercids;
     req.PageNo = pageno;
     req.HasDiscount = hasdiscount;
     req.HasShowcase = hasshowcase;
     req.OrderBy = orderby;
     req.IsTaobao = istaobao;
     req.IsEx = isex;
     req.PageSize = pagesize;
     req.StartModified = startmodified;
     req.EndModified = endmodified;
     ItemsOnsaleGetResponse response = client.Execute(req, SessionKey);
     return response.Items;
 }
コード例 #20
0
ファイル: GoodsApi.cs プロジェクト: jiguixin/MyTools
        /// <summary>
        ///     获取当前会话用户出售中的商品列表
        ///     taobao.items.onsale.get
        /// </summary>
        /// <param name="req">要查询传入的参数</param>
        public List<Item> GetOnSaleGoods(ItemsOnsaleGetRequest req)
        {
            _log.LogInfo(Resource.Log_GetOnSaleGoodsing.StringFormat(req.Q));
            var tContext = InstanceLocator.Current.GetInstance<AuthorizedContext>();

            ItemsOnsaleGetResponse response = _client.Execute(req, tContext.SessionKey);

            if (response.IsError)
            {
                var ex = new TopResponseException(response.ErrCode, response.ErrMsg, response.SubErrCode,
                                                  response.SubErrMsg, response.TopForbiddenFields);

                _log.LogError(Resource.Log_GetOnSaleGoodsFailure, ex);

                throw ex;
            }

            _log.LogInfo(Resource.Log_GetOnSaleGoodsSuccess.StringFormat(req.Q));
            return response.Items;
        }
コード例 #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //try
        //{
        id = utils.NewRequest("id", Common.utils.RequestType.QueryString);

        if (id != "" && !utils.IsInt32(id))
        {
            Response.Write("非法参数1");
            Response.End();
            return;
        }

        style   = utils.NewRequest("style", Common.utils.RequestType.Form);
        size    = utils.NewRequest("size", Common.utils.RequestType.Form);
        type    = utils.NewRequest("type", Common.utils.RequestType.Form);
        orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form);
        query   = utils.NewRequest("query", Common.utils.RequestType.Form);
        shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form);
        name    = utils.NewRequest("name", Common.utils.RequestType.Form);
        items   = utils.NewRequest("items", Common.utils.RequestType.Form);
        ads     = utils.NewRequest("ads", Common.utils.RequestType.Form);

        string missionid = string.Empty;
        string html      = CreateGroupbuyHtml(id);

        if (html.Length == 0)
        {
            return;
        }

        int itemcount = 0;

        string act = utils.NewRequest("act", Common.utils.RequestType.Form);

        //创建任务时,判断是否有同类型任务在进行
        if (act == "save" && NoRepeat(id, type))
        {
            //记录该任务
            missionid = RecordMission();

            TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");
            //提交更新到淘宝商品上去
            if (type != "1")
            {
                for (int j = 1; j <= 500; j++)
                {
                    ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                    request.Fields   = "num_iid,title,price,pic_url";
                    request.PageSize = 200;
                    request.PageNo   = j;

                    if (orderby == "new")
                    {
                        request.OrderBy = "list_time:desc";
                    }
                    else if (orderby == "sale")
                    {
                        request.OrderBy = "volume:desc";
                    }

                    if (shopcat != "0")
                    {
                        request.SellerCids = shopcat;
                    }

                    if (query != "0")
                    {
                        request.Q = query;
                    }

                    Cookie          cookie     = new Cookie();
                    string          taobaoNick = cookie.getCookie("nick");
                    string          session    = cookie.getCookie("top_sessiongroupbuy");
                    PageList <Item> product    = client.ItemsOnsaleGet(request, session);

                    for (int i = 0; i < product.Content.Count; i++)
                    {
                        RecordMissionDetail(id, missionid, product.Content[i].NumIid.ToString(), html);
                        itemcount++;
                    }

                    if (product.Content.Count < 200)
                    {
                        break;
                    }
                }
            }
            else
            {
                string[] itemId = items.Split(',');

                for (int i = 0; i < itemId.Length; i++)
                {
                    RecordMissionDetail(id, missionid, itemId[i], html);
                    itemcount++;
                }
            }
        }
        //}
        //catch { }


        //更新总数量
        string sql = "UPDATE TopMission SET total = '" + itemcount + "' WHERE id = " + missionid;

        utils.ExecuteNonQuery(sql);


        //更新任务
        DoMyJob(missionid);
        //Response.Redirect("missionlist.aspx");
    }
コード例 #22
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //根据卖家的所有出售中的宝贝的标题在蘑菇街中搜索,如果搜到则加入到<List>ItemsExt中。
    protected void Button5_Click(object sender, EventArgs e)
    {
        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
        req.Fields = "num_iid";
        ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);

        // Items is List of Item, got from response.
        // ItemsExt it List of ItemExt, used for adding other information in DataList.

        baobeinumber.Text = Convert.ToString(response.TotalResults);

        for (int i = 1; i < (response.TotalResults / 40 + 2); i++)
        //for (int i = 1; i < 2; i++)
        {
            req.Fields = "num_iid,title,price,pic_url,has_showcase";
            req.PageNo = i;
            req.PageSize = 40L;
            ItemsOnsaleGetResponse response2 = client.Execute(req, sessionKey);

            int j = 1;
            foreach (Item ItemElement in response2.Items)
            {
                sousuojindu.Text = Convert.ToString((i - 1) * 40 + j);

                ItemExt ItemExtElement = new ItemExt(ItemElement);

                //根据宝贝标题进行搜索
                SearchInMogujie(ItemExtElement); //To get ItemExtElement.MogujieAddress and ItemExtElement.MogujieFavNum using title

                if (ItemExtElement.MogujieAddress != "您的宝贝尚未收录")
                {
                    ItemsExt.Add(ItemExtElement);
                    ItemExtElement.index = ItemsExt.IndexOf(ItemExtElement);

                    //如果发现宝贝被收录成功了,下一步是查该宝贝被收录的具体情况

            //WebBrowser web = new WebBrowser();
            //web.Navigate(ItemExtElement.MogujieAddress);
            //web.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(web_DocumentCompleted);

                    uploadDate.Text = ItemExtElement.MogujieAddress;
                    //FavoriteNum.Text = mogujienotehtml;

                    //using (StreamWriter sw = new StreamWriter(@"D:\00_Data\99_debugdata\" + ItemExtElement.Title + ".html"))//将获取的内容写入文本
                    //{
                    //    sw.Write(mogujienotehtml);
                    //}
                }
                j++;
            }
            //MogujieDataList.DataSource = ItemsExt;
            //MogujieDataList.DataBind();
        }
            MogujieDataList.DataSource = ItemsExt;
            MogujieDataList.DataBind();
            sousuojindu.Text = Convert.ToString(ItemsExt.Count);
    }
コード例 #23
0
 private ITopRequest GetTopRequest(string query, bool? discount, bool? showCase, string type, string filter, int pageIndex, int pageSize)
 {
     if (type.Equals("onsale", StringComparison.OrdinalIgnoreCase))
     {
         ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
         req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query = query;
         req.HasDiscount = discount;
         req.HasShowcase = showCase;
         req.PageNo = pageIndex;
         req.PageSize = pageSize;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.SellerCids = filter;
         }
         return req;
     }
     else if (type.Equals("inventory", StringComparison.OrdinalIgnoreCase))
     {
         ItemsInventoryGetRequest req = new ItemsInventoryGetRequest();
         req.Fields = TopFieldsHelper.GetItemFields_InList();// "iid,title,nick,type,cid,num,props,price";
         req.Query = query;
         if (!string.IsNullOrEmpty(filter) && !filter.Trim().Equals("all", StringComparison.OrdinalIgnoreCase))
         {
             req.Banner = filter;
         }
         req.PageNo = pageIndex;
         req.PageSize = pageSize;
         return req;
     }
     else
     {
         return null;
     }
 }
コード例 #24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_session");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid  = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           act    = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
    }
コード例 #25
0
    private void BindData(string items, string adsid)
    {
        string           html   = string.Empty;
        string           total  = string.Empty;
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");//d3486dac8198ef01000e7bd4504601a4

        if (type != "1")
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = 1;

            if (orderby == "new")
            {
                request.OrderBy = "list_time:desc";
            }
            else if (orderby == "sale")
            {
                request.OrderBy = "volume:desc";
            }

            if (shopcat != "0")
            {
                request.SellerCids = shopcat;
            }

            if (query != "0")
            {
                request.Q = query;
            }

            Cookie          cookie     = new Cookie();
            string          taobaoNick = cookie.getCookie("nick");
            string          session    = cookie.getCookie("top_sessiongroupbuy");
            PageList <Item> product    = client.ItemsOnsaleGet(request, session);


            ItemGetRequest request1 = new ItemGetRequest();
            request1.Fields = "num_iid,title,price,pic_url,desc";
            request1.NumIid = product.Content[0].NumIid;
            Item product1 = client.ItemGet(request1);
            html = product1.Desc;
        }
        else
        {
            string itemId = items.Split(',')[0];

            ItemGetRequest request = new ItemGetRequest();
            request.Fields = "num_iid,title,price,pic_url,desc";
            request.NumIid = long.Parse(itemId);

            Item product = client.ItemGet(request);
            //获取商品详细描述
            html = product.Desc;
        }

        //获取广告代码
        string adsHtml = "团购的HTML代码";// getAdsContent(ads);

        if (!Regex.IsMatch(html, @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">([\s\S]*)<img alt=""tetesoft-area-end"" width=""0"" height=""0"">"))
        {
            html += @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">" + adsHtml + @"<img alt=""tetesoft-area-end"" width=""0"" height=""0"">";
        }
        else
        {
            html = Regex.Replace(html, @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">([\s\S]*)<img alt=""tetesoft-area-end"" width=""0"" height=""0"">", @"<img alt=""tetesoft-area-start"" width=""0"" height=""0"">" + adsHtml + @"<img alt=""tetesoft-area-end"" width=""0"" height=""0"">");
        }

        lbView.InnerHtml = html;

        //Response.Write("搜索结果共计" + total + "个商品...<br>");
    }
コード例 #26
0
ファイル: TaobaoProductManager.cs プロジェクト: Bobom/kuanmai
        /// <summary>
        /// 
        /// </summary>
        /// <param name="total"></param>
        /// <param name="pageNo"></param>
        /// <returns></returns>
        private List<TB.Item> GetItems(out long total, long pageNo, long pageSize)
        {
            total = 0;
            ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
            req.Fields = "num_iid,title,price,pic_url,outer_id,approve_status,num,created,modified,skus";
            req.PageNo = pageNo;
            req.OrderBy = "list_time:desc";
            //req.IsTaobao = true;
            //req.IsEx = true;

            req.PageSize = pageSize;

            ItemsOnsaleGetResponse response = client.Execute(req, this.Access_Token.Access_Token1);
            if(!response.IsError)
            {
                total = response.TotalResults;
                return response.Items;
            }

            return null;
        }
コード例 #27
0
    /// <summary>
    /// 清除宝贝描述里面的活动页面
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button4_Click(object sender, EventArgs e)
    {
        string appkey = "12690738";
        string secret = "66d488555b01f7b85f93d33bc2a1c001";

        session = utils.NewRequest("session", utils.RequestType.QueryString);
        StringBuilder builder = new StringBuilder();
        //上传到宝贝描述
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        for (int j = 1; j <= 500; j++)
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid";
            request.PageSize = 200;
            request.PageNo   = j;
            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            for (int i = 0; i < product.Content.Count; i++)
            {
                try
                {
                    //获取商品详细
                    ItemGetRequest requestItem = new ItemGetRequest();
                    requestItem.Fields = "desc";
                    requestItem.NumIid = product.Content[i].NumIid;
                    Item item = client.ItemGet(requestItem, session);

                    //判断是否增加过该图片
                    string newcontent = CreateDescDel(item.Desc);

                    //if (product.Content[i].NumIid.ToString() == "10002247109")
                    //{
                    //    Response.Write(item.Desc);
                    //    Response.Write("**************************************************");
                    //    Response.Write(newcontent);
                    //    return;
                    //}

                    if (newcontent == "")
                    {
                        continue;
                    }

                    //更新宝贝描述
                    IDictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("num_iid", product.Content[i].NumIid.ToString());
                    param.Add("desc", newcontent);
                    string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param);
                    builder.Append(resultpro + "\r\n");

                    //Response.Write(resultpro + "<br>\r\n");
                }
                catch
                { }
            }


            if (product.Content.Count < 200)
            {
                break;
            }
        }

        File.WriteAllText(Server.MapPath("htmlLog/" + DateTime.Now.ToString("yyyyMMddHHmmss") + "-" + nick + ".txt"), builder.ToString());

        Response.Write("<script>alert('清除成功!');</script>");
        Response.End();
    }
コード例 #28
0
ファイル: SearchItems.cs プロジェクト: pandyer/learngit
        public static Dictionary <string, Item> SearchAll(string status, string reqName, bool isnum_iid, string strMainWord, string sellerCat, SellerInfoEntity sellerinfo, int useplatform)
        {
            TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "===" + status + " ::" + sellerinfo.top_session);
            Dictionary <string, Item> itemDic    = new Dictionary <string, Item>();
            StringBuilder             strbNumIid = new StringBuilder();
            long totalResults = 0; //宝贝总数
            int  pageNo       = 0; //api查询页码
            int  pageNo2      = 0; //api查询页码

            status = status == "3" ? null : status;
            if (string.IsNullOrWhiteSpace(status))
            {
                #region 获取出售中的商品
                do
                {
                    pageNo++;
                    ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
                    req.Fields   = reqName;
                    req.PageSize = 200L;
                    req.PageNo   = Convert.ToInt64(pageNo);
                    req.OrderBy  = "list_time:asc";
                    if (strMainWord.Length > 0)
                    {
                        req.Q = strMainWord;
                    }
                    if (sellerCat.Trim().Length > 0)
                    {
                        req.SellerCids = sellerCat;
                    }
                    ItemsOnsaleGetResponse response = TopClient.Execute <ItemsOnsaleGetResponse>(req, sellerinfo.top_session, (TopClient.CrmPlatForm)useplatform);
                    if (response.IsError)
                    {
                        TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "=== :出现异常:" + response.Body);
                    }
                    else
                    {
                        TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "=== :出现异常:" + response.Body);
                        totalResults = response.TotalResults;
                        foreach (Item item in response.Items.Where(item => !itemDic.ContainsKey(item.NumIid.ToString())))
                        {
                            if (isnum_iid)
                            {
                                strbNumIid.Append(item.NumIid.ToString() + ",");
                            }
                            else
                            {
                                itemDic.Add(item.NumIid.ToString(), item);
                            }
                        }
                    }
                } while (totalResults > pageNo * 200);
                #endregion
                #region 获取仓库中的商品
                do
                {
                    pageNo2++;
                    ItemsInventoryGetRequest req = new ItemsInventoryGetRequest
                    {
                        Fields   = reqName,
                        PageSize = 200,
                        PageNo   = pageNo2
                    };
                    if (strMainWord.Length > 0)
                    {
                        req.Q = strMainWord;
                    }
                    if (sellerCat.Trim().Length > 0)
                    {
                        req.SellerCids = sellerCat;
                    }
                    ItemsInventoryGetResponse response = TopClient.Execute(req, sellerinfo.top_session, (TopClient.CrmPlatForm)useplatform);
                    if (response.IsError)
                    {
                        TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "=== :出现异常:" + response.Body);
                    }
                    else
                    {
                        totalResults = response.TotalResults;
                        foreach (Item item in response.Items.Where(item => !itemDic.ContainsKey(item.NumIid.ToString())))
                        {
                            if (isnum_iid)
                            {
                                strbNumIid.Append(item.NumIid.ToString() + ",");
                            }
                            else
                            {
                                itemDic.Add(item.NumIid.ToString(), item);
                            }
                        }
                    }
                } while (totalResults > pageNo2 * 200);
                #endregion
            }
            else
            {
                if (status == "0")
                {
                    #region 获取出售中的商品
                    do
                    {
                        pageNo++;
                        ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
                        req.Fields   = reqName;
                        req.PageSize = 200L;
                        req.PageNo   = Convert.ToInt64(pageNo);
                        req.OrderBy  = "list_time:asc";
                        if (strMainWord.Length > 0)
                        {
                            req.Q = strMainWord;
                        }
                        if (sellerCat.Trim().Length > 0)
                        {
                            req.SellerCids = sellerCat;
                        }
                        ItemsOnsaleGetResponse response = TopClient.Execute <ItemsOnsaleGetResponse>(req, sellerinfo.top_session, (TopClient.CrmPlatForm)useplatform);
                        if (response.IsError)
                        {
                            TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "=== :出现异常:" + response.Body);
                        }
                        else
                        {
                            totalResults = response.TotalResults;
                            foreach (Item item in response.Items.Where(item => !itemDic.ContainsKey(item.NumIid.ToString())))
                            {
                                if (isnum_iid)
                                {
                                    strbNumIid.Append(item.NumIid.ToString() + ",");
                                }
                                else
                                {
                                    itemDic.Add(item.NumIid.ToString(), item);
                                }
                            }
                        }
                    } while (totalResults > pageNo * 200);
                    #endregion
                }
                else if (status == "1")
                {
                    #region 获取仓库中的商品
                    do
                    {
                        pageNo++;
                        ItemsInventoryGetRequest req = new ItemsInventoryGetRequest
                        {
                            Fields   = reqName,
                            PageSize = 200,
                            PageNo   = pageNo
                        };
                        if (strMainWord.Length > 0)
                        {
                            req.Q = strMainWord;
                        }
                        if (sellerCat.Trim().Length > 0)
                        {
                            req.SellerCids = sellerCat;
                        }
                        ItemsInventoryGetResponse response = TopClient.Execute(req, sellerinfo.top_session, (TopClient.CrmPlatForm)useplatform);
                        if (response.IsError)
                        {
                            TxtLog.WriteLine("getItemListErrorLog", sellerinfo.strUserNick + ":" + sellerinfo.strUserId + "=== :出现异常:" + response.Body);
                        }
                        else
                        {
                            totalResults = response.TotalResults;
                            foreach (Item item in response.Items.Where(item => !itemDic.ContainsKey(item.NumIid.ToString())))
                            {
                                if (isnum_iid)
                                {
                                    strbNumIid.Append(item.NumIid.ToString() + ",");
                                }
                                else
                                {
                                    itemDic.Add(item.NumIid.ToString(), item);
                                }
                            }
                        }
                    } while (totalResults > pageNo * 200);
                    #endregion
                }
            }
            if (isnum_iid)
            {
                itemDic = SearchNumIid(strbNumIid.ToString(), sellerinfo, reqName, useplatform);
            }
            return(itemDic);
        }
コード例 #29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_sessionblog");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid   = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           isradio = utils.NewRequest("isradio", utils.RequestType.QueryString);
        string           act     = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                if (isradio == "1")
                {
                    Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
                }
                else
                {
                    Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title + "</label><br>");
                }
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
        else if (act == "getResultStr")
        {
            string      items    = utils.NewRequest("ids", utils.RequestType.QueryString);
            string[]    arr      = items.Split(',');
            List <Item> itemList = new List <Item>();

            //标志
            int flag = 1;
            if (arr.Length == 1)
            {
                flag = 0;
            }

            for (int i = flag; i < arr.Length; i++)
            {
                ItemGetRequest request = new ItemGetRequest();
                request.Fields = "num_iid,title,price,pic_url";
                request.NumIid = long.Parse(arr[i]);

                Item product = client.ItemGet(request);
                itemList.Add(product);
            }

            string str = string.Empty;
            //根据不同样式显示不同的字符串
            string style = utils.NewRequest("style", utils.RequestType.QueryString);

            string    sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'";
            DataTable dtNew  = utils.ExecuteDataTable(sqlNew);
            string    nickid = string.Empty;
            if (dtNew.Rows.Count != 0)
            {
                nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/";
            }
            else
            {
                nickid = "http://www.taobao.com/";
            }


            if (isradio == "1")
            {
                //团购需要的商品数据
                for (int i = 0; i < itemList.Count; i++)
                {
                    str = "<A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A><br>" + itemList[i].Title + "<br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\">";
                }
            }
            else
            {
                if (style == "1")
                {
                    str += "<table background=\"http://www.7fshop.com/top/show1/4.gif\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\" style=\"border-right: #999999 1px solid; border-top: #999999 1px solid;border-left: #999999 1px solid; border-bottom: #999999 1px solid\" width=\"580\"><tr><td>    <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\"><tr><td align=\"left\"><table align=\"left\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" height=\"30\"><tr><td width=\"10\"></td><td background=\"http://www.7fshop.com/top/show1/1.gif\" width=\"24\"></td><td background=\"http://www.7fshop.com/top/show1/2.gif\"><font color=\"white\" style=\"font-size: 13px\"><strong>掌柜推荐商品</strong></font></td><td><img src=\"http://www.7fshop.com/top/show1/3.gif\" /></td></tr></table></td><td align=\"right\"></td></tr></table></td></tr></table>  <table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-right: #999999 1px solid;border-top: #999999 1px solid; overflow: hidden; border-left: #999999 1px solid;border-bottom: #999999 1px solid\" width=\"578\"><tr><td valign=\"top\"><TABLE cellSpacing=0 cellPadding=0 width=578 border=0><TBODY><TR><TD align=\"middle\"><TABLE cellSpacing=8 cellPadding=0 align=center border=0><TBODY><TR>";
                    for (int i = 0; i < itemList.Count; i++)
                    {
                        str += "<TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD vAlign=top align=\"middle\" width=175 bgColor=white><TABLE cellSpacing=0 cellPadding=0 align=center border=0><TBODY><TR><TD align=\"middle\"><DIV style=\"BORDER-RIGHT: #cccccc 1px solid; BORDER-TOP: #cccccc 1px solid; MARGIN-TOP: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 160px; BORDER-BOTTOM: #cccccc 1px solid; HEIGHT: 160px\"><DIV style=\"OVERFLOW: hidden; WIDTH: 160px; HEIGHT: 160px\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_160x160.jpg\" border=0 /></A></DIV></DIV></TD></TR><TR><TD align=\"middle\"><DIV style=\"PADDING-RIGHT: 4px; PADDING-LEFT: 4px; FONT-SIZE: 12px; PADDING-BOTTOM: 4px; PADDING-TOP: 4px\"><A style=\"FONT-SIZE: 12px; COLOR: #3f3f3f; TEXT-DECORATION: none\" href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</A><BR /><FONT style=\"COLOR: #fe596a\"><B>¥&nbsp;" + itemList[i].Price + "元</B></FONT> </DIV><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"http://www.7fshop.com/top/show1/buy1.gif\" border=0 /></A> <DIV></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>";
                        if ((i + 1) % 3 == 0)
                        {
                            str += "</tr><tr>";
                        }
                    }

                    str += "</TR></TBODY></TABLE></td></tr><tr><td align=\"right\" height=\"24\" style=\"border-bottom: #999999 1px solid\" valign=\"center\"><a href=\"" + nickid + "\" style=\"text-decoration: none\" target=\"_blank\"><font style=\"font-size: 13px; color: #ff6600\"><strong>更多详情请见 " + nickid + "</strong>&nbsp;</font></a></td></tr></table></td></tr></table>";
                }
                else
                {
                    for (int i = 0; i < itemList.Count; i++)
                    {
                        str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><img src=\"" + itemList[i].PicUrl + "\" border=\"0\" /></a><br />";
                        str += "<a href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\">" + itemList[i].Title + "</a> 售价:" + itemList[i].Price + "元<br><br>";
                    }
                }
            }
            Response.Write(str);
        }
    }
コード例 #30
0
ファイル: html.aspx.cs プロジェクト: giagiigi/tete-for-taobao
    /// <summary>
    /// 清除宝贝描述里面的活动页面
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Button4_Click(object sender, EventArgs e)
    {
        string appkey = "12159997";
        string secret = "614e40bfdb96e9063031d1a9e56fbed5";
        //上传到宝贝描述
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        for (int j = 1; j <= 500; j++)
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid";
            request.PageSize = 200;
            request.PageNo   = j;
            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            for (int i = 0; i < product.Content.Count; i++)
            {
                try
                {
                    //获取商品详细
                    ItemGetRequest requestItem = new ItemGetRequest();
                    requestItem.Fields = "desc";
                    requestItem.NumIid = product.Content[i].NumIid;
                    Item item = client.ItemGet(requestItem, session);

                    //判断是否增加过该图片
                    string newcontent = CreateDescDel(item.Desc);

                    //if (product.Content[i].NumIid.ToString() == "10002247109")
                    //{
                    //    Response.Write(item.Desc);
                    //    Response.Write("**************************************************");
                    //    Response.Write(newcontent);
                    //    return;
                    //}

                    if (newcontent == "")
                    {
                        continue;
                    }

                    //更新宝贝描述
                    IDictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("num_iid", product.Content[i].NumIid.ToString());
                    param.Add("desc", newcontent);
                    string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param);
                }
                catch
                { }
            }

            if (product.Content.Count < 200)
            {
                break;
            }
        }


        Response.Write("<script>alert('清除成功!');window.location.href='html.aspx';</script>");
        Response.End();
    }
コード例 #31
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        nick    = this.TextBox1.Text;
        session = this.TextBox2.Text;

        string appkey = "12132145";
        string secret = "1fdd2aadd5e2ac2909db2967cbb71e7f";
        //上传到宝贝描述
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        for (int j = 1; j <= 500; j++)
        {
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid";
            request.PageSize = 200;
            request.PageNo   = j;
            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            for (int i = 0; i < product.Content.Count; i++)
            {
                try
                {
                    //获取商品详细
                    ItemGetRequest requestItem = new ItemGetRequest();
                    requestItem.Fields = "desc";
                    requestItem.NumIid = product.Content[i].NumIid;
                    Item item = client.ItemGet(requestItem, session);

                    //判断是否增加过该图片
                    string newcontent = CreateDescDelHaoping(item.Desc);

                    //if (product.Content[i].NumIid.ToString() == "10002247109")
                    //{
                    //    Response.Write(item.Desc);
                    //    Response.Write("**************************************************");
                    //    Response.Write(newcontent);
                    //    return;
                    //}

                    if (newcontent == "")
                    {
                        continue;
                    }

                    //更新宝贝描述
                    IDictionary <string, string> param = new Dictionary <string, string>();
                    param.Add("num_iid", product.Content[i].NumIid.ToString());
                    param.Add("desc", newcontent);
                    string resultpro = Post("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.item.update", session, param);
                }
                catch
                { }
            }

            if (product.Content.Count < 200)
            {
                break;
            }
        }


        Response.Write("<script>alert('清除成功!');</script>");
        Response.End();
    }
コード例 #32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //try
        //{
        id = utils.NewRequest("id", Common.utils.RequestType.QueryString);

        if (id != "" && !utils.IsInt32(id))
        {
            Response.Write("非法参数1");
            Response.End();
            return;
        }

        style   = utils.NewRequest("style", Common.utils.RequestType.Form);
        size    = utils.NewRequest("size", Common.utils.RequestType.Form);
        type    = utils.NewRequest("type", Common.utils.RequestType.Form);
        orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form);
        query   = utils.NewRequest("query", Common.utils.RequestType.Form);
        shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form);
        name    = utils.NewRequest("name", Common.utils.RequestType.Form);
        items   = utils.NewRequest("items", Common.utils.RequestType.Form);
        ads     = utils.NewRequest("ads", Common.utils.RequestType.Form);

        string act = utils.NewRequest("act", Common.utils.RequestType.Form);

        if (act == "save")
        {
            TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");
            //提交更新到淘宝商品上去
            if (type == "0")
            {
                ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                request.Fields   = "num_iid,title,price,pic_url";
                request.PageSize = 1;

                if (orderby == "new")
                {
                    request.OrderBy = "list_time:desc";
                }
                else if (orderby == "sale")
                {
                    request.OrderBy = "volume:desc";
                }

                if (shopcat != "0")
                {
                    request.SellerCids = shopcat;
                }

                if (query != "0")
                {
                    request.Q = query;
                }

                Cookie          cookie     = new Cookie();
                string          taobaoNick = cookie.getCookie("nick");
                string          session    = cookie.getCookie("top_session");
                PageList <Item> product    = client.ItemsOnsaleGet(request, session);

                for (int i = 0; i < product.Content.Count; i++)
                {
                    string newContent = BindData(product.Content[i].NumIid.ToString(), ads);
                    UpdateProductInfo(product.Content[i].NumIid, newContent);
                    break;
                }
            }
            else
            {
                string[] itemId = items.Split(',');

                for (int i = 0; i < itemId.Length; i++)
                {
                    string newContent = BindData(itemId[i], ads);
                    UpdateProductInfo(long.Parse(itemId[i]), newContent);
                    break;
                }
            }
        }
        //}
        //catch { }
    }
コード例 #33
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Cookie    cookie     = new Cookie();
        string    taobaoNick = cookie.getCookie("nick");
        string    session    = cookie.getCookie("top_sessiongroupbuy");
        Rijndael_ encode     = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        string appkey = "12159997";
        string secret = "614e40bfdb96e9063031d1a9e56fbed5";

        //获取参数
        string q    = utils.NewRequest("query", utils.RequestType.QueryString);
        string page = utils.NewRequest("p", utils.RequestType.QueryString);

        if (page == "")
        {
            page = "1";
        }
        string           catid   = utils.NewRequest("catid", utils.RequestType.QueryString);
        string           isradio = utils.NewRequest("isradio", utils.RequestType.QueryString);
        string           act     = utils.NewRequest("act", utils.RequestType.QueryString);
        TopXmlRestClient client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", appkey, secret);

        int pageSizeNow = 15;

        if (act == "get")
        {
            //获取用户店铺商品列表
            ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
            request.Fields   = "num_iid,title,price,pic_url";
            request.PageSize = pageSizeNow;
            request.PageNo   = int.Parse(page);
            request.Q        = q;
            if (catid != "0")
            {
                request.SellerCids = catid;
            }

            PageList <Item> product = client.ItemsOnsaleGet(request, session);

            //输出页面HTML
            for (int i = 0; i < product.Content.Count; i++)
            {
                if (isradio == "1")
                {
                    Response.Write("<input type='radio' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>");
                }
                else
                {
                    Response.Write("<input type='checkbox' name='items' id='item_" + product.Content[i].NumIid + "' title='" + product.Content[i].Title.Replace("%", "") + "' value='" + product.Content[i].NumIid + "' onclick=\"InitArea(this)\"><label onMouseOver=\"javascript:ddrivetip('<img src=" + product.Content[i].PicUrl + "_80x80.jpg>','#ffffff',100)\" onMouseOut=\"hideddrivetip()\" for='item_" + product.Content[i].NumIid + "'>" + product.Content[i].Title.Replace("%", "") + "</label><br>");
                }
            }
            Response.Write("<br>");
            long totalPage = (product.TotalResults % pageSizeNow == 0) ? (product.TotalResults / pageSizeNow) : (product.TotalResults / pageSizeNow + 1);
            //输出分页HTML
            for (int i = 1; i <= totalPage; i++)
            {
                if (page == i.ToString())
                {
                    Response.Write(i.ToString() + " ");
                }
                else
                {
                    Response.Write("<a href=\"javascript:spreadStat(" + i.ToString() + ")\">[" + i.ToString() + "]</a> ");
                }
            }
        }
        else if (act == "getCat")
        {
            //记录店铺分类信息
            SellercatsListGetRequest request1 = new SellercatsListGetRequest();
            request1.Fields = "cid,parent_cid,name,is_parent";
            request1.Nick   = taobaoNick;
            PageList <SellerCat> cat = client.SellercatsListGet(request1);

            //清除老分类
            string sql = "DELETE FROM TopTaobaoShopCat WHERE nick = '" + taobaoNick + "'";
            utils.ExecuteNonQuery(sql);

            //插入新分类
            for (int i = 0; i < cat.Content.Count; i++)
            {
                sql = "INSERT INTO TopTaobaoShopCat (" +
                      "cid, " +
                      "parent_cid, " +
                      "name, " +
                      "pic_url, " +
                      "sort_order, " +
                      "created, " +
                      "nick, " +
                      "modified " +
                      " ) VALUES ( " +
                      " '" + cat.Content[i].Cid + "', " +
                      " '" + cat.Content[i].ParentCid + "', " +
                      " '" + cat.Content[i].Name + "', " +
                      " '" + cat.Content[i].PicUrl + "', " +
                      " '" + cat.Content[i].SortOrder + "', " +
                      " '" + cat.Content[i].Created + "', " +
                      " '" + taobaoNick + "', " +
                      " '" + cat.Content[i].Modified + "' " +
                      ") ";
                utils.ExecuteNonQuery(sql);
            }

            //输出页面HTML
            Response.Write("<select id=\"shopcat\" name=\"shopcat\"><option value=\"0\"></option>");
            for (int i = 0; i < cat.Content.Count; i++)
            {
                Response.Write("<option value='" + cat.Content[i].Cid + "'>" + cat.Content[i].Name + "</option>");
            }
            Response.Write("</select>");
        }
        else if (act == "getResultStr")
        {
            string      items    = utils.NewRequest("ids", utils.RequestType.QueryString);
            string[]    arr      = items.Split(',');
            List <Item> itemList = new List <Item>();

            //标志
            int flag = 1;
            if (arr.Length == 1)
            {
                flag = 0;
            }

            for (int i = flag; i < arr.Length; i++)
            {
                ItemGetRequest request = new ItemGetRequest();
                request.Fields = "num_iid,title,price,pic_url";
                request.NumIid = long.Parse(arr[i]);

                Item product = client.ItemGet(request);
                itemList.Add(product);
            }

            string str = string.Empty;
            //根据不同样式显示不同的字符串
            string style = utils.NewRequest("style", utils.RequestType.QueryString);

            //string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNick + "'";
            //DataTable dtNew = utils.ExecuteDataTable(sqlNew);
            //string nickid = string.Empty;
            //if (dtNew.Rows.Count != 0)
            //{
            //    nickid = "http://shop" + dtNew.Rows[0]["sid"].ToString() + ".taobao.com/";
            //}
            //else
            //{
            //    nickid = "http://www.taobao.com/";
            //}


            if (isradio == "1")
            {
                //团购需要的商品数据
                for (int i = 0; i < itemList.Count; i++)
                {
                    str = "<div id=item_" + itemList[i].NumIid.ToString() + " style=\"float:left;width:46px;border:solid 1px #ccc;padding:2px;margin:2px;\"><A href=\"http://item.taobao.com/item.htm?id=" + itemList[i].NumIid.ToString() + "\" target=\"_blank\"><IMG src=\"" + itemList[i].PicUrl + "_40x40.jpg\" border=0 title=\"" + itemList[i].Title + "\" /></A><br>" + itemList[i].Price + "<input type=\"hidden\" id=\"productid\" name=\"productid\" value=\"" + itemList[i].NumIid.ToString() + "\"><input type=\"hidden\" id=\"price\" name=\"price\" value=\"" + itemList[i].Price.ToString() + "\"><br><a href=\"javascript:delitem(" + itemList[i].NumIid.ToString() + ")\">删除</a></div>";
                }
            }

            Response.Write(str);
        }
    }
コード例 #34
0
    private void BindData()
    {
        //获取用户信息
        Cookie cookie     = new Cookie();
        string taobaoNick = cookie.getCookie("nick");
        string session    = cookie.getCookie("top_session");

        Rijndael_ encode = new Rijndael_("tetesoft");

        taobaoNick = encode.Decrypt(taobaoNick);

        //判断是否删除
        string act = utils.NewRequest("act", utils.RequestType.QueryString);
        string id  = utils.NewRequest("id", utils.RequestType.QueryString);

        if (id != "" && !utils.IsInt32(id))
        {
            Response.Write("非法参数");
            Response.End();
            return;
        }

        if (act == "del")
        {
            string sql = "DELETE FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id;
            utils.ExecuteNonQuery(sql);

            Response.Redirect("idealist.aspx");
            return;
        }
        else if (act == "update")
        {
            //如果是自动更新模式,需要更新店铺商品数据
            string    sql     = "SELECT shopcategoryid,query,nick,showtype FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id;
            DataTable dt1     = utils.ExecuteDataTable(sql);
            string    shopcat = string.Empty;
            string    query   = string.Empty;
            if (dt1.Rows[0]["showtype"].ToString() == "0")
            {
                //更新下架商品数据
                shopcat    = dt1.Rows[0][0].ToString();
                query      = dt1.Rows[0][1].ToString();
                taobaoNick = dt1.Rows[0][2].ToString();

                //获取新商品列表
                TopXmlRestClient      client  = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");
                ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                request.Fields   = "num_iid,title,price,pic_url";
                request.PageSize = 12;
                request.OrderBy  = "list_time:desc";
                request.OrderBy  = "volume:desc";
                if (shopcat != "0")
                {
                    request.SellerCids = shopcat;
                }
                request.Q = query;

                //清理关联商品
                sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id;
                utils.ExecuteNonQuery(sql);

                //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知
                try
                {
                    PageList <Item> product = client.ItemsOnsaleGet(request, session);

                    for (int i = 0; i < product.Content.Count; i++)
                    {
                        sql = "INSERT INTO TopIdeaProduct (" +
                              "itemid, " +
                              "itemname, " +
                              "itemprice, " +
                              "itempicurl, " +
                              "ideaid " +
                              " ) VALUES ( " +
                              " '" + product.Content[i].NumIid + "', " +
                              " '" + product.Content[i].Title + "', " +
                              " '" + product.Content[i].Price + "', " +
                              " '" + product.Content[i].PicUrl + "', " +
                              " '" + id + "' " +
                              ") ";
                        utils.ExecuteNonQuery(sql);
                    }
                }
                catch { }
            }

            //清理广告缓存
            CacheManager testcaching1 = CacheFactory.GetCacheManager();
            if (testcaching1.Contains("cache_1_" + id))
            {
                testcaching1.Remove("cache_1_" + id);
            }

            //更新广告图片
            string folderPath = Server.MapPath("\\show\\folder\\" + MD5(taobaoNick) + "\\result_" + id + ".jpg");
            if (File.Exists(folderPath))
            {
                File.Delete(folderPath);
            }

            //Response.Write("推广更新成功!!<br> <a href='../../show/plist.aspx?id=" + id + "' target='_blank'>查看更新过的广告</a> <br> <a href='idealist.aspx'>返回</a>");
            Response.Redirect("success.aspx?id=" + id);
            return;
        }

        DataTable dt = utils.ExecuteDataTable("SELECT * FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC");

        rptIdeaList.DataSource = dt;
        rptIdeaList.DataBind();
    }
コード例 #35
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            id = utils.NewRequest("id", Common.utils.RequestType.QueryString);

            if (id != "" && !utils.IsInt32(id))
            {
                Response.Write("非法参数1");
                Response.End();
                return;
            }


            style   = utils.NewRequest("style", Common.utils.RequestType.Form);
            size    = utils.NewRequest("size", Common.utils.RequestType.Form);
            type    = utils.NewRequest("type", Common.utils.RequestType.Form);
            orderby = utils.NewRequest("orderby", Common.utils.RequestType.Form);
            query   = utils.NewRequest("query", Common.utils.RequestType.Form);
            shopcat = utils.NewRequest("shopcat", Common.utils.RequestType.Form);
            name    = utils.NewRequest("name", Common.utils.RequestType.Form);
            items   = utils.NewRequest("items", Common.utils.RequestType.Form);

            string act = utils.NewRequest("act", Common.utils.RequestType.Form);
            if (act == "save")
            {
                Cookie cookie     = new Cookie();
                string taobaoNick = cookie.getCookie("nick");
                string session    = cookie.getCookie("top_session");

                Rijndael_ encode = new Rijndael_("tetesoft");
                taobaoNick = encode.Decrypt(taobaoNick);

                //记录到本地数据库
                string sql = "INSERT INTO TopIdea (" +
                             "name, " +
                             "showtype, " +
                             "nick, " +
                             "size, " +
                             "style, " +
                             "orderby, " +
                             "shopcategoryid, " +
                             "query " +
                             " ) VALUES ( " +
                             " '" + name + "', " +
                             " '" + type + "', " +
                             " '" + taobaoNick + "', " +
                             " '" + size + "', " +
                             " '" + style + "', " +
                             " '" + orderby + "', " +
                             " '" + shopcat + "', " +
                             " '" + query + "' " +
                             ") ";

                //如果为编辑模式
                if (id != "" && id != "0")
                {
                    //更新广告
                    sql = "UPDATE TopIdea SET " +
                          "name = '" + name + "', " +
                          "showtype = '" + type + "', " +
                          "size = '" + size + "', " +
                          "style = '" + style + "', " +
                          "orderby = '" + orderby + "', " +
                          "shopcategoryid = '" + shopcat + "', " +
                          "query = '" + query + "' " +
                          " WHERE id = " + id;
                    utils.ExecuteNonQuery(sql);

                    //如果是自动更新模式,需要更新店铺商品数据
                    sql = "SELECT shopcategoryid,query,nick,showtype FROM TopIdea WHERE nick = '" + taobaoNick + "' AND id = " + id;
                    DataTable dt1 = utils.ExecuteDataTable(sql);
                    if (dt1.Rows[0]["showtype"].ToString() == "0")
                    {
                        //更新下架商品数据
                        shopcat    = dt1.Rows[0][0].ToString();
                        query      = dt1.Rows[0][1].ToString();
                        taobaoNick = dt1.Rows[0][2].ToString();

                        //获取新商品列表
                        TopXmlRestClient      clientaa = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");
                        ItemsOnsaleGetRequest request  = new ItemsOnsaleGetRequest();
                        request.Fields   = "num_iid,title,price,pic_url";
                        request.PageSize = 12;
                        request.OrderBy  = "list_time:desc";
                        request.OrderBy  = "volume:desc";
                        if (shopcat != "0")
                        {
                            request.SellerCids = shopcat;
                        }
                        request.Q = query;

                        //清理关联商品
                        sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id;
                        utils.ExecuteNonQuery(sql);

                        //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知
                        try
                        {
                            PageList <Item> product = clientaa.ItemsOnsaleGet(request, session);

                            for (int i = 0; i < product.Content.Count; i++)
                            {
                                sql = "INSERT INTO TopIdeaProduct (" +
                                      "itemid, " +
                                      "itemname, " +
                                      "itemprice, " +
                                      "itempicurl, " +
                                      "ideaid " +
                                      " ) VALUES ( " +
                                      " '" + product.Content[i].NumIid + "', " +
                                      " '" + product.Content[i].Title + "', " +
                                      " '" + product.Content[i].Price + "', " +
                                      " '" + product.Content[i].PicUrl + "', " +
                                      " '" + id + "' " +
                                      ") ";
                                utils.ExecuteNonQuery(sql);
                            }
                        }
                        catch { }
                    }

                    //清理关联商品
                    sql = "DELETE FROM TopIdeaProduct WHERE ideaid = " + id;
                    utils.ExecuteNonQuery(sql);

                    //清理广告缓存
                    CacheManager testcaching1 = CacheFactory.GetCacheManager();
                    if (testcaching1.Contains("cache_1_" + id))
                    {
                        testcaching1.Remove("cache_1_" + id);
                    }

                    //更新广告图片
                    string folderPath = Server.MapPath("\\show\\folder\\" + MD5(taobaoNick) + "\\result_" + id + ".jpg");
                    if (File.Exists(folderPath))
                    {
                        File.Delete(folderPath);
                    }
                }

                utils.ExecuteNonQuery(sql);

                if (id != "" && id != "0")
                {
                    //编辑模式,ID不变
                }
                else
                {
                    //插入模式,获取最新ID
                    sql = "SELECT TOP 1 id FROM TopIdea WHERE nick = '" + taobaoNick + "' ORDER BY id DESC";
                    id  = utils.ExecuteString(sql);
                }

                //获取符合结果集的相关商品并记录到本地数据库
                TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12132145", "1fdd2aadd5e2ac2909db2967cbb71e7f");

                //如果为自动选择模式
                if (type == "0")
                {
                    ItemsOnsaleGetRequest request = new ItemsOnsaleGetRequest();
                    request.Fields   = "num_iid,title,price,pic_url";
                    request.PageSize = 12;

                    if (orderby == "new")
                    {
                        request.OrderBy = "list_time:desc";
                    }
                    else if (orderby == "sale")
                    {
                        request.OrderBy = "volume:desc";
                    }

                    if (shopcat != "0")
                    {
                        request.SellerCids = shopcat;
                    }

                    if (query != "0")
                    {
                        request.Q = query;
                    }

                    //未登录用户不能获取小二下架或删除的商品-错误过滤,原因未知
                    try
                    {
                        PageList <Item> product = client.ItemsOnsaleGet(request, session);

                        for (int i = 0; i < product.Content.Count; i++)
                        {
                            sql = "INSERT INTO TopIdeaProduct (" +
                                  "itemid, " +
                                  "itemname, " +
                                  "itemprice, " +
                                  "itempicurl, " +
                                  "ideaid " +
                                  " ) VALUES ( " +
                                  " '" + product.Content[i].NumIid + "', " +
                                  " '" + product.Content[i].Title + "', " +
                                  " '" + product.Content[i].Price + "', " +
                                  " '" + product.Content[i].PicUrl + "', " +
                                  " '" + id + "' " +
                                  ") ";
                            utils.ExecuteNonQuery(sql);
                        }
                    }
                    catch { }
                }
                else
                {
                    string[]    arr      = items.Split(',');
                    List <Item> itemList = new List <Item>();
                    for (int i = 0; i < arr.Length; i++)
                    {
                        string strSPID  = "29230000ea039296234e9d74d8d3d5b7";
                        string strSKEY  = "2dsi35b3fdx050a41jufbnzirrlqd9kl";
                        string strUIN   = taobaoNick;
                        string strTOKEN = session;

                        ApiClient clientQQ = new ApiClient(strSPID, strSKEY, Convert.ToInt32(strUIN), strTOKEN);
                        //通过以下的接口函数添加这些参数
                        clientQQ.addParamInStringField("itemCode", arr[i]);
                        clientQQ.invokeApi("http://api.paipai.com/item/getItem.xhtml?charset=utf-8");

                        string result = clientQQ.ToString();

                        Regex           reg   = new Regex(@"""itemName"":""([^""]*)"",[\s\S]*""itemPrice"":""([^""]*)"",[\s\S]*""picLink"":""([^""]*)"",", RegexOptions.IgnoreCase);
                        MatchCollection match = reg.Matches(result);

                        for (int j = 0; j < match.Count; j++)
                        {
                            sql = "INSERT INTO TopIdeaProduct (" +
                                  "itemid, " +
                                  "itemname, " +
                                  "itemprice, " +
                                  "itempicurl, " +
                                  "ideaid " +
                                  " ) VALUES ( " +
                                  " '" + arr[i] + "', " +
                                  " '" + match[j].Groups[1].ToString() + "', " +
                                  " '" + match[j].Groups[2].ToString() + "', " +
                                  " '" + match[j].Groups[3].ToString() + "', " +
                                  " '" + id + "' " +
                                  ") ";
                            utils.ExecuteNonQuery(sql);
                        }
                    }
                }
            }

            //获取NICK的淘宝ID
            Cookie cookieNew     = new Cookie();
            string taobaoNickNew = cookieNew.getCookie("nick");

            Rijndael_ encodeaa = new Rijndael_("tetesoft");
            taobaoNickNew = encodeaa.Decrypt(taobaoNickNew);

            md5nick = MD5(taobaoNickNew);

            //string sqlNew = "SELECT sid FROM TopTaobaoShop WHERE nick = '" + taobaoNickNew + "'";
            string    sqlNew = "SELECT sellerUin FROM TopPaipaiShop WHERE sellerUin = '" + taobaoNickNew + "'";
            DataTable dtNew  = utils.ExecuteDataTable(sqlNew);
            if (dtNew.Rows.Count != 0)
            {
                nickid = "http://shop.paipai.com/" + dtNew.Rows[0][0].ToString();
            }
            else
            {
                nickid = "http://www.paipai.com/";
            }

            nickidEncode = "http://www.7fshop.com/click/?s=" + EncodeStr(new string[] { id, "0", nickid });

            string    sql112 = "SELECT * FROM TopIdea WHERE id = " + id;
            DataTable newdt1 = utils.ExecuteDataTable(sql112);
            if (newdt1.Rows.Count != 0)
            {
                tabletitle = newdt1.Rows[0]["name"].ToString();
                size       = newdt1.Rows[0]["size"].ToString();
            }

            string num = string.Empty;
            string row = string.Empty;
            switch (size)
            {
            case "514*160":
                num = "5";
                row = "5";
                break;

            case "514*288":
                num = "10";
                row = "5";
                break;

            case "664*160":
                num = "6";
                row = "6";
                break;

            case "312*288":
                num = "6";
                row = "3";
                break;

            case "336*280":
                num = "4";
                row = "2";
                break;

            case "714*160":
                num = "7";
                row = "7";
                break;

            case "114*418":
                num = "3";
                row = "1";
                break;

            case "218*286":
                num = "4";
                row = "2";
                break;

            case "743*308":
                num = "4";
                row = "4";
                break;

            default:
                num = "4";
                row = "4";
                break;
            }

            //绑定商品列表
            string    sql11 = "SELECT TOP " + num + " *,'' AS html FROM TopIdeaProduct WHERE ideaid = " + id;
            DataTable newdt = utils.ExecuteDataTable(sql11);

            //加换行符
            for (int i = 0; i < newdt.Rows.Count; i++)
            {
                if ((i + 1) % int.Parse(row) == 0)
                {
                    newdt.Rows[i]["html"] = "</tr><tr>";
                }
            }

            if (size != "743*308")
            {
                panel1.Visible        = true;
                panel2.Visible        = false;
                rptProduct.DataSource = newdt;
                rptProduct.DataBind();
            }
            else
            {
                panel1.Visible         = false;
                panel2.Visible         = true;
                rptProduct2.DataSource = newdt;
                rptProduct2.DataBind();
            }

            string[] arrNew = size.Split('*');
            width  = arrNew[0];
            height = arrNew[1];
        }
        catch { }
    }
コード例 #36
0
ファイル: GoodsApi.cs プロジェクト: jiguixin/MyTools
        /// <summary>
        /// 检查该产品是否已经上架
        /// taobao.items.onsale.get 获取当前会话用户出售中的商品列表
        /// </summary>
        /// <param name="goodsSn">款号</param>
        /// <returns></returns>
        public Item VerifyGoodsExist(string goodsSn)
        {
            goodsSn.ThrowIfNullOrEmpty(
                Resource.ExceptionTemplate_MethedParameterIsNullorEmpty.StringFormat(new StackTrace()));

            var req = new ItemsOnsaleGetRequest { Fields = "num_iid,num,cid,title,outer_id,price,pic_url", Q = goodsSn, PageSize = 10 };
            List<Item> onSaleGoods = GetOnSaleGoods(req);

            if (onSaleGoods != null && onSaleGoods.Count > 0)
            {
                _log.LogWarning(Resource.Log_GoodsAlreadyExist, goodsSn);
                return onSaleGoods[0];
            }

            return null;
        }
コード例 #37
0
        /// <summary>
        /// 查询在售商品
        /// </summary>
        /// <param name="sessionKey"></param>
        /// <param name="Query"></param>
        internal IList <Item> SearchOnsalesByCriteria(string sessionKey, ref int TotalNum, QueryCriteriaForOnSales Query)
        {
            ITopClient            client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json");
            ItemsOnsaleGetRequest req    = new ItemsOnsaleGetRequest();

            req.Fields = "approve_status,num_iid,title,nick,type,cid,pic_url,num,props,valid_thru,list_time,price,has_discount,has_invoice,has_warranty,has_showcase,modified,delist_time,postage_id,seller_cids,outer_id,sku";
            if (Query.Q != null)
            {
                req.Q = Query.Q;
            }
            if (Query.Cid != null)
            {
                req.Cid = Query.Cid;
            }
            if (Query.SellerCids != null)
            {
                req.SellerCids = Query.SellerCids;
            }
            if (Query.PageNo != null)
            {
                req.PageNo = Query.PageNo;
            }
            else
            {
                req.PageNo = 1;
            }
            if (Query.PageSize != null)
            {
                req.PageSize = Query.PageSize;
            }
            else
            {
                req.PageSize = 10;
            }
            if (Query.HasDiscount != null)
            {
                req.HasDiscount = Query.HasDiscount;
            }
            if (Query.HasShowcase != null)
            {
                req.HasShowcase = Query.HasShowcase;
            }
            if (Query.OrderBy != null)
            {
                req.OrderBy = Query.OrderBy;
            }
            if (Query.IsTaobao != null)
            {
                req.IsTaobao = Query.IsTaobao;
            }
            if (Query.IsEx != null)
            {
                req.IsEx = Query.IsEx;
            }
            if (Query.StartModified != null)
            {
                req.StartModified = Query.StartModified;
            }
            if (Query.EndModified != null)
            {
                req.EndModified = Query.EndModified;
            }
            if (Query.IsCspu != null)
            {
                req.IsCspu = Query.IsCspu;
            }
            ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);

            TotalNum = (int)response.TotalResults;
            return(ChangeTypeForItem(response.Body));
        }
コード例 #38
0
ファイル: GoodsApi.cs プロジェクト: jiguixin/MyTools
        /// <summary>
        /// 得到当前在售商品,最多个数为199
        /// </summary>
        /// <param name="search">查询条件</param>
        /// <returns></returns>
        public List<Item> GetOnSaleGoods(string search = null)
        {
            //得到当前用户的在售商品列表
            var req = new ItemsOnsaleGetRequest { Fields = "num_iid,num,cid,title,outer_id,price,pic_url", PageSize = 199 };
            if (!search.IsNullOrEmpty())
                req.Q = search;

            return GetOnSaleGoods(req);
        }
コード例 #39
0
ファイル: Item_ModifyName.aspx.cs プロジェクト: feidu/TBAPP
        private void BindOnsaleItem(string searchTitle)
        {
            if (Request.QueryString["PageID"] != null)
            {
                PL.PageID = Convert.ToInt16(Request.QueryString["PageID"]);
            }
            PL.PageSize = 4;
            int total = 0;

            tbClient = new DefaultTopClient(Config.ServerURL, Config.Appkey, Config.Secret);
            ItemsOnsaleGetRequest itemOnsaleReq = new ItemsOnsaleGetRequest();
            itemOnsaleReq.Fields = "num_iid,title,price";
            itemOnsaleReq.PageNo = PL.PageID;
            itemOnsaleReq.PageSize = PL.PageSize;
            if (searchTitle != "")
            {
                itemOnsaleReq.Q = searchTitle;
            }
            ItemsOnsaleGetResponse itemOnsaleResp = tbClient.Execute(itemOnsaleReq, base.sessionkey);
            if (!itemOnsaleResp.IsError)
            {
                DataList1.DataSource = itemOnsaleResp.Items;
                DataList1.DataBind();

                total = (int)itemOnsaleResp.TotalResults;
                PL.RecordCount = total;
                PageListLink = new PageListBll().GetPageList(PL);
            }
        }
コード例 #40
0
ファイル: Default2.aspx.cs プロジェクト: yangdayuan/mylab
    //查询出售中的宝贝
    protected void Button3_Click(object sender, EventArgs e)
    {
        //Set to empty to avoid including previous value.
        ItemsInfo.Text = string.Empty;

        ITopClient client = new DefaultTopClient(url, appkey, appsecret);
        ItemsOnsaleGetRequest req = new ItemsOnsaleGetRequest();
        req.Fields = "num_iid,title,price,pic_url,has_showcase";
        ItemsOnsaleGetResponse response = client.Execute(req, sessionKey);

        DataList1.DataSource = response.Items;
        DataList1.DataBind();

        /* print all the tital of items
        for (int i = 1; i < (response.TotalResults / 200 + 2); i++)
        {
            //int y = 1;
            req.Fields = "num_iid,title,price";
            //req.Q = "N97";
            //req.Cid = 1512L;
            //req.SellerCids = "11";
            req.PageNo = i;
            //req.HasDiscount = true;
            //req.HasShowcase = true;
            //req.OrderBy = "num:desc";
            //req.IsTaobao = true;
            //req.IsEx = true;
            req.PageSize = 200L;
            //DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            //req.StartModified = dateTime;
            //DateTime dateTime = DateTime.Parse("2000-01-01 00:00:00");
            //req.EndModified = dateTime;
            response = client.Execute(req, sessionKey);
            foreach (Item I in response.Items)
            {

                ItemsInfo.Text += I.Title + "<br />";
                //y++;
            }
            //DataList1.DataSource = response.Items;
            //DataList1.DataBind();
        }
         */
    }