Ejemplo n.º 1
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "21093339", "c1c22ba85fb91bd20279213ef7b9ee80");
        //记录店铺基本信息
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }
        string ip = Request.UserHostAddress;
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "ip, " +
                     "session, " +
                     "remain_count,refreshToken" +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + ip + "', " +
                     " '" + top_session + "', " +
                     " '" + shop.RemainCount + "','" + refreshToken + "'" +
                     ") ";

        utils.ExecuteNonQuery(sql);
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.tbsandbox.com/router/rest", "test", "test");

        //UserGetRequest request = new UserGetRequest();
        //request.Fields = "buyer_credit";
        //request.Nick = "golddonkey";

        //Taobao.Top.Api.Domain.User user = client.UserGet(request);

        //Response.Write(user.BuyerCredit.Score);



        //ProductsGetRequest request = new ProductsGetRequest();

        //request.Fields = "product_id,name,pic_url,shop_price";
        //request.Nick = "golddonkey";

        //PageList<Product> product = client.ProductsGet(request);

        //Response.Write(product.Content.Count);

        //test.DataSource = product.Content;
        //test.DataBind();



        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "title";
        request.Nick   = "golddonkey";

        Shop shop = client.ShopGet(request);

        Response.Write(shop.Title);
    }
Ejemplo n.º 3
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12287381", "d3486dac8198ef01000e7bd4504601a4");
        //记录店铺基本信息
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop = client.ShopGet(request);
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "remain_count " +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + shop.RemainCount + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);
        //记录店铺分类信息
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Fields = "cid,parent_cid,name,is_parent";
        request1.Nick   = nick;
        PageList <SellerCat> cat = client.SellercatsListGet(request1);

        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 + "', " +
                  " '" + nick + "', " +
                  " '" + cat.Content[i].Modified + "' " +
                  ") ";
            utils.ExecuteNonQuery(sql);
        }

        //记录店铺所有商品信息-暂不记录
    }
Ejemplo n.º 4
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", top_appkey, app_secret);
        //记录店铺基本信息
        string         ip      = Request.UserHostAddress;
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }

        //获取版本号
        string version = "9";
        //IDictionary<string, string> param = new Dictionary<string, string>();
        //param.Add("article_code", "service-0-22904");
        //param.Add("nick", nick);

        //string result = PostJson("http://gw.api.taobao.com/router/rest", top_appkey, app_secret, "taobao.vas.subscribe.get", top_session, param);
        //if (result.IndexOf("\"article_user_subscribes\":{}") == -1)
        //{
        //    Regex reg = new Regex(@"""item_code"":""([^""]*)""", RegexOptions.IgnoreCase);
        //    //更新店铺的版本号
        //    MatchCollection match = reg.Matches(result);
        //    for (int j = 0; j < match.Count; j++)
        //    {
        //        version = match[j].Groups[1].ToString().Replace("service-0-22904-", "");

        //        if (version == "9")
        //        {
        //            version = "3";
        //        }

        //        if (int.Parse(version) <= 3)
        //        {
        //            break;
        //        }
        //    }
        //}

        //记录到本地数据库
        string sql = "INSERT INTO TCS_ShopSession (" +
                     "sid, " +
                     "nick, " +
                     "typ, " +
                     "version, " +
                     "session" +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Nick + "', " +
                     " 'taobao', " +
                     " '" + version + "', " +
                     " '" + top_session + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);
    }
Ejemplo n.º 5
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        //记录店铺基本信息
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "versionNo, " +
                     "remain_count " +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + versionNo + "', " +
                     " '" + shop.RemainCount + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);



        //记录店铺分类信息
        SellercatsListGetRequest request1 = new SellercatsListGetRequest();

        request1.Fields = "cid,parent_cid,name,is_parent";
        request1.Nick   = nick;
        PageList <SellerCat> cat = client.SellercatsListGet(request1);

        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 + "', " +
                  " '" + nick + "', " +
                  " '" + cat.Content[i].Modified + "' " +
                  ") ";
            utils.ExecuteNonQuery(sql);
        }

        //记录店铺所有商品信息-暂不记录
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12159997", "614e40bfdb96e9063031d1a9e56fbed5");
        //记录店铺基本信息
        string         ip      = Request.UserHostAddress;
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }

        //获取版本号
        string appkey  = "12159997";
        string secret  = "614e40bfdb96e9063031d1a9e56fbed5";
        string version = "9";
        IDictionary <string, string> param = new Dictionary <string, string>();

        param.Add("article_code", "service-0-22904");
        param.Add("nick", nick);
        Common.Cookie cookie = new Common.Cookie();

        string result = PostJson("http://gw.api.taobao.com/router/rest", appkey, secret, "taobao.vas.subscribe.get", top_session, param);

        if (result.IndexOf("\"article_user_subscribes\":{}") == -1)
        {
            Regex reg = new Regex(@"""item_code"":""([^""]*)""", RegexOptions.IgnoreCase);
            //更新店铺的版本号
            MatchCollection match = reg.Matches(result);
            for (int j = 0; j < match.Count; j++)
            {
                version = match[j].Groups[1].ToString().Replace("service-0-22904-", "");

                if (version == "9")
                {
                    version = "3";
                }

                if (int.Parse(version) <= 3)
                {
                    break;
                }
            }
        }

        string plus = string.Empty;

        if (version == "1")
        {
            version = "2";
        }

        if (version == "2")
        {
            plus = "freecard";
        }

        if (version == "3")
        {
            plus = "crm|freecard";
        }
        string tuiguang = cookie.getCookie("tuiguang");
        string istui    = "0";

        if (tuiguang != null && tuiguang != "")
        {
            istui = "1";
        }

        //记录到本地数据库
        string sql = "INSERT INTO TCS_ShopSession (" +
                     "sid, " +
                     "nick, " +
                     "typ, " +
                     "version, " +
                     "plus, " +
                     "token, " +
                     "ip, " +
                     "istui, " +
                     "session" +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Nick + "', " +
                     " 'taobao', " +
                     " '" + version + "', " +
                     " '" + plus + "', " +
                     " '" + refreshToken + "', " +
                     " '" + ip + "', " +
                     " '" + istui + "', " +
                     " '" + top_session + "' " +
                     ") ";

        utils.ExecuteNonQuery(sql);

        //如果是好友推荐来的,记录到推荐数据库
        string tuijianid = cookie.getCookie("tuijianid");

        if (tuijianid != null && tuijianid != "")
        {
            Rijndael_ encode   = new Rijndael_("tetesoft");
            string    nickFrom = encode.Decrypt(tuijianid);

            sql = "SELECT COUNT(*) FROM TCS_Tuijian WHERE nickfrom = '" + nickFrom + "' AND nickto = '" + shop.Nick + "'";
            string count = utils.ExecuteString(sql);
            if (count != "0")
            {
                return;
            }

            sql = "INSERT INTO TCS_Tuijian (" +
                  "nickfrom, " +
                  "nickto " +
                  " ) VALUES ( " +
                  " '" + nickFrom + "', " +
                  " '" + shop.Nick + "' " +
                  ") ";

            utils.ExecuteNonQuery(sql);

            string giftMsg = "80";
            //插入充值记录并更新短信条数
            sql = "INSERT INTO TCS_PayLog (" +
                  "typ, " +
                  "enddate, " +
                  "nick, " +
                  "count " +
                  " ) VALUES ( " +
                  " '推荐好友【" + shop.Nick + "】赠送80条短信', " +
                  " GETDATE(), " +
                  " '" + nickFrom + "', " +
                  " '" + giftMsg + "' " +
                  ") ";
            utils.ExecuteNonQuery(sql);

            sql = "UPDATE TCS_ShopConfig SET total = total + " + giftMsg + " WHERE nick = '" + nickFrom + "'";
            utils.ExecuteNonQuery(sql);
        }
    }
    /// <summary>
    /// 记录该会员的店铺信息
    /// </summary>
    private void InsertUserInfo(string nick)
    {
        TopXmlRestClient client = new TopXmlRestClient("http://gw.api.taobao.com/router/rest", "12223169", "ff3d3442ab809930d187623ffad8e91e");
        //记录店铺基本信息
        string         ip      = Request.UserHostAddress;
        ShopGetRequest request = new ShopGetRequest();

        request.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified";
        request.Nick   = nick;
        Shop shop;

        try
        {
            shop = client.ShopGet(request);
        }
        catch
        {
            Response.Write("没有店铺的淘宝会员不可使用该应用,如果您想继续使用,请先去淘宝网开个属于您自己的店铺!<br> <a href='http://www.taobao.com/'>返回</a>");
            Response.End();
            return;
        }
        //记录到本地数据库
        string sql = "INSERT INTO TopTaobaoShop (" +
                     "sid, " +
                     "cid, " +
                     "title, " +
                     "nick, " +
                     "[desc], " +
                     "bulletin, " +
                     "pic_path, " +
                     "created, " +
                     "modified, " +
                     "shop_score, " +
                     "versionNo, " +
                     "sessionblog, " +
                     "ip, " +
                     "remain_count " +
                     " ) VALUES ( " +
                     " '" + shop.Sid + "', " +
                     " '" + shop.Cid + "', " +
                     " '" + shop.Title + "', " +
                     " '" + shop.Nick + "', " +
                     " '" + shop.Desc + "', " +
                     " '" + shop.Bulletin + "', " +
                     " '" + shop.PicPath + "', " +
                     " '" + shop.Created + "', " +
                     " '" + shop.Modified + "', " +
                     " '" + shop.ShopScore + "', " +
                     " '" + versionNo + "', " +
                     " '" + top_session + "', " +
                     " '" + ip + "', " +
                     " '" + shop.RemainCount + "' " +
                     ") ";


        sql = "INSERT INTO TCS_ShopSession (" +
              "sid, " +
              "nick, " +
              "typ, " +
              "version, " +
              "session" +
              " ) VALUES ( " +
              " '" + shop.Sid + "', " +
              " '" + shop.Nick + "', " +
              " 'taobao', " +
              " '" + versionNo + "', " +
              " '" + top_session + "' " +
              ") ";

        utils.ExecuteNonQuery(sql);



        //记录店铺分类信息

        /*SellercatsListGetRequest request1 = new SellercatsListGetRequest();
         * request1.Fields = "cid,parent_cid,name,is_parent";
         * request1.Nick = nick;
         * PageList<SellerCat> cat = client.SellercatsListGet(request1);
         *
         * 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 + "', " +
         *                  " '" + nick + "', " +
         *                  " '" + cat.Content[i].Modified + "' " +
         *            ") ";
         *  utils.ExecuteNonQuery(sql);
         * }
         */

        //记录店铺所有商品信息-暂不记录
    }