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
9337a3ee
Commit
9337a3ee
authored
Oct 09, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ledger20211008' into develop
parents
9b6db038
dc53fb65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
2 deletions
+89
-2
Marketinggoods.php
application/modules/Marketing/controllers/Marketinggoods.php
+14
-0
GoodsService.php
application/services/goods/GoodsService.php
+2
-1
MarketingService.php
application/services/marketing/MarketingService.php
+73
-1
No files found.
application/modules/Marketing/controllers/Marketinggoods.php
View file @
9337a3ee
...
...
@@ -2,6 +2,7 @@
use
App\Base\Base
;
use
App\Services\marketing\MarketingGoodsService
;
use
App\Services\marketing\MarketingService
;
use
App\Exception\custom\DistributorException
;
use
App\Models\goods\mysql\GoodsSku
;
use
Helpers\Aes
;
...
...
@@ -107,6 +108,19 @@ class MarketinggoodsController extends Base
$list
=
MarketingGoodsService
::
getMarketingGoodsList
(
$params
);
$this
->
success
(
$list
);
}
/**
* 获取活动商品列表
* @throws Exception
*/
public
function
get_goods_listAction
()
{
$params
=
$this
->
params
;
$marketingId
=
!
empty
(
$params
[
'marketing_id'
])
?
$params
[
'marketing_id'
]
:
''
;
$list
=
MarketingService
::
getGoodsSkuListByMarketingId
(
$marketingId
);
$data
[
'goods_list'
]
=
$list
;
$this
->
success
(
$data
);
}
...
...
application/services/goods/GoodsService.php
View file @
9337a3ee
...
...
@@ -42,6 +42,7 @@ use App\Exception\custom\InterfaceException;
class
GoodsService
{
const
CHARGEFEE
=
0.006
;
const
CLEARPRICEMAX
=
2000
;
/**
* 通过发号器拿 id (非雪花)
* number,获取店铺shop_id用生活号id后两位,商品相关的这里是shop_id的后两位
...
...
@@ -918,7 +919,7 @@ class GoodsService
*/
private
static
function
checkClearPrice
(
$goodsSkuId
,
$skuParams
)
{
$clearPrice
=
$skuParams
[
"clear_price"
]
;
$clearPrice
=
!
empty
(
$skuParams
[
"clear_price"
])
?
$skuParams
[
"clear_price"
]
+
self
::
CLEARPRICEMAX
:
0
;
$price
=
$skuParams
[
"price"
];
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
...
...
application/services/marketing/MarketingService.php
View file @
9337a3ee
...
...
@@ -33,6 +33,7 @@ class MarketingService
const
ONLINE_LIFE_ACCOUNT_ID
=
"19019625839230981"
;
const
ONLINE_LIFE_ACCOUNT_ID_TEST
=
"17963416161910792"
;
const
CHARGEFEE
=
0.006
;
const
CLEARPRICEMAX
=
2000
;
//
/**
* 写死的自营生活号
* @return string
...
...
@@ -741,7 +742,7 @@ 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"
]
:
0
;
$clearPrice
=
!
empty
(
$value
[
"clear_price"
])
?
$value
[
"clear_price"
]
+
self
::
CLEARPRICEMAX
:
0
;
$price
=
!
empty
(
$value
[
"price"
])
?
$value
[
"price"
]
:
0
;
$chargeFee
=
!
empty
(
$price
)
?
(
float
)
bcmul
(
$price
,
self
::
CHARGEFEE
,
2
)
:
0
;
//手续费 (分)
if
(
$chargeFee
<
1
)
{
...
...
@@ -1389,6 +1390,18 @@ class MarketingService
if
(
!
empty
(
$params
[
'marketing_type'
])){
$where
[
'marketing_type'
]
=
!
empty
(
$params
[
'marketing_type'
])
?
$params
[
'marketing_type'
]
:
''
;
}
$startTime
=
!
empty
(
$params
[
'start_time'
])
?
$params
[
'start_time'
]
:
''
;
$endTime
=
!
empty
(
$params
[
'end_time'
])
?
$params
[
'end_time'
]
:
''
;
if
(
!
empty
(
$startTime
))
{
$where
[
"start_time[>]"
]
=
$startTime
;
}
if
(
!
empty
(
$endTime
))
{
$where
[
"end_time[<]"
]
=
$endTime
;
}
$marketing_list
=
Marketing
::
getMarketingList
(
$where
);
return
$marketing_list
;
}
...
...
@@ -1457,6 +1470,65 @@ class MarketingService
return
$list
;
}
/**
* 通过活动id获取商品列表
* @param $marketingId
* @return array
*/
public
static
function
getGoodsSkuListByMarketingId
(
$marketingId
=
''
)
{
if
(
empty
(
$marketingId
)){
throw
new
MarketingException
([
'cus'
=>
6
]);
}
$marketingInfo
=
Marketing
::
getRecord
([
'marketing_id'
=>
$marketingId
]);
if
(
empty
(
$marketingInfo
)){
return
[];
}
$marketingType
=
!
empty
(
$marketingInfo
[
'marketing_type'
])
?
$marketingInfo
[
'marketing_type'
]
:
Marketing
::
MARKETING_TYPE_FENXIAO
;
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_FENXIAO
)
{
return
self
::
getFenxiaoMarketingList
(
$marketingId
);
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_TUANGOU
)
{
return
[];
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_MIAOSHA
)
{
return
[];
}
else
if
(
$marketingType
==
Marketing
::
MARKETING_TYPE_PINDAN
)
{
return
self
::
getPindanMarketingList
(
$marketingId
);
}
}
/**
* 通过活动id获取优惠券商品列表
* @param $marketingId
* @return array
*/
public
static
function
getFenxiaoMarketingList
(
$marketingId
)
{
$marketingGoodsList
=
MarketingGoods
::
marketingGoodsList
([
'marketing_id'
=>
$marketingId
]);
$goodsSkuList
=
[];
if
(
!
empty
(
$marketingGoodsList
))
{
$goodsSkuId
=
array_column
(
$marketingGoodsList
,
'goods_sku_id'
);
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
}
return
$goodsSkuList
;
}
/**
* 通过活动id获取拼单商品列表
* @param $marketingId
* @return array
*/
public
static
function
getPindanMarketingList
(
$marketingId
)
{
$marketingGoodsList
=
MarketingGoods
::
marketingGoodsList
([
'marketing_id'
=>
$marketingId
]);
$goodsSkuList
=
[];
if
(
!
empty
(
$marketingGoodsList
))
{
$goodsSkuId
=
array_column
(
$marketingGoodsList
,
'goods_sku_id'
);
$goodsSkuList
=
PindanGoodsSku
::
select
(
'*'
,
[
'goods_sku_id'
=>
$goodsSkuId
]);
}
return
$goodsSkuList
;
}
/**
* 获取活动支付用户列表
* @param $params
...
...
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