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
fad56839
Commit
fad56839
authored
Jun 29, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.yidian-inc.com/bp/goods
into develop
parents
b1468517
38408be3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
70 additions
and
11 deletions
+70
-11
MarketingGoodsRateValidate.php
application/library/Validate/MarketingGoodsRateValidate.php
+21
-0
Marketing.php
application/models/marketing/mysql/Marketing.php
+4
-0
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+17
-1
GoodsService.php
application/services/goods/GoodsService.php
+2
-5
MarketingGoodsService.php
application/services/marketing/MarketingGoodsService.php
+26
-5
No files found.
application/library/Validate/MarketingGoodsRateValidate.php
0 → 100644
View file @
fad56839
<?php
namespace
Validate
;
/**
* Class MarketingGoodsRateValidate
*
* @package Validate
*/
class
MarketingGoodsRateValidate
extends
BaseValidate
{
protected
$rule
=
[
'goods_sku_ids'
=>
'require'
,
];
protected
$message
=
[
"goods_sku_ids"
=>
"商品id不能为空"
,
];
}
\ No newline at end of file
application/models/marketing/mysql/Marketing.php
View file @
fad56839
...
@@ -10,6 +10,10 @@ class Marketing extends MysqlBase
...
@@ -10,6 +10,10 @@ class Marketing extends MysqlBase
const
CONFIG_INDEX
=
'marketing'
;
const
CONFIG_INDEX
=
'marketing'
;
const
PRIMARY_KEY
=
'marketing_id'
;
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
=
[])
public
static
function
getRecord
(
$where
,
$colums
=
[])
{
{
if
(
empty
(
$colums
))
{
if
(
empty
(
$colums
))
{
...
...
application/modules/Marketing/controllers/Marketing.php
View file @
fad56839
...
@@ -3,6 +3,9 @@
...
@@ -3,6 +3,9 @@
use
App\Base\Base
;
use
App\Base\Base
;
use
App\Services\marketing\MarketingService
;
use
App\Services\marketing\MarketingService
;
use
App\Exception\custom\MarketingException
;
use
App\Exception\custom\MarketingException
;
use
App\Services\marketing\MarketingGoodsService
;
use
\Validate\MarketingGoodsRateValidate
;
class
MarketingController
extends
Base
class
MarketingController
extends
Base
{
{
...
@@ -92,6 +95,19 @@ class MarketingController extends Base
...
@@ -92,6 +95,19 @@ class MarketingController extends Base
$marketingInfo
=
MarketingService
::
marketingInfo
(
$params
);
$marketingInfo
=
MarketingService
::
marketingInfo
(
$params
);
$this
->
success
([
'result'
=>
$marketingInfo
]);
$this
->
success
([
'result'
=>
$marketingInfo
]);
}
}
/**
* 获取指定商品分销活动的分成比例(第一分销人的分成比例)
* @throws Exception
*/
public
function
marketing_goods_rateAction
()
{
(
new
MarketingGoodsRateValidate
())
->
validate
();
$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 @
fad56839
...
@@ -201,8 +201,8 @@ class GoodsService
...
@@ -201,8 +201,8 @@ class GoodsService
"rule_limit"
=>
$skuData
[
"rule_limit"
],
"rule_limit"
=>
$skuData
[
"rule_limit"
],
"rule_desc"
=>
$skuData
[
"rule_desc"
],
"rule_desc"
=>
$skuData
[
"rule_desc"
],
"rule_refund"
=>
$skuData
[
"rule_refund"
],
"rule_refund"
=>
$skuData
[
"rule_refund"
],
"rule_start_time"
=>
$skuData
[
"rule_start_time"
],
"rule_start_time"
=>
empty
(
$skuData
[
"rule_start_time"
])
?
""
:
$skuData
[
"rule_start_time"
],
"rule_end_time"
=>
$skuData
[
"rule_end_time"
],
"rule_end_time"
=>
empty
(
$skuData
[
"rule_end_time"
])
?
""
:
$skuData
[
"rule_end_time"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"original_price"
=>
$skuData
[
"original_price"
]
*
100
,
"original_price"
=>
$skuData
[
"original_price"
]
*
100
,
...
@@ -703,9 +703,6 @@ class GoodsService
...
@@ -703,9 +703,6 @@ class GoodsService
$subShopList
=
SubShop
::
select
(
"*"
,
[
"sub_shop_id"
=>
$subShopIds
]);
$subShopList
=
SubShop
::
select
(
"*"
,
[
"sub_shop_id"
=>
$subShopIds
]);
$data
[
"goods_info"
][
"sub_shop"
]
=
$subShopList
;
$data
[
"goods_info"
][
"sub_shop"
]
=
$subShopList
;
}
}
// $marketingGoodsList = MarketingGoodsService::getRunningMarketing([$sku["goods_sku_id"]]);
// var_dump($marketingGoodsList);exit;
}
}
}
}
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
$recordList
=
GoodsOperationRecord
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
...
...
application/services/marketing/MarketingGoodsService.php
View file @
fad56839
...
@@ -71,14 +71,35 @@ class MarketingGoodsService
...
@@ -71,14 +71,35 @@ class MarketingGoodsService
return
$result
;
return
$result
;
}
}
/**
* 获取指定商品分销活动的分成比例(第一分销人的分成比例)
* @param $goodsSkuIds
* @return array
*/
public
static
function
getRunningMarketing
(
$goodsSkuIds
)
public
static
function
getRunningMarketing
(
$goodsSkuIds
)
{
{
$goodsSkuIds
=
[
"awPYXhAUBJ4HCT6k"
,
"awPZqLl5KtXQZh6k"
];
$marketingInfoList
=
MarketingGoods
::
select
([
"marketing_id"
,
"goods_sku_id"
],
[
"goods_sku_id"
=>
$goodsSkuIds
]);
$marketingIds
=
MarketingGoods
::
select
(
"marketing_id"
,
[
"goods_sku_id"
=>
$goodsSkuIds
]);
if
(
!
empty
(
$marketingInfoList
))
{
if
(
!
empty
(
$marketingIds
))
{
foreach
(
$marketingInfoList
as
$marketingInfo
)
{
$marketingInfoIds
[
$marketingInfo
[
"goods_sku_id"
]]
=
$marketingInfo
[
"marketing_id"
];
}
$marketingIds
=
array_values
(
$marketingInfoIds
);
$now
=
date
(
"Y-m-d H:i:s"
);
$now
=
date
(
"Y-m-d H:i:s"
);
$marketingList
=
Marketing
::
select
(
"*"
,
[
"start_time[<]"
=>
$now
,
"end_time[>]"
=>
$now
,
"marketing_id"
=>
$goodsSkuIds
]);
$resMarketingList
=
Marketing
::
select
(
"*"
,
[
"start_time[<]"
=>
$now
,
"end_time[>]"
=>
$now
,
"marketing_id"
=>
$marketingIds
,
"marketing_type"
=>
Marketing
::
MARKETING_TYPE_FENXIAO
]);
var_dump
(
$marketingList
);
exit
;
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