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
36e6eda8
Commit
36e6eda8
authored
Jun 29, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:获取指定商品分销活动的分成比例
parent
3b0a3191
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
9 deletions
+44
-9
Marketing.php
application/models/marketing/mysql/Marketing.php
+4
-0
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+14
-1
GoodsService.php
application/services/goods/GoodsService.php
+0
-3
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+26
-5
No files found.
application/models/marketing/mysql/Marketing.php
View file @
36e6eda8
...
...
@@ -10,6 +10,10 @@ class Marketing extends MysqlBase
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'marketing_id'
;
const
MARKETING_TYPE_FENXIAO
=
1
;
const
MARKETING_TYPE_TUANGOU
=
2
;
const
MARKETING_TYPE_MIAOSHA
=
3
;
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
if
(
empty
(
$colums
))
{
...
...
application/modules/Marketing/controllers/Marketing.php
View file @
36e6eda8
...
...
@@ -3,6 +3,8 @@
use
App\Base\Base
;
use
App\Services\marketing\MarketingService
;
use
App\Exception\custom\MarketingException
;
use
App\Services\marketing\MarketingGoodsService
;
class
MarketingController
extends
Base
{
...
...
@@ -92,6 +94,17 @@ class MarketingController extends Base
$marketingInfo
=
MarketingService
::
marketingInfo
(
$params
);
$this
->
success
([
'result'
=>
$marketingInfo
]);
}
/**
* 获取指定商品分销活动的分成比例(第一分销人的分成比例)
* @throws Exception
*/
public
function
marketing_goods_infoAction
()
{
$params
=
$this
->
params
;
$goodsSkuIds
=
explode
(
","
,
$params
[
"goods_sku_ids"
]);
$marketingInfo
=
MarketingGoodsService
::
getRunningMarketing
(
$goodsSkuIds
);
$this
->
success
([
'result'
=>
$marketingInfo
]);
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
36e6eda8
...
...
@@ -703,9 +703,6 @@ class GoodsService
$subShopList
=
SubShop
::
select
(
"*"
,
[
"sub_shop_id"
=>
$subShopIds
]);
$data
[
"goods_info"
][
"sub_shop"
]
=
$subShopList
;
}
// $marketingGoodsList = MarketingGoodsService::getRunningMarketing([$sku["goods_sku_id"]]);
// var_dump($marketingGoodsList);exit;
}
}
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
...
...
application/services/marketing/MarketingGoodsService.php
View file @
36e6eda8
...
...
@@ -71,14 +71,35 @@ class MarketingGoodsService
return
$result
;
}
/**
* 获取指定商品分销活动的分成比例(第一分销人的分成比例)
* @param $goodsSkuIds
* @return array
*/
public
static
function
getRunningMarketing
(
$goodsSkuIds
)
{
$goodsSkuIds
=
[
"awPYXhAUBJ4HCT6k"
,
"awPZqLl5KtXQZh6k"
];
$marketingIds
=
MarketingGoods
::
select
(
"marketing_id"
,
[
"goods_sku_id"
=>
$goodsSkuIds
]);
if
(
!
empty
(
$marketingIds
))
{
$marketingInfoList
=
MarketingGoods
::
select
([
"marketing_id"
,
"goods_sku_id"
],
[
"goods_sku_id"
=>
$goodsSkuIds
]);
if
(
!
empty
(
$marketingInfoList
))
{
foreach
(
$marketingInfoList
as
$marketingInfo
)
{
$marketingInfoIds
[
$marketingInfo
[
"goods_sku_id"
]]
=
$marketingInfo
[
"marketing_id"
];
}
$marketingIds
=
array_values
(
$marketingInfoIds
);
$now
=
date
(
"Y-m-d H:i:s"
);
$marketingList
=
Marketing
::
select
(
"*"
,
[
"start_time[<]"
=>
$now
,
"end_time[>]"
=>
$now
,
"marketing_id"
=>
$goodsSkuIds
]);
var_dump
(
$marketingList
);
exit
;
$resMarketingList
=
Marketing
::
select
(
"*"
,
[
"start_time[<]"
=>
$now
,
"end_time[>]"
=>
$now
,
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
]);
if
(
!
empty
(
$resMarketingList
))
{
foreach
(
$resMarketingList
as
$res
)
{
$marketingList
[
$res
[
"marketing_id"
]]
=
$res
;
}
}
$data
=
[];
foreach
(
$marketingInfoIds
as
$goodsSkuId
=>
$marketingId
)
{
if
(
!
empty
(
$marketingList
[
$marketingId
][
"second_commission_value"
]))
{
$data
[
$goodsSkuId
]
=
$marketingList
[
$marketingId
][
"second_commission_value"
]
/
100
;
}
}
return
$data
;
}
}
}
...
...
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