예제 #1
0
 /// <summary>
 /// TOP API: taobao.taobaoke.shops.convert
 /// </summary>
 public PageList<TaobaokeShop> TaobaokeShopsConvert(TaobaokeShopsConvertRequest request, string session)
 {
     return client.Execute(request, new ListXmlParser<TaobaokeShop>(new ParseData(request.GetApiName(), "taobaoke_shops", "taobaoke_shop")), session);
 }
예제 #2
0
        /// <summary>
        /// 搜索并增加或更新店铺信息
        /// </summary>
        /// <param name="nickname">卖家昵称</param>
        public static int SearchAndAddShop(string nickname)
        {
            UserGetRequest ugr = new UserGetRequest();
            ugr.Fields = "user_id,nick,seller_credit,location,type,promoted_type,status,consumer_protection";
            ugr.Nick = nickname;
            User userinfo = new User();
            try
            {
                userinfo = client.UserGet(ugr);
            }
            catch (NTWException ntwe1)
            {
                userinfo = null;
            }
            if (userinfo == null) return 0;
            Location locainfo = userinfo.Location;
            UserCredit ucredit = userinfo.SellerCredit;

            ShopGetRequest sgr = new ShopGetRequest();
            sgr.Fields = "sid,cid,title,nick,desc,bulletin,pic_path,created,modified,shop_score";
            sgr.Nick = nickname;
            Shop shopinfo = new Shop();
            try
            {
                shopinfo = client.ShopGet(sgr);
            }
            catch (NTWException ntwe2)
            {
                shopinfo = null;
            }
            if (shopinfo == null) return 0;
            ShopScore shopscore = shopinfo.ShopScore;

            TaobaokeShopsConvertRequest tcr = new TaobaokeShopsConvertRequest();
            tcr.Fields = "user_id,shop_title,click_url,commission_rate";
            tcr.Nick = SAS_USERNICK;
            tcr.Sids = shopinfo.Sid;
            PageList<TaobaokeShop> tks = client.TaobaokeShopsConvert(tcr);
            if (tks.Content.Count == 0) return 0;
            TaobaokeShop tshopinfo = tks.Content[0];

            ShopDetailInfo sinfo = new ShopDetailInfo();
            sinfo.sid = long.Parse(shopinfo.Sid.Trim());
            sinfo.user_id = long.Parse(tshopinfo.UserId.Trim());
            sinfo.cid = long.Parse(shopinfo.Cid.Trim());
            sinfo.nick = shopinfo.Nick;
            sinfo.title = shopinfo.Title;
            sinfo.item_score = shopscore.ItemScore;
            sinfo.service_score = shopscore.ServiceScore;
            sinfo.delivery_score = shopscore.DeliveryScore;
            sinfo.shop_desc = shopinfo.Desc == null ? "" : shopinfo.Desc;
            sinfo.bulletin = shopinfo.Bulletin == null ? "" : shopinfo.Bulletin;
            sinfo.pic_path = shopinfo.PicPath == null ? "" : shopinfo.PicPath;
            sinfo.created = shopinfo.Created == null ? "" : shopinfo.Created; ;
            sinfo.modified = shopinfo.Modified == null ? "" : shopinfo.Modified; ;
            sinfo.promoted_type = userinfo.PromotedType == null ? "" : userinfo.PromotedType;
            sinfo.consumer_protection = userinfo.ConsumerProtection;
            sinfo.shop_status = userinfo.Status == null ? "" : userinfo.Status;
            sinfo.shop_type = userinfo.Type;
            sinfo.shop_level = ucredit.Level;
            sinfo.shop_score = ucredit.Score;
            sinfo.total_num = ucredit.TotalNum;
            sinfo.good_num = ucredit.GoodNum;
            sinfo.shop_country = locainfo.Country == null ? "" : locainfo.Country;
            sinfo.shop_province = locainfo.State == null ? "" : locainfo.State;
            sinfo.shop_city = locainfo.City == null ? "" : locainfo.City;
            sinfo.shop_address = locainfo.Address == null ? "" : locainfo.Address;
            sinfo.commission_rate = tshopinfo.CommissionRate == null ? "" : tshopinfo.CommissionRate;
            sinfo.click_url = tshopinfo.ClickUrl == null ? "" : tshopinfo.ClickUrl;
            return CollectionTaoBaoShop(sinfo);
        }