blsm-vd-core 0.2.8 → 0.2.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/Gemfile.lock +1 -1
- data/README.md +100 -5
- data/lib/blsm-vd-core/version.rb +1 -1
- data/lib/blsm-vd-core.rb +3 -2
- metadata +26 -26
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTYxNmEyM2Y0ZDVjY2JhM2EwODgwMWE2NzM0NTEwMTY5ZmU1OGE2MQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 4fcc04f68524a98347dc91e6dbed81bbe18eda0b
|
4
|
+
data.tar.gz: 05269ebafde3fb68cba74e58f446fd89b55329cd
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjEyMDg4NTBkNTEyMjc2ZjQ2N2FjY2EyMDQzZjQwZWUxMjQwMjY3ZDg4MGI3
|
11
|
-
ZDI3MDNhMjNjZGI3M2IwNjBhN2YzZjFhNmJiMmMwZjUzOWU0ZjU=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NGM4ZDUzYzE5NWZlM2I0YTczODRlMDZjNDEwZjU4NjIxYmIwNzdiOTYwMDBh
|
14
|
-
ZmY0MjA1N2YzNTEzOTU4OWQwMWU3MzVkZmIwMDc4YzdjYzA5NWYxYzBjYjNk
|
15
|
-
ODdkNDRmZjI3YjY2MTg1MGIyODFlNGI1OTljMGY2MDJmYzI3ZmE=
|
6
|
+
metadata.gz: 3e126d8e27695b3ed81885fc83fe6d9f2cfc874c81412edd746c282cdeabe1e734d538af1c7a323e26cf7e24ba8125f7b1bc19ed195f16e2f7e4049346452450
|
7
|
+
data.tar.gz: 7303f81e1f3d2764ca599c4ec819bac039f2fbac590a66ed85d4c713453457b63cb93e410ab5f44cf1032eb843b475d77b9ea921a00d0a2be48715722e1c4034
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,28 @@
|
|
1
|
-
#
|
1
|
+
# BlsmVdCore
|
2
2
|
|
3
|
-
|
3
|
+
首趣微店核心模块,包含了结算项的创建、结算项更新、物流返款、拒签等。依赖于正式环境数据库。
|
4
4
|
|
5
|
-
|
5
|
+
### 包含的model
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
Application
|
9
|
+
Clearing #结算单
|
10
|
+
ClearingItem #结算项
|
11
|
+
LineItem
|
12
|
+
Order
|
13
|
+
Product
|
14
|
+
ProductProp
|
15
|
+
User
|
16
|
+
VdInfoSec #安全信息库,做唯一性校验
|
17
|
+
VdUserInfo #用户详情(积分、销售额、分销额等)
|
18
|
+
VdUserScore #积分历史等
|
19
|
+
```
|
20
|
+
|
21
|
+
### 依赖的gem
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'blsm-mp-wx'
|
25
|
+
```
|
6
26
|
|
7
27
|
## Installation
|
8
28
|
|
@@ -20,9 +40,84 @@ Or install it yourself as:
|
|
20
40
|
|
21
41
|
$ gem install blsm-vd-core
|
22
42
|
|
23
|
-
##
|
43
|
+
## 用法
|
44
|
+
|
45
|
+
|
46
|
+
### 订单状态改变时
|
47
|
+
|
48
|
+
#### 介绍
|
49
|
+
|
50
|
+
当订单状态发生改变时,调用此方法,包含“订单发出”、“订单取消”、“创建结算项”等
|
51
|
+
|
52
|
+
#### 用法
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
r = BlsmVdCore.on_order_state_change(394298)
|
56
|
+
puts "#{r[:code].to_s}\n"
|
57
|
+
#=> 200
|
58
|
+
```
|
59
|
+
|
60
|
+
|
61
|
+
### 订单发出时(慎用此方法)
|
62
|
+
|
63
|
+
#### 介绍
|
64
|
+
|
65
|
+
当订单状态发生改变时,调用此方法
|
66
|
+
|
67
|
+
#### 用法
|
68
|
+
|
69
|
+
```ruby
|
70
|
+
r = BlsmVdCore.on_order_sale_out(181,394298)
|
71
|
+
puts "#{r[:code].to_s}\n"
|
72
|
+
#=> 200
|
73
|
+
```
|
74
|
+
|
24
75
|
|
25
|
-
|
76
|
+
|
77
|
+
### 订单取消时(慎用此方法)
|
78
|
+
|
79
|
+
#### 介绍
|
80
|
+
|
81
|
+
当订单状态发生改变时,调用此方法
|
82
|
+
|
83
|
+
#### 用法
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
r = BlsmVdCore.on_order_canceled(181,394298)
|
87
|
+
puts "#{r[:code].to_s}\n"
|
88
|
+
#=> 200
|
89
|
+
```
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
### 物流返款/拒签
|
94
|
+
|
95
|
+
#### 介绍
|
96
|
+
|
97
|
+
当订单状态发生改变时,调用此方法
|
98
|
+
|
99
|
+
#### 用法
|
100
|
+
|
101
|
+
```ruby
|
102
|
+
r = BlsmVdCore.on_order_signed(394298,'sign_ok')
|
103
|
+
puts "#{r[:code].to_s}\n"
|
104
|
+
#=> 200
|
105
|
+
```
|
106
|
+
|
107
|
+
|
108
|
+
### 创建结算项(慎重调用此方法)
|
109
|
+
|
110
|
+
#### 介绍
|
111
|
+
|
112
|
+
当订单状态发生改变时,调用此方法
|
113
|
+
|
114
|
+
#### 用法
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
r = BlsmVdCore.create_clearing_item(394298)
|
118
|
+
puts "#{r[:code].to_s}\n"
|
119
|
+
#=> 200
|
120
|
+
```
|
26
121
|
|
27
122
|
## Development
|
28
123
|
|
data/lib/blsm-vd-core/version.rb
CHANGED
data/lib/blsm-vd-core.rb
CHANGED
@@ -129,7 +129,8 @@ module BlsmVdCore
|
|
129
129
|
#调用此方法,只会创建一个对应的结算项,如果之前有结算项,会直接更新相应的结算项
|
130
130
|
#==== Parameters
|
131
131
|
# * +order_id+ - 订单id
|
132
|
-
|
132
|
+
# * +force+ - 是否强制创建结算项
|
133
|
+
def create_clearing_item(order_id, force=false)
|
133
134
|
order = Order.where(id: order_id).first
|
134
135
|
line_items = order.line_items if order
|
135
136
|
user = order.application.user if order && order.application
|
@@ -143,7 +144,7 @@ module BlsmVdCore
|
|
143
144
|
|
144
145
|
#没有对应的结算项
|
145
146
|
if order.clearing_items.empty?
|
146
|
-
if order.state=='等待配货'
|
147
|
+
if order.state=='等待配货' || force
|
147
148
|
data = {}
|
148
149
|
data[:order_id] = order.id
|
149
150
|
data[:order_amount] = order.total_fee
|
metadata
CHANGED
@@ -1,153 +1,153 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blsm-vd-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- saxer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.9'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.9'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: mysql2
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.3.16
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.3.16
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: activemodel
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '3.2'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '3.2'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: activerecord
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '3.2'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '3.2'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: activesupport
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - ~>
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '3.2'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - ~>
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: faraday
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
|
-
- - ~>
|
129
|
+
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
131
|
version: '0.9'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
|
-
- - ~>
|
136
|
+
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.9'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: blsm-mp-wx
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- - ~>
|
143
|
+
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
145
|
version: 0.1.8
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- - ~>
|
150
|
+
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 0.1.8
|
153
153
|
description: 首趣微店核心模块,包含结算项的创建、更新、删除,微店主积分的更改等信息
|
@@ -157,8 +157,8 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
-
- .gitignore
|
161
|
-
- .travis.yml
|
160
|
+
- ".gitignore"
|
161
|
+
- ".travis.yml"
|
162
162
|
- Gemfile
|
163
163
|
- Gemfile.lock
|
164
164
|
- README.md
|
@@ -191,12 +191,12 @@ require_paths:
|
|
191
191
|
- lib
|
192
192
|
required_ruby_version: !ruby/object:Gem::Requirement
|
193
193
|
requirements:
|
194
|
-
- -
|
194
|
+
- - ">="
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - ">="
|
200
200
|
- !ruby/object:Gem::Version
|
201
201
|
version: '0'
|
202
202
|
requirements: []
|