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
6927c7c9
Commit
6927c7c9
authored
Aug 09, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:商品后台需要的接口
parent
92d4d265
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
0 deletions
+98
-0
Marketingfororder.php
...ation/modules/Marketing/controllers/Marketingfororder.php
+33
-0
MarketingForOrderService.php
application/services/marketing/MarketingForOrderService.php
+65
-0
No files found.
application/modules/Marketing/controllers/Marketingfororder.php
0 → 100644
View file @
6927c7c9
<?php
use
App\Base\Base
;
use
\App\Services\marketing\MarketingForOrderService
;
class
MarketingfororderController
extends
Base
{
/**
* 分销活动列表
* @throws Exception
*/
public
function
marketing_listAction
()
{
$params
=
$this
->
params
;
$data
=
MarketingForOrderService
::
getMarketingList
(
$params
);
$this
->
success
([
"result"
=>
$data
]);
}
public
function
goods_listAction
()
{
$params
=
$this
->
params
;
$data
=
MarketingForOrderService
::
getMarketingGoodsList
(
$params
);
$this
->
success
([
"result"
=>
$data
]);
}
public
function
take_place_listAction
()
{
$params
=
$this
->
params
;
$data
=
MarketingForOrderService
::
getMarketingTakePlaceList
(
$params
);
$this
->
success
([
"result"
=>
$data
]);
}
}
\ No newline at end of file
application/services/marketing/MarketingForOrderService.php
0 → 100644
View file @
6927c7c9
<?php
namespace
App\Services\marketing
;
use
App\Exception\custom\MarketingException
;
use
App\Models\goods\mysql\GoodsSku
;
use
App\Models\marketing\mysql\Marketing
;
use
App\Models\marketing\mysql\MarketingGoods
;
use
App\Models\marketing\mysql\MarketingTakePlace
;
use
App\Models\marketing\mysql\TakePlace
;
class
MarketingForOrderService
{
/**
* 活动列表
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
getMarketingList
(
$params
)
{
$where
[
'marketing_type'
]
=
!
empty
(
$params
[
'marketing_type'
])
?
$params
[
'marketing_type'
]
:
Marketing
::
MARKETING_TYPE_FENXIAO
;
return
Marketing
::
select
([
"marketing_id"
,
"marketing_name"
,
"create_time"
],
[
"marketing_type"
=>
$where
[
'marketing_type'
]]);
}
/**
* 活动的商品
* @param $params
* @return \Api\PhpUtils\Mysql\MysqlBase|array
* @throws MarketingException
*/
public
static
function
getMarketingGoodsList
(
$params
)
{
if
(
empty
(
$params
[
"marketing_id"
]))
{
throw
new
MarketingException
([
'cus'
=>
6
]);
}
$goodsSkuIdList
=
MarketingGoods
::
select
([
"goods_sku_id"
],
[
"marketing_id"
=>
$params
[
"marketing_id"
]]);
$goodsSkuList
=
[];
if
(
!
empty
(
$goodsSkuIdList
))
{
$goodsSkuIdArr
=
array_column
(
$goodsSkuIdList
,
"goods_sku_id"
);
$goodsSkuList
=
GoodsSku
::
select
([
"goods_sku_id"
,
"goods_name"
,
"create_time"
],
[
"goods_sku_id"
=>
$goodsSkuIdArr
]);
}
return
$goodsSkuList
;
}
/**
* 活动的自提点
* @param $params
* @throws MarketingException
*/
public
static
function
getMarketingTakePlaceList
(
$params
)
{
if
(
empty
(
$params
[
"marketing_id"
]))
{
throw
new
MarketingException
([
'cus'
=>
6
]);
}
$takePlaceIdList
=
MarketingTakePlace
::
select
([
"take_place_id"
],
[
"marketing_id"
=>
$params
[
"marketing_id"
]]);
$takePlaceList
=
[];
if
(
!
empty
(
$takePlaceIdList
))
{
$takePlaceIdArr
=
array_column
(
$takePlaceIdList
,
"take_place_id"
);
$takePlaceList
=
TakePlace
::
select
([
"take_place_id"
,
"take_place_name"
,
"create_time"
],
[
"take_place_id"
=>
$takePlaceIdArr
]);
}
return
$takePlaceList
;
}
}
\ No newline at end of file
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