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
c24d4e1c
Commit
c24d4e1c
authored
Sep 17, 2021
by
suntengda
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pindan_activity_list_optimize' into develop
parents
a88625ee
e68ce8cc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
11 deletions
+30
-11
Marketing.php
application/modules/Marketing/controllers/Marketing.php
+1
-0
MarketingService.php
application/services/marketing/MarketingService.php
+29
-11
No files found.
application/modules/Marketing/controllers/Marketing.php
View file @
c24d4e1c
...
...
@@ -183,6 +183,7 @@ class MarketingController extends Base
}
/**
* 正在进行和未开始的拼单活动列表
* @throws \App\Exception\custom\InterfaceException
*/
public
function
pindan_active_and_ready_listAction
()
...
...
application/services/marketing/MarketingService.php
View file @
c24d4e1c
...
...
@@ -5,7 +5,6 @@ namespace App\Services\marketing;
use
Api\PhpServices\Ksy\Ks3Api
;
use
Api\PhpUtils\Http\Request
;
use
Api\PhpUtils\Http\HttpUtil
;
use
App\Exception\BaseException
;
use
App\Exception\custom\InterfaceException
;
...
...
@@ -472,18 +471,19 @@ class MarketingService
}
/**
* 获取已结束的
* 获取已结束的
拼单活动列表
* @param int $page
* @param int $pageSize
* @param bool $useCache
* @return array|mixed
*/
public
static
function
getPindanEndList
(
$page
=
1
,
$pageSize
=
10
,
$useCache
=
true
){
try
{
$redis
=
RedisUtil
::
getInstance
(
'cache'
,[
'serializer'
=>
'none'
]);
$key
=
"tuancan_end_list_"
.
$page
.
'_'
.
$pageSize
.
'_'
.
date
(
'Ymd'
);
// $list['end']
= $useCache ? $redis->get($key) : [];
$list
=
$useCache
?
$redis
->
get
(
$key
)
:
[];
if
(
empty
(
$list
[
'end'
]
))
{
if
(
empty
(
$list
))
{
//已结束的 按结束时间倒序
$params
[
'page'
]
=
$page
;
$params
[
'page_size'
]
=
$pageSize
;
...
...
@@ -494,21 +494,21 @@ class MarketingService
$params
[
'need_buy_num'
]
=
false
;
$params
[
'online_status'
]
=
[
Marketing
::
ONLINE_STATUS_QIDONG
,
Marketing
::
ONLINE_STATUS_GUANBI
,
Marketing
::
ONLINE_STATUS_DAOQI
];
//状态 , 1启用,2关闭,3 到期
$params
[
'activity_status'
]
=
MarketingPindan
::
ACTIVITY_STATUS_FINISHED
;
//1 未开始,2进行中,3已结束, 4当日上新(即将开始)
$list
[
'end'
]
=
MarketingService
::
marketingList
(
$params
)[
'result'
];
$list
[
'end'
]
=
$list
[
'end'
]
?
array_column
(
$list
[
'end'
]
,
null
,
'marketing_id'
)
:
[];
$list
=
MarketingService
::
marketingList
(
$params
)[
'result'
];
$list
=
$list
?
array_column
(
$list
,
null
,
'marketing_id'
)
:
[];
$marketingIdsEnd
=
array_keys
(
$list
[
'end'
]
);
$list
=
self
::
_fillSkuAndOrderInfo
(
$marketingIdsEnd
,
$list
);
$marketingIdsEnd
=
array_keys
(
$list
);
$list
=
self
::
_fillSkuAndOrderInfo
(
$marketingIdsEnd
,
[
'end'
=>
$list
]
);
$redis
->
set
(
$key
,
json_encode
(
$list
[
'end'
]
),[
'ex'
=>
86400
]);
//已结束列表 缓存一天
$redis
->
set
(
$key
,
json_encode
(
$list
),[
'ex'
=>
86400
]);
//已结束列表 缓存一天
}
else
{
$list
[
'end'
]
=
json_decode
(
$list
[
'end'
]
,
true
);
$list
=
json_decode
(
$list
,
true
);
}
}
catch
(
\Exception
$e
)
{
FileLog
::
error
(
"获取团餐已结束列表异常"
,
$e
->
getMessage
(),
$e
,
'suntengda@yidian-inc.com'
);
}
return
$list
[
'end'
]
??
[];
return
$list
??
[];
}
/**
...
...
@@ -1129,6 +1129,24 @@ class MarketingService
Marketing
::
updateRecord
(
$marketingParams
,
[
"marketing_id"
=>
$marketingId
,
"marketing_type"
=>
$marketingType
]);
}
/**
* 切换活动状态
* @param $marketingId
* @param $onlineStatus
* @return \Api\PhpUtils\Mysql\MysqlBase
*/
public
static
function
toogleOnlineStatus
(
$marketingId
,
$onlineStatus
)
{
if
(
!
in_array
(
$onlineStatus
,
array_keys
(
Marketing
::
$onlineStatusDesc
)))
{
return
0
;
}
$data
=
[
'online_status'
=>
$onlineStatus
,
];
return
Marketing
::
updateRecord
(
$data
,
[
"marketing_id"
=>
$marketingId
]);
}
/**
* 分销活动详情
* @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