Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
d6f90fc8
Commit
d6f90fc8
authored
Aug 17, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'clear_price_0816' into test
parents
0da7c929
18ea4ea3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
10 deletions
+11
-10
GoodsService.php
application/services/goods/GoodsService.php
+7
-4
MarketingService.php
application/services/marketing/MarketingService.php
+4
-6
No files found.
application/services/goods/GoodsService.php
View file @
d6f90fc8
...
@@ -38,6 +38,7 @@ use App\Exception\custom\InterfaceException;
...
@@ -38,6 +38,7 @@ use App\Exception\custom\InterfaceException;
class
GoodsService
class
GoodsService
{
{
const
CHARGEFEE
=
0.006
;
/**
/**
* 通过发号器拿 id (非雪花)
* 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...
@@ -740,6 +741,7 @@ class GoodsService
...
@@ -740,6 +741,7 @@ class GoodsService
{
{
$clearPrice
=
$skuParams
[
"clear_price"
];
$clearPrice
=
$skuParams
[
"clear_price"
];
$price
=
$skuParams
[
"price"
];
$price
=
$skuParams
[
"price"
];
$chargeFee
=
!
empty
(
$price
)
?
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
throw
new
GoodsException
([
'cus'
=>
39
]);
throw
new
GoodsException
([
'cus'
=>
39
]);
}
}
...
@@ -756,14 +758,15 @@ class GoodsService
...
@@ -756,14 +758,15 @@ class GoodsService
if
(
!
empty
(
$marketings
))
{
if
(
!
empty
(
$marketings
))
{
foreach
(
$marketings
as
$marketing
)
{
foreach
(
$marketings
as
$marketing
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
1000
*
$price
;
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
1000
0
*
$price
;
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
if
(
(
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
if
(
(
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
...
@@ -847,7 +850,7 @@ class GoodsService
...
@@ -847,7 +850,7 @@ class GoodsService
}
}
$data
[
"goods_info"
][
"original_price"
]
=
empty
(
$sku
[
"original_price"
])
?
''
:
(
string
)(
$sku
[
"original_price"
]
/
100
);
$data
[
"goods_info"
][
"original_price"
]
=
empty
(
$sku
[
"original_price"
])
?
''
:
(
string
)(
$sku
[
"original_price"
]
/
100
);
$data
[
"goods_info"
][
"clear_price"
]
=
empty
(
$sku
[
"clear_price"
])
?
0
:
$sku
[
"clear_price"
]
/
100
;
$data
[
"goods_info"
][
"clear_price"
]
=
empty
(
$sku
[
"clear_price"
])
?
""
:
$sku
[
"clear_price"
]
/
100
;
$data
[
"goods_info"
][
"price"
]
=
$sku
[
"price"
]
/
100
;
$data
[
"goods_info"
][
"price"
]
=
$sku
[
"price"
]
/
100
;
$data
[
"goods_info"
][
"inventory"
]
=
$sku
[
"inventory_rest"
];
$data
[
"goods_info"
][
"inventory"
]
=
$sku
[
"inventory_rest"
];
...
...
application/services/marketing/MarketingService.php
View file @
d6f90fc8
...
@@ -482,14 +482,12 @@ class MarketingService
...
@@ -482,14 +482,12 @@ class MarketingService
throw
new
MarketingException
([
'cus'
=>
5
]);
throw
new
MarketingException
([
'cus'
=>
5
]);
}
}
$colums
=
[];
$colums
=
[];
$goodCount
=
!
empty
(
$goodsSkuId
)
?
count
(
$goodsSkuId
)
:
0
;
$goodCount
=
!
empty
(
$goodsSkuId
)
?
count
(
$goodsSkuId
)
:
0
;
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
foreach
(
$goodsSkuList
as
$key
=>
$value
)
{
foreach
(
$goodsSkuList
as
$key
=>
$value
)
{
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
:
0
;
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
:
0
;
$chargeFee
=
!
empty
(
$price
)
?
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费
$chargeFee
=
!
empty
(
$price
)
?
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
!
empty
(
$clearPrice
)
&&
$clearPrice
>
0
)
{
if
(
!
empty
(
$clearPrice
)
&&
$clearPrice
>
0
)
{
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_RATE
)
{
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
)
/
10000
*
$price
;
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
)
/
10000
*
$price
;
...
@@ -499,8 +497,8 @@ class MarketingService
...
@@ -499,8 +497,8 @@ class MarketingService
}
}
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
)
/
100
;
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
);
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
48
]);
throw
new
GoodsException
([
'cus'
=>
48
]);
}
}
}
}
...
...
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