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
df468118
Commit
df468118
authored
Jun 26, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://git.yidian-inc.com:8021/bp/goods
into develop
parents
2cfc1e9c
0d55d1b9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
12 deletions
+76
-12
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+1
-3
CommonService.php
application/services/common/CommonService.php
+45
-0
MarketingService.php
application/services/marketing/MarketingService.php
+30
-9
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
df468118
...
...
@@ -43,9 +43,7 @@ class MarketingController extends Base
{
$params
=
$this
->
params
;
$goodsList
=
MarketingService
::
marketingGooodsList
(
$params
);
if
(
!
empty
(
$goodsList
))
{
$this
->
success
(
$goodsList
);
}
$this
->
success
([
'result'
=>
$goodsList
]);
}
...
...
application/services/common/CommonService.php
0 → 100644
View file @
df468118
<?php
namespace
App\Services\common
;
use
App\Models\goods\mysql\GoodsSkuSubShop
;
use
App\Models\shop\mysql\Shop
;
use
App\Models\shop\mysql\SubShop
;
use
Api\PhpUtils\Validate\Validate
;
use
Api\PhpServices\Idgen\Idgen
;
// use Validate\ShopValidate;
use
App\Exception\custom\ShopException
;
use
Api\PhpServices\Sensitive\Sensitive
;
use
App\Exception\custom\InterfaceException
;
use
Api\PhpUtils\Http\Request
;
class
CommonService
{
/**
* 通过生活号id获取生活号信息
* life_account_id = [] 数组形式传递
*
*/
public
static
function
getlifeAccountList
(
$params
)
{
$lifeAccountId
=
!
empty
(
$params
[
'life_account_id'
])
?
$params
[
'life_account_id'
]
:
''
;
$url
=
config
(
'interface'
,
'merchant.lifeaccount.get_life_account_by_ids'
);
if
(
empty
(
$url
))
{
throw
new
InterfaceException
([
'cus'
=>
1
]);
}
if
(
empty
(
$lifeAccountId
))
{
return
[];
}
$params
[
'life_account_ids'
]
=
implode
(
','
,
$lifeAccountId
);
$res
=
(
new
Request
())
->
get
(
$url
,
$params
);
if
(
$res
[
'code'
]
==
0
&&
isset
(
$res
[
'response'
]))
{
return
$res
[
'response'
][
'result'
];
}
return
[];
}
}
\ No newline at end of file
application/services/marketing/MarketingService.php
View file @
df468118
...
...
@@ -10,6 +10,8 @@ use Api\PhpUtils\Validate\Validate;
use
Api\PhpServices\Idgen\Idgen
;
use
App\Exception\custom\MarketingException
;
use
Api\PhpServices\Sensitive\Sensitive
;
use
App\Services\common\CommonService
;
class
MarketingService
{
...
...
@@ -23,19 +25,22 @@ class MarketingService
{
$startTime
=
!
empty
(
$params
[
'start_time'
])
?
$params
[
'start_time'
]
:
''
;
$endTime
=
!
empty
(
$params
[
'end_time'
])
?
$params
[
'end_time'
]
:
''
;
$goodsSkuId
=
!
empty
(
$params
[
'goods_sku_id'
])
?
$params
[
'goods_sku_id'
]
:
''
;
$lifeAccountId
=
!
empty
(
$params
[
'life_account_id'
])
?
$params
[
'life_account_id'
]
:
''
;
$goodsData
=
[
"OR"
=>
[
"start_time[>=]"
=>
$startTime
,
"end_time[>=]"
=>
$startTime
,
],
];
//已存在的活动
$tmpMarketingList
=
Marketing
::
getMarketingList
(
$goodsData
);
if
(
!
empty
(
$tmpMarketingList
))
{
$tmpMarketingId
=
array_column
(
$tmpMarketingList
,
'marketing_id'
);
}
//已加入活动的商品
$marketingGoodsList
=
MarketingGoods
::
marketingGoodsList
([
'marketing_id'
=>
$tmpMarketingId
]);
if
(
!
empty
(
$marketingGoodsList
))
{
$tmpGoodsSkuId
=
array_column
(
$marketingGoodsList
,
'goods_sku_id'
);
}
...
...
@@ -44,16 +49,32 @@ class MarketingService
'online_status'
=>
1
,
];
// $goodsSkuList = GoodsSku::select('*', $where);
//$goodsSkuList =GoodsSku::getRecordMaster($where);
$goodsSkuList
=
GoodsSku
::
getRecord
(
$where
);
print_r
(
$goodsSkuList
);
if
(
!
empty
(
$tmpGoodsSkuId
))
{
$where
[
'goods_sku_id[!=]'
]
=
$tmpGoodsSkuId
;
}
if
(
!
empty
(
$goodsSkuId
))
{
$where
[
'goods_sku_id'
]
=
$goodsSkuId
;
}
if
(
!
empty
(
$lifeAccountId
))
{
$where
[
'life_account_id'
]
=
$lifeAccountId
;
}
$goodsSkuList
=
GoodsSku
::
select
(
'*'
,
$where
);
$lifeAccountIds
=
[];
if
(
!
empty
(
$goodsSkuList
))
{
$lifeAccountIds
=
array_column
(
$goodsSkuList
,
'life_account_id'
);
}
$lifeAccountList
=
CommonService
::
getlifeAccountList
([
'life_account_id'
=>
$lifeAccountIds
]);
$list
=
[];
foreach
(
$goodsSkuList
as
$key
=>
$value
)
{
$list
[
$key
][
'goods_sku_id'
]
=
$value
[
'goods_sku_id'
];
$list
[
$key
][
'life_account_id'
]
=
$value
[
'life_account_id'
];
$list
[
$key
][
'goods_name'
]
=
$value
[
'goods_name'
];
$list
[
$key
][
'life_account_name'
]
=
!
empty
(
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
])
?
$lifeAccountList
[
$value
[
'life_account_id'
]][
'life_account_name'
]
:
''
;
}
return
$list
;
}
/**
...
...
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