eric_weixin 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04e1abdd9c635cd4590d5c0195ad1ffdfdb7403c
4
- data.tar.gz: 334908139a06070d009af276bb0854879b59c431
3
+ metadata.gz: 80beb7d241714a87e6159fc03053106cbeaf78e5
4
+ data.tar.gz: 4db48304387dde424d5c27ed1dcc4ffe23afdf60
5
5
  SHA512:
6
- metadata.gz: baf9f37558801003173f17a46ba2c44356e9cd45da49bf7d957e4675560c01e53df73f28e5ef85ea0b42ffa9159d3fb352b927c5d46ddf56e2679256e53bb1e2
7
- data.tar.gz: e1231514d5bca951aa94c7072b53e5b675f0551da1ae183f0ef5b6c394c12075ce8096424e29d66c601c2961d9220c408709d9637abd8b1e3c6f0ef9fb7a7429
6
+ metadata.gz: 47e63938b4b77e560178523949d7b02db6582100a7ad7d79afb5276f36f02e8416e8a72beb01e4aab6b62e1f80f2521f353ebdb2b66f594fde0db56eaa4c982c
7
+ data.tar.gz: 7b5ae164a8c2c5238aa765edebb4dfcc41ee8a9ecd945490f99b6854147f42902d062b4dd4191e9b18253b586293d57977c96646db1b5f531079029bc0328348
@@ -1,4 +1,7 @@
1
1
  class EricWeixin::Xiaodian::Order < ActiveRecord::Base
2
+ # require 'barby/barcode/code_128'
3
+ # require 'barby/outputter/png_outputter'
4
+
2
5
  self.table_name = 'weixin_xiaodian_orders'
3
6
  # belongs_to :weixin_user, class_name: "::EricWeixin::WeixinUser"
4
7
  belongs_to :product, class_name: "::EricWeixin::Xiaodian::Product", foreign_key: 'weixin_product_id'
@@ -349,4 +352,24 @@ class EricWeixin::Xiaodian::Order < ActiveRecord::Base
349
352
  "共#{total_count}条记录,更新成功#{success_count}条。"
350
353
  end
351
354
  end
355
+
356
+ # 生成订单的快递号条码, 图片保存在 ddc_system/public/uploads/barcode/ 文件夹中, 需要定时清除!
357
+ def delivery_id_barcode
358
+ delivery_id = self.delivery_id
359
+ file_name = "order_delivery_id_#{delivery_id}.png"
360
+ options = {
361
+ :content => delivery_id.to_s,
362
+ :file_path => Rails.root.join('public', 'uploads/barcode', file_name)
363
+ }
364
+ BarbyTools.create_barcode options # 使用tools里面的方法,代替下面这个注释过的代码块
365
+ # barcode = Barby::Code128B.new(delivery_id.to_s)
366
+ # blob = Barby::PngOutputter.new(barcode).to_png(:height => 20, :margin => 5) # 初始png数据
367
+ # file_path = Rails.root.join('public', 'uploads/barcode', file_name)
368
+ # File.open(file_path, 'wb'){|f|
369
+ # f.write blob.force_encoding("ISO-8859-1")
370
+ # }
371
+ simple_file_path = "/uploads/barcode/#{file_name}"
372
+ simple_file_path
373
+ end
374
+
352
375
  end
@@ -74,7 +74,7 @@
74
74
  微信小店官方物流公司:邮政EMS、申通快递、中通速递、圆通速递、天天快递、顺丰速运、韵达快运、宅急送、汇通快运、易迅快递
75
75
  <table style="width: 113%; table-layout: auto;" >
76
76
  <thead>
77
- <th>订单ID</th>
77
+ <th>订单ID/快递码</th>
78
78
 
79
79
  <th>昵称</th><th>购买时间</th><th>宝贝</th><th>宝贝信息</th><th>数量</th><th>收货信息</th>
80
80
 
@@ -83,7 +83,14 @@
83
83
  <tbody>
84
84
  <% @orders.each do |order| %>
85
85
  <tr>
86
- <td style="word-break:break-all"><%= order.order_id %></td>
86
+ <!--<td style="word-break:break-all"><%#= order.order_id %></td>-->
87
+ <td width="170px">
88
+ <%= order.order_id %>
89
+ <% unless order.delivery_id.blank? %>
90
+ <% file_path = order.delivery_id_barcode %>
91
+ <%= image_tag file_path, height: '80', width: '150' %>
92
+ <% end %>
93
+ </td>
87
94
  <td style="word-break:break-all"><%= order.buyer_nick rescue '' %></td>
88
95
  <td style="word-break:break-all"><%= Time.at(order.order_create_time).strftime("%Y-%m-%d %H:%M") %></td>
89
96
  <td style="word-break:break-all"><%= order.product.name rescue 'error' %></td>
@@ -1,3 +1,3 @@
1
1
  module EricWeixin
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eric_weixin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 刘晓琦
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-07 00:00:00.000000000 Z
11
+ date: 2016-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails