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
17e973e3
Commit
17e973e3
authored
Aug 26, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'marketing_20210824' into test
parents
f247dc8f
57c2512d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
14 deletions
+33
-14
GoodsService.php
application/services/goods/GoodsService.php
+33
-14
No files found.
application/services/goods/GoodsService.php
View file @
17e973e3
...
@@ -12,6 +12,7 @@ use Api\PhpUtils\Common\BaseConvert;
...
@@ -12,6 +12,7 @@ use Api\PhpUtils\Common\BaseConvert;
use
Api\PhpUtils\Common\GoodsSkuId
;
use
Api\PhpUtils\Common\GoodsSkuId
;
use
Api\PhpUtils\Http\HttpUtil
;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Exception\custom\GoodsException
;
use
App\Exception\custom\GoodsException
;
use
App\Exception\custom\MarketingException
;
use
App\Models\goods\mysql\Category
;
use
App\Models\goods\mysql\Category
;
use
App\Models\goods\mysql\GoodsOperationRecord
;
use
App\Models\goods\mysql\GoodsOperationRecord
;
use
App\Models\goods\mysql\GoodsSku
;
use
App\Models\goods\mysql\GoodsSku
;
...
@@ -37,6 +38,7 @@ use App\Services\common\CommonService;
...
@@ -37,6 +38,7 @@ use App\Services\common\CommonService;
use
Api\PhpUtils\Http\Request
;
use
Api\PhpUtils\Http\Request
;
use
App\Exception\custom\InterfaceException
;
use
App\Exception\custom\InterfaceException
;
class
GoodsService
class
GoodsService
{
{
const
CHARGEFEE
=
0.006
;
const
CHARGEFEE
=
0.006
;
...
@@ -781,10 +783,8 @@ class GoodsService
...
@@ -781,10 +783,8 @@ class GoodsService
"goods_version"
=>
(
int
)
$skuData
[
"goods_version"
]
+
1
,
"goods_version"
=>
(
int
)
$skuData
[
"goods_version"
]
+
1
,
];
];
//验证结算价格
//验证结算价格/分销金额
if
(
!
empty
(
$params
[
"clear_price"
]))
{
self
::
checkClearPrice
(
$goodsSkuId
,
$skuParams
);
self
::
checkClearPrice
(
$goodsSkuId
,
$skuParams
);
}
if
(
self
::
isInitGoodsStatus
(
$params
,
$skuData
))
{
if
(
self
::
isInitGoodsStatus
(
$params
,
$skuData
))
{
$skuParams
[
"audit_status"
]
=
GoodsSku
::
STATUS_AUDIT
;
$skuParams
[
"audit_status"
]
=
GoodsSku
::
STATUS_AUDIT
;
...
@@ -851,22 +851,41 @@ class GoodsService
...
@@ -851,22 +851,41 @@ 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
(
$clearPrice
>
0
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
10000
*
$price
;
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
10000
*
$price
;
throw
new
GoodsException
([
'cus'
=>
40
]);
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
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
-
$chargeFee
)
<
$clearPrice
)
{
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
else
{
//比例计算
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
10000
*
$price
;
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
23
]);
}
}
//固定金额
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
if
(
$price
<
(
$commissionTotal
+
$chargeFee
))
{
throw
new
MarketingException
([
'cus'
=>
23
]);
}
}
}
}
}
}
}
}
else
{
}
else
{
if
(
(
$price
-
$chargeFee
)
<
$clearPrice
)
{
if
(
$clearPrice
>
0
&&
((
$price
-
$chargeFee
)
<
$clearPrice
)
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
...
...
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