API 生成淘宝数据包 拍拍数据包 差异

这里我主要分析淘宝的CSV数据包。首先,特别强调一下,虽然同属于CSV的格式,但是淘宝的CSV格式要求保存为Unicode,而拍拍的需要保存为UTF-8。因此,这个前提不注意,你做出来的数据包导入到淘宝助理里,全部导入后会提示异常的错误信息,虽然能导入成功,但是每导入一次就要重新启动助理,这样太麻烦了。

  我这里不讲解所有的代码,只是把核心部分的代码拿出来给大家讲解下。

  从自己的独立购物网系统中将产品导入到淘宝助理过程核心代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
public List PrepareTaobaoCSVData()
{
  int num2;
  int num = 0x1f;
  List list = new List();
  string[] strArray = new string[] {
  "宝贝名称", "宝贝类目", "店铺类目", "新旧程度", "省", "城市", "出售方式", "宝贝价格", "加价幅度",
  "宝贝数量", "有效期", "运费承担", "平邮", "EMS", "快递", "付款方式",
  "支付宝", "发票", "保修", "自动重发", "放入仓库", "橱窗推荐", "发布时间", "心情故事",
  "宝贝描述", "宝贝图片", "宝贝属性", "团购价", "最小团购件数", "邮费模版ID", "会员打折"};
  list.Add(strArray);
  if(this.productList == null)
    this.productList = new ArrayList();
 
  this.m_parent.progressBar1.Maximum = this.productList.Count;
  int num3 = -1;
  for (num2 = 0; num2 < this.m_parent.listView1.Items.Count; num2++)
  {
    if (this.m_parent.listView1.Items[num2].Checked)
    {
      num3 = num2;
      break;
    }
  }
  for (num2 = 0; num2 < this.productList.Count; num2++)
  {
    ShopXGProduct product = (ShopXGProduct)this.productList[num2];
    string[] strArray2 = new string[num];
    XGTaoBao tag = (XGTaoBao)this.m_parent.listView1.Items[num3].Tag;
    this.m_parent.progressBar1.Value = num2 + 1;
    strArray2[0] = """+product.m_name+""";
    strArray2[1] = tag.m_cateId ;
    strArray2[2] = tag.m_shopCateId;
    strArray2[3] = tag.m_oldLevel;
    strArray2[4] = """ + tag.m_capital.Trim() + """;
    strArray2[5] = """ + tag.m_city.Trim() + """;
    strArray2[6] = """ + tag.m_saleType + """;
    strArray2[7] = PackageProductHelper.GetPriceByProIdAndTypeId(product.m_id,
                       ((OutPutCSV)this.m_parent).m_curPriceTypeId).ToString();
    strArray2[8] = tag.m_priceUpStep;
    strArray2[9] = tag.m_count;
    strArray2[10] = tag.m_validateTime;
    strArray2[11] = tag.m_post;
    strArray2[12] = tag.m_pingyou;
    strArray2[13] = tag.m_ems;
    strArray2[14] = tag.m_kuaidi;
    strArray2[15] = tag.m_payType;
    strArray2[0x10] = tag.m_zhifubao;
    strArray2[0x11] = tag.m_fapiao;
    strArray2[0x12] = tag.m_baoxiu;
    strArray2[0x13] = tag.m_autoSend;
    strArray2[20] = tag.m_putInStore;
    strArray2[0x15] = tag.m_recommend;
    strArray2[0x16] = """ + DateTime.Now.ToString() + """;
    strArray2[0x17] = """ + tag.m_story + """;
    if (this.m_parent.radioButton1.Checked)
    {
      strArray2[0x18] = """ + this.GetProductDescribe(tag.m_describe, product) + """;
    }
    else
    {
      strArray2[0x18] = """ + this.GetProductDescribe(this.m_parent.m_proDetailMode, product) + """;
    }
    string path = this.m_parent.textBox4.Text.Trim();
    if (!Directory.Exists(path))
    {
      Directory.CreateDirectory(path);
    }
    string str2 = DateTime.Now.ToString().Replace(" ", "").Replace("-", "").Replace(":", "") + num2.ToString();
    DealPic.SavePhotoFromUrl(path, str2 + ".jpg", product.m_pic1);
    strArray2[0x19] = """ + path + str2 + ".jpg" + """;
    strArray2[0x1a] = """ + tag.m_property+""";
    strArray2[0x1b] = strArray2[7];
    strArray2[0x1c] = tag.m_tgCnt;
    strArray2[0x1d] = tag.m_youfeiTemp;
    strArray2[30] = tag.m_zhekou;
    list.Add(strArray2);
  }
  return list;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值