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
5028ed5f
Commit
5028ed5f
authored
Aug 19, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
update: 处理冲突
parents
e2c94e70
8da35fb1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
33 deletions
+43
-33
GoodsException.php
application/exception/custom/GoodsException.php
+2
-0
GoodsService.php
application/services/goods/GoodsService.php
+13
-4
MarketingPindanGoodsService.php
application/services/goods/MarketingPindanGoodsService.php
+7
-2
MarketingService.php
application/services/marketing/MarketingService.php
+21
-27
No files found.
application/exception/custom/GoodsException.php
View file @
5028ed5f
...
...
@@ -64,5 +64,7 @@ class GoodsException extends BaseException
45
=>
'还没有try,就去执行confirm'
,
46
=>
'已经执行过cancel'
,
47
=>
'sku rollback error'
,
48
=>
'请满足以下条件后提交,售价-分销总金额-手续费>=结算价'
,
49
=>
'库存不得小于已售库存'
,
];
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
5028ed5f
...
...
@@ -39,6 +39,7 @@ use App\Exception\custom\InterfaceException;
class
GoodsService
{
const
CHARGEFEE
=
0.006
;
/**
* 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...
...
@@ -606,6 +607,8 @@ class GoodsService
*/
private
static
function
editGoodsSpu
(
$goodsSpu
,
$params
=
[])
{
$checkName
=
self
::
checkGoodsName
(
$params
[
"goods_name"
],
$goodsSpu
[
"life_account_id"
],
$goodsSpu
[
"goods_spu_id"
]);
if
(
!
$checkName
[
"can_use"
])
{
throw
new
GoodsException
([
'cus'
=>
17
]);
...
...
@@ -741,6 +744,7 @@ class GoodsService
{
$clearPrice
=
$skuParams
[
"clear_price"
];
$price
=
$skuParams
[
"price"
];
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
throw
new
GoodsException
([
'cus'
=>
39
]);
}
...
...
@@ -757,18 +761,23 @@ class GoodsService
if
(
!
empty
(
$marketings
))
{
foreach
(
$marketings
as
$marketing
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
1000
*
$price
;
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
1000
0
*
$price
;
if
(
(
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
]);
if
(
$price
-
$commissionTotal
<
$clearPrice
)
{
if
(
(
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
else
{
if
((
$price
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
}
}
...
...
@@ -848,7 +857,7 @@ class GoodsService
}
$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"
][
"inventory"
]
=
$sku
[
"inventory_rest"
];
...
...
application/services/goods/MarketingPindanGoodsService.php
View file @
5028ed5f
...
...
@@ -285,7 +285,12 @@ class MarketingPindanGoodsService
private
static
function
editGoodsSku
(
$goodsSkuId
,
$skuData
,
$params
=
[])
{
$inventoryCount
=
$skuData
[
"inventory_rest"
]
+
$params
[
"inventory_add"
];
//$inventoryCount = $params["inventory"];
$inventoryTotal
=
$skuData
[
"inventory_total"
]
+
$params
[
"inventory_add"
];
if
(
$inventoryTotal
<
$skuData
[
"inventory_lock"
]
+
$skuData
[
"total_amount_order"
])
{
throw
new
GoodsException
([
'cus'
=>
49
]);
}
if
(
$inventoryCount
<
0
)
{
throw
new
GoodsException
([
'cus'
=>
18
]);
}
...
...
@@ -312,7 +317,7 @@ class MarketingPindanGoodsService
"desc_pic_url"
=>
$params
[
"desc_pic_url"
],
"desc"
=>
$params
[
"desc"
],
"rule_limit"
=>
empty
(
$params
[
"rule_limit"
])
?
0
:
$params
[
"rule_limit"
],
"inventory_total"
=>
$
skuData
[
"inventory_total"
]
+
$params
[
"inventory_add"
]
,
"inventory_total"
=>
$
inventoryTotal
,
"ota_id"
=>
empty
(
$params
[
"ota_id"
])
?
0
:
$params
[
"ota_id"
],
"inventory_rest"
=>
$inventoryCount
,
"original_price"
=>
empty
(
$params
[
"original_price"
])
?
""
:
$params
[
"original_price"
]
*
100
,
...
...
application/services/marketing/MarketingService.php
View file @
5028ed5f
...
...
@@ -26,23 +26,13 @@ class MarketingService
{
const
ONLINE_LIFE_ACCOUNT_ID
=
"19019625839230981"
;
const
ONLINE_LIFE_ACCOUNT_ID_TEST
=
"17963416161910792"
;
const
CHARGEFEE
=
0.006
;
/**
* 写死的自营生活号
* @return string
*/
public
static
function
getPublicLifeAccountId
()
{
/**
$env = \Yaf\Application::app()->environ();
if (in_array($env, ['dev'])) {
$lifeAccountId = "13076446786650120";
} elseif (in_array($env, ['test'])) {
$lifeAccountId = "15559498695737346";
}else {
// $lifeAccountId = self::ONLINE_LIFE_ACCOUNT_ID;
$lifeAccountId = self::ONLINE_LIFE_ACCOUNT_ID_TEST;//测试用
}
*/
$lifeAccountId
=
config
(
'lifeaccount'
,
'life_account_id'
);
return
$lifeAccountId
;
}
...
...
@@ -363,6 +353,7 @@ class MarketingService
private
static
function
addFenxiaoMarketing
(
$params
)
{
$commissionMode
=
!
empty
(
$params
[
'commission_mode'
])
?
$params
[
'commission_mode'
]
:
1
;
$marketingName
=
!
empty
(
$params
[
'marketing_name'
])
?
$params
[
'marketing_name'
]
:
''
;
$firstCommissionRate
=
!
empty
(
$params
[
'first_commission_value'
])
?
$params
[
'first_commission_value'
]
*
100
:
0
;
...
...
@@ -379,7 +370,7 @@ class MarketingService
throw
new
MarketingException
([
'cus'
=>
15
]);
}
}
if
(
empty
(
$goodsSkuId
))
{
throw
new
MarketingException
([
'cus'
=>
12
]);
}
...
...
@@ -496,21 +487,24 @@ class MarketingService
$goodCount
=
!
empty
(
$goodsSkuId
)
?
count
(
$goodsSkuId
)
:
0
;
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
foreach
(
$goodsSkuList
as
$key
=>
$value
)
{
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
*
100
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
*
100
:
0
;
// if ($commissionMode == Marketing::COMMISSION_MODE_RATE) {
// $commissionTotal = ($firstCommissionRate + $secondCommissionRate) / 1000 * $price;
// if ($price - $commissionTotal < $clearPrice) {
// throw new GoodsException(['cus' => 36]);
// }
// }
//
// if ($commissionMode == Marketing::COMMISSION_MODE_FIXED) {
// $commissionTotal = ($firstCommissionRate + $secondCommissionRate);
// if ($price - $commissionTotal < $clearPrice) {
// throw new GoodsException(['cus' => 36]);
// }
// }
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
:
0
;
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
!
empty
(
$clearPrice
)
&&
$clearPrice
>
0
)
{
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
)
/
10000
*
$price
;
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
48
]);
}
}
if
(
$commissionMode
==
Marketing
::
COMMISSION_MODE_FIXED
)
{
$commissionTotal
=
(
$firstCommissionRate
+
$secondCommissionRate
);
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
throw
new
GoodsException
([
'cus'
=>
48
]);
}
}
}
$colums
[
$key
][
'marketing_id'
]
=
$marketingId
;
$colums
[
$key
][
'goods_spu_id'
]
=
$value
[
'goods_spu_id'
];
...
...
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