Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
shotengai
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
shotengai
Commits
bef95b65
Commit
bef95b65
authored
Sep 13, 2017
by
ivan Lan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix meta & price & origin_pirce in snapshot
parent
f1d44384
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
11 deletions
+11
-11
_merchant_order.json.jbuilder
...ators/templates/views/share/_merchant_order.json.jbuilder
+1
-1
_order.json.jbuilder
lib/generators/templates/views/share/_order.json.jbuilder
+2
-2
series.rb
lib/shotengai/series.rb
+4
-0
snapshot.rb
lib/shotengai/snapshot.rb
+4
-8
No files found.
lib/generators/templates/views/share/_merchant_order.json.jbuilder
View file @
bef95b65
...
...
@@ -4,4 +4,4 @@ json.extract! order, :id, :seq, :address,
:delivery_way, :delivery_cost,
:merchant_remark, :mark, :customer_remark,
:status, :status_zh, :meta
#
json.snapshots order.snapshots, partial: 'shotengai/share/snapshot_simple', as: :snapshot
json.snapshots order.snapshots, partial: 'shotengai/share/snapshot_simple', as: :snapshot
lib/generators/templates/views/share/_order.json.jbuilder
View file @
bef95b65
...
...
@@ -3,4 +3,4 @@ json.extract! order, :id, :seq, :total_price, :total_original_price,
:pay_time, :delivery_time, :receipt_time,
:delivery_way, :delivery_cost, :customer_remark,
:status, :status_zh, :meta
# json.snapshots order.snapshots, partial: 'shotengai/share/snapshot_simple', as: :snapshot
\ No newline at end of file
json.snapshots order.snapshots, partial: 'shotengai/share/snapshot_simple', as: :snapshot
\ No newline at end of file
lib/shotengai/series.rb
View file @
bef95b65
...
...
@@ -68,6 +68,10 @@ module Shotengai
self
.
stock
.
eql?
(
-
1
)
||
self
.
update!
(
stock:
self
.
stock
-
count
)
end
def
original_price
read_attribute
(
:original_price
)
||
price
end
private
# spec 字段
def
check_spec_value
...
...
lib/shotengai/snapshot.rb
View file @
bef95b65
...
...
@@ -74,11 +74,11 @@ module Shotengai
# QUESTION: spec 赋值是在 after pay 合理?
# 支付前 信息 delegate to series
[
:original_price
,
:price
,
:spec
,
:banners
,
:cover_image
,
:detail
].
each
do
|
column
|
define_method
(
column
)
{
read_attribute
(
column
)
||
self
.
series
.
read_attribute
(
column
)
}
define_method
(
column
)
{
read_attribute
(
column
)
||
self
.
series
.
send
(
column
)
}
end
def
meta
read_attribute
(
column
)
||
series
.
product
.
meta
.
merge
(
series
.
meta
)
read_attribute
(
:meta
)
||
(
series
.
product
.
meta
||
{}
).
merge
(
series
.
meta
||
{}
)
end
# 订单支付后 存储当时信息快照
...
...
@@ -91,7 +91,7 @@ module Shotengai
banners:
series
.
banners
,
cover_image:
series
.
cover_image
,
detail:
series
.
detail
,
meta:
series
.
product
.
meta
.
merge
(
series
.
meta
)
meta:
(
series
.
product
.
meta
||
{}
).
merge
(
series
.
meta
||
{}
)
)
end
...
...
@@ -99,13 +99,9 @@ module Shotengai
self
.
series
.
cut_stock
(
self
.
count
)
end
def
meta
read_attribute
(
:meta
)
||
series
.
product
.
meta
.
merge
(
series
.
meta
)
end
###### view
def
total_price
revised_amount
||
count
*
price
revised_amount
||
count
*
self
.
price
end
def
total_original_price
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment