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
ccc024e9
Commit
ccc024e9
authored
Aug 27, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
update:修改文案合并
parents
979aa1ae
2dcdd861
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
44 additions
and
22 deletions
+44
-22
MarketingException.php
application/exception/custom/MarketingException.php
+1
-0
GoodsService.php
application/services/goods/GoodsService.php
+36
-14
DistributorService.php
application/services/marketing/DistributorService.php
+0
-3
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+6
-4
MarketingService.php
application/services/marketing/MarketingService.php
+1
-1
No files found.
application/exception/custom/MarketingException.php
View file @
ccc024e9
...
...
@@ -60,5 +60,6 @@ class MarketingException extends BaseException
self
::
COLONEL_TAKE_PLACE_EXIST
=>
'自提点名称已存在'
,
self
::
COLONEL_TAKE_PLACE_PARAMS
=>
'自提点信息不存在'
,
self
::
COLONEL_TAKE_PLACE_FAILED
=>
'自提点添加失败'
,
33
=>
'分润金额+手续费不能大于售价金额'
,
];
}
application/services/goods/GoodsService.php
View file @
ccc024e9
...
...
@@ -12,6 +12,7 @@ use Api\PhpUtils\Common\BaseConvert;
use
Api\PhpUtils\Common\GoodsSkuId
;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Exception\custom\GoodsException
;
use
App\Exception\custom\MarketingException
;
use
App\Models\goods\mysql\Category
;
use
App\Models\goods\mysql\GoodsOperationRecord
;
use
App\Models\goods\mysql\GoodsSku
;
...
...
@@ -37,6 +38,7 @@ use App\Services\common\CommonService;
use
Api\PhpUtils\Http\Request
;
use
App\Exception\custom\InterfaceException
;
class
GoodsService
{
const
CHARGEFEE
=
0.006
;
...
...
@@ -786,10 +788,8 @@ class GoodsService
"goods_version"
=>
(
int
)
$skuData
[
"goods_version"
]
+
1
,
];
//验证结算价格
if
(
!
empty
(
$params
[
"clear_price"
]))
{
//验证结算价格/分销金额
self
::
checkClearPrice
(
$goodsSkuId
,
$skuParams
);
}
if
(
self
::
isInitGoodsStatus
(
$params
,
$skuData
))
{
$skuParams
[
"audit_status"
]
=
GoodsSku
::
STATUS_AUDIT
;
...
...
@@ -841,6 +841,9 @@ class GoodsService
$clearPrice
=
$skuParams
[
"clear_price"
];
$price
=
$skuParams
[
"price"
];
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
$chargeFee
=
0
;
}
if
(
$clearPrice
>
0
&&
$clearPrice
>
$price
)
{
throw
new
GoodsException
([
'cus'
=>
39
]);
}
...
...
@@ -856,6 +859,7 @@ class GoodsService
if
(
!
empty
(
$marketings
))
{
foreach
(
$marketings
as
$marketing
)
{
if
(
$clearPrice
>
0
)
{
if
(
$marketing
[
"commission_mode"
]
==
Marketing
::
COMMISSION_MODE_RATE
)
{
$commissionTotal
=
(
$marketing
[
"first_commission_value"
]
+
$marketing
[
"second_commission_value"
])
/
10000
*
$price
;
if
((
$price
-
$commissionTotal
-
$chargeFee
)
<
$clearPrice
)
{
...
...
@@ -869,9 +873,27 @@ class GoodsService
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
{
if
(
(
$price
-
$chargeFee
)
<
$clearPrice
)
{
if
(
$clearPrice
>
0
&&
((
$price
-
$chargeFee
)
<
$clearPrice
)
)
{
throw
new
GoodsException
([
'cus'
=>
40
]);
}
}
...
...
application/services/marketing/DistributorService.php
View file @
ccc024e9
...
...
@@ -193,9 +193,6 @@ class DistributorService
}
$jwUserId
=
''
;
// if (empty($distributorCode)) {
// throw new DistributorException(['cus'=>9]);
// }
$info
=
Distributor
::
getRecord
([
'user_id'
=>
$shareUserId
]);
if
(
empty
(
$info
))
{
...
...
application/services/marketing/MarketingGoodsService.php
View file @
ccc024e9
...
...
@@ -52,7 +52,8 @@ class MarketingGoodsService
}
public
static
function
marketingGoodsList
(
$params
)
{
$limit
=
!
empty
(
$params
[
'num'
])
?
$params
[
'num'
]
:
20
;
//@todo 分页放大100倍,主要解决商品到期和商品库存为零的过滤场景
$limit
=
!
empty
(
$params
[
'num'
])
?
$params
[
'num'
]
*
100
:
1000
;
$userId
=
!
empty
(
$params
[
'user_id'
])
?
$params
[
'user_id'
]
:
''
;
...
...
@@ -108,7 +109,7 @@ class MarketingGoodsService
$onlineStatus
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'online_status'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'online_status'
]
:
''
;
if
(
!
empty
(
$inventoryRest
)
&&
$expirationTime
>
date
(
"Y-m-d H:i:s"
)
&&
$onlineStatus
==
1
)
{
if
(
!
empty
(
$inventoryRest
)
&&
$expirationTime
>
date
(
"Y-m-d H:i:s"
)
&&
$onlineStatus
==
1
)
{
$list
[
$i
][
'inventory_rest'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'inventory_rest'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'inventory_rest'
]
:
''
;
$list
[
$i
]
=
$value
;
$list
[
$i
][
'life_account_id'
]
=
!
empty
(
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
])
?
$goodsSkuList
[
$value
[
'goods_sku_id'
]][
'life_account_id'
]
:
''
;
...
...
@@ -165,7 +166,8 @@ class MarketingGoodsService
}
}
$result
=
[
'result'
=>
$list
,
'last_id'
=>
$lastId
];
$hasmore
=
!
empty
(
$list
)
?
1
:
0
;
$result
=
[
'result'
=>
$list
,
'last_id'
=>
$lastId
,
'hasmore'
=>
$hasmore
];
return
$result
;
}
...
...
application/services/marketing/MarketingService.php
View file @
ccc024e9
...
...
@@ -92,7 +92,7 @@ class MarketingService
$where
=
[
'online_status'
=>
1
,
'rule_refund'
=>
2
,
//
'rule_refund' => 2,
"expiration_time[>]"
=>
date
(
"Y-m-d"
),
];
...
...
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