/// <summary> /// 查询卖家已卖出的交易数据(根据创建时间) /// </summary> /// <param name="sessionKey"></param> /// <param name="TradesSold"></param> /// <param name="ErrorMsg">错误信息</param> /// <param name="HasNext">是否存在下一页</param> /// <param name="TotalResults">总行数</param> /// <returns></returns> internal List <Trade> GetTradesSold(string sessionKey, TradesSoldGet TradesSold, out string ErrorMsg, out bool HasNext, out long TotalResults) { ErrorMsg = null; HasNext = false; TotalResults = 0; List <Trade> ListTrades = new List <Trade>(); try { ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json"); TradesSoldGetRequest req = new TradesSoldGetRequest(); req.Fields = "tid,created,pay_time,end_time,status,price,buyer_nick"; if (TradesSold.StartCreated != null) { string startt = TradesSold.StartCreated.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateTime dateTime = DateTime.Parse(startt); req.StartCreated = dateTime; } if (TradesSold.EndCreated != null) { string endt = TradesSold.EndCreated.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateTime dateTime = DateTime.Parse(endt); req.EndCreated = dateTime; } if (TradesSold.Status != null) { req.Status = TradesSold.Status; } if (TradesSold.BuyerNick != null) { req.BuyerNick = TradesSold.BuyerNick; } /* fixed(一口价) auction(拍卖) guarantee_trade(一口价、拍卖) step(分阶段付款,万人团,阶梯团订单) * independent_simple_trade(旺店入门版交易) independent_shop_trade(旺店标准版交易) * auto_delivery(自动发货) ec(直冲) cod(货到付款) game_equipment(游戏装备) shopex_trade(ShopEX交易) * netcn_trade(万网交易) external_trade(统一外部交易) instant_trade (即时到账) b2c_cod(大商家货到付款) * hotel_trade(酒店类型交易) super_market_trade(商超交易) super_market_cod_trade(商超货到付款交易) * taohua(淘花网交易类型) waimai(外卖交易类型) o2o_offlinetrade(O2O交易) nopaid(即时到帐/趣味猜交易类型) * step (万人团) eticket(电子凭证) tmall_i18n(天猫国际);nopaid (无付款交易)insurance_plus(保险) * finance(基金) 注:guarantee_trade是一个组合查询条件,并不是一种交易类型,获取批量或单个订单中不会返回此种类型的订单。 * pre_auth_type(预授权0元购) */ TradesSold.Type += "guarantee_trade, step," + " independent_simple_trade, independent_shop_trade, " + " auto_delivery, ec,cod, game_equipment, shopex_trade," + " netcn_trade, external_trade, instant_trade , b2c_cod," + " hotel_trade, super_market_trade, super_market_cod_trade," + " taohua,waimai, o2o_offlinetrade, nopaid,pre_auth_type," + " step, eticket, tmall_i18n,nopaid ,insurance_plus, finance"; if (TradesSold.Type != null) { req.Type = TradesSold.Type; } if (TradesSold.ExtType != null) { req.ExtType = TradesSold.ExtType; } if (TradesSold.RateStatus != null) { req.RateStatus = TradesSold.RateStatus; } if (TradesSold.Tag != null) { req.Tag = TradesSold.Tag; } if (TradesSold.PageNo != null) { req.PageNo = TradesSold.PageNo; } if (TradesSold.PageSize != null) { req.PageSize = TradesSold.PageSize; } if (TradesSold.UseHasNext != null) { req.UseHasNext = TradesSold.UseHasNext; } TradesSoldGetResponse response = client.Execute(req, sessionKey); if (response.IsError) { ErrorMsg = response.SubErrMsg; } else { TopJsonParser topjson = new TopJsonParser(); TradesSoldGetResponse1 resp = topjson.Parse <TradesSoldGetResponse1>(response.Body); ListTrades = resp.Trades; if (TradesSold.UseHasNext == true) { HasNext = resp.HasNext; } else { TotalResults = resp.TotalResults; } } } catch (Exception ex) { throw ex; } return(ListTrades); }
/// <summary> /// 查询卖家已卖出的交易数据(根据创建时间) /// </summary> /// <param name="sessionKey"></param> /// <param name="TradesSold"></param> /// <param name="ErrorMsg">错误信息</param> /// <param name="HasNext">是否存在下一页</param> /// <param name="TotalResults">总行数</param> /// <returns></returns> internal List <Trade> GetTradesSoldToTradeRate(string sessionKey, TradesSoldGet TradesSold, out string ErrorMsg, out bool HasNext, out long TotalResults) { ErrorMsg = null; HasNext = false; TotalResults = 0; List <Trade> ListTrades = new List <Trade>(); try { ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json"); TradesSoldGetRequest req = new TradesSoldGetRequest(); req.Fields = "seller_nick, buyer_nick, title, type, created, tid, seller_rate,seller_can_rate, buyer_rate,can_rate, status, payment, discount_fee, adjust_fee, post_fee, total_fee, pay_time, end_time, modified, consign_time, buyer_obtain_point_fee, point_fee, real_point_fee, received_payment, pic_path, num_iid, num, price, cod_fee, cod_status, shipping_type, receiver_name, receiver_state, receiver_city, receiver_district, receiver_address, receiver_zip, receiver_mobile, receiver_phone,seller_flag,alipay_id,alipay_no,is_lgtype,is_force_wlb,is_brand_sale,buyer_area,has_buyer_message, credit_card_fee, lg_aging_type, lg_aging, step_trade_status,step_paid_fee,mark_desc,has_yfx,yfx_fee,yfx_id,yfx_type,trade_source,send_time,is_daixiao,is_wt,is_part_consign,zero_purchase,orders"; if (TradesSold.StartCreated != null) { string startt = TradesSold.StartCreated.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateTime dateTime = DateTime.Parse(startt); req.StartCreated = dateTime; } if (TradesSold.EndCreated != null) { string endt = TradesSold.EndCreated.Value.ToString("yyyy-MM-dd HH:mm:ss"); DateTime dateTime = DateTime.Parse(endt); req.EndCreated = dateTime; } if (TradesSold.Status != null) { req.Status = TradesSold.Status; } if (TradesSold.BuyerNick != null) { req.BuyerNick = TradesSold.BuyerNick; } /* fixed(一口价) auction(拍卖) guarantee_trade(一口价、拍卖) step(分阶段付款,万人团,阶梯团订单) * independent_simple_trade(旺店入门版交易) independent_shop_trade(旺店标准版交易) * auto_delivery(自动发货) ec(直冲) cod(货到付款) game_equipment(游戏装备) shopex_trade(ShopEX交易) * netcn_trade(万网交易) external_trade(统一外部交易) instant_trade (即时到账) b2c_cod(大商家货到付款) * hotel_trade(酒店类型交易) super_market_trade(商超交易) super_market_cod_trade(商超货到付款交易) * taohua(淘花网交易类型) waimai(外卖交易类型) o2o_offlinetrade(O2O交易) nopaid(即时到帐/趣味猜交易类型) * step (万人团) eticket(电子凭证) tmall_i18n(天猫国际);nopaid (无付款交易)insurance_plus(保险) * finance(基金) 注:guarantee_trade是一个组合查询条件,并不是一种交易类型,获取批量或单个订单中不会返回此种类型的订单。 * pre_auth_type(预授权0元购) */ TradesSold.Type += "guarantee_trade, step," + " independent_simple_trade, independent_shop_trade, " + " auto_delivery, ec,cod, game_equipment, shopex_trade," + " netcn_trade, external_trade, instant_trade , b2c_cod," + " hotel_trade, super_market_trade, super_market_cod_trade," + " taohua,waimai, o2o_offlinetrade, nopaid,pre_auth_type," + " step, eticket, tmall_i18n,nopaid ,insurance_plus, finance"; if (TradesSold.Type != null) { req.Type = TradesSold.Type; } if (TradesSold.ExtType != null) { req.ExtType = TradesSold.ExtType; } if (TradesSold.RateStatus != null) { req.RateStatus = TradesSold.RateStatus; } if (TradesSold.Tag != null) { req.Tag = TradesSold.Tag; } if (TradesSold.PageNo != null) { req.PageNo = TradesSold.PageNo; } if (TradesSold.PageSize != null) { req.PageSize = TradesSold.PageSize; } if (TradesSold.UseHasNext != null) { req.UseHasNext = TradesSold.UseHasNext; } TradesSoldGetResponse response = client.Execute(req, sessionKey); if (response.IsError) { ErrorMsg = response.SubErrMsg; } else { TopJsonParser topjson = new TopJsonParser(); TradesSoldGetResponse1 resp = topjson.Parse <TradesSoldGetResponse1>(response.Body); ListTrades = resp.Trades; if (TradesSold.UseHasNext == true) { HasNext = resp.HasNext; } else { TotalResults = resp.TotalResults; } } } catch (Exception ex) { throw ex; } return(ListTrades); }
/// <summary> /// 查询卖家已卖出的增量交易数据(根据修改时间) /// </summary> /// <param name="sessionKey"></param> /// <param name="TradesSold"></param> /// <param name="ErrorMsg"></param> /// <returns></returns> internal List <Trade> GetTradesSoldIncrement(string sessionKey, TradesSoldGet TradesSold, out string ErrorMsg) { ErrorMsg = null; List <Trade> ListTrades = new List <Trade>(); DateTime starttime = new DateTime(); DateTime endtime = new DateTime(); try { ITopClient client = new DefaultTopClient(StaticSystemConfig.soft.ApiURL, StaticSystemConfig.soft.AppKey, StaticSystemConfig.soft.AppSecret, "json"); TradesSoldIncrementGetRequest req = new TradesSoldIncrementGetRequest(); req.Fields = "tid,created,pay_time,end_time,status,snapshot_url,buyer_message,price,buyer_nick,seller_memo,seller_flag,orders"; if (TradesSold.StartCreated != null) { string startt = TradesSold.StartModified.Value.ToString("yyyy-MM-dd HH:mm:ss"); starttime = DateTime.Parse(startt); req.StartModified = starttime; } if (TradesSold.EndCreated != null) { string startt = TradesSold.EndModified.Value.ToString("yyyy-MM-dd HH:mm:ss"); endtime = DateTime.Parse(startt); req.EndModified = endtime; } //这里修正结束时间与开始时间间隔超一天,自动修改时间为开始时间的后一天 if (starttime != new DateTime() && endtime != new DateTime()) { if (endtime.Subtract(starttime).Days > 1) { req.EndModified = starttime.AddDays(1); } } if (TradesSold.Status != null) { req.Status = TradesSold.Status; } if (TradesSold.Type != null) { req.Type = TradesSold.Type; } if (TradesSold.ExtType != null) { req.ExtType = TradesSold.ExtType; } if (TradesSold.Tag != null) { req.Tag = TradesSold.Tag; } if (TradesSold.PageNo != null) { req.PageNo = TradesSold.PageNo; } if (TradesSold.PageSize != null) { req.PageSize = TradesSold.PageSize; } if (TradesSold.UseHasNext != null) { req.UseHasNext = TradesSold.UseHasNext; } TradesSoldIncrementGetResponse response = client.Execute(req, sessionKey); if (response.IsError) { ErrorMsg = response.SubErrMsg; } else { TopJsonParser topjson = new TopJsonParser(); TradesSoldGetResponse1 resp = topjson.Parse <TradesSoldGetResponse1>(response.Body); ListTrades = resp.Trades; } } catch (Exception ex) { throw; } return(ListTrades); }