Commit 2f0a033c authored by luhongguang's avatar luhongguang

update: 自提点列表

parent 40ab9604
......@@ -22,10 +22,11 @@ class TakePlaceService
*/
public static function searchList($params)
{
$lifeAccountId = $params['life_account_id'] ?? 0;
$lifeAccountId = MarketingService::getPublicLifeAccountId();
$keywords = $params['keywords'] ?? '';
$takePlaceIds = $params['take_place_id'] ?? [];
$tagIds = $params['tag_ids'] ?? [];
$businessCircleIds = $params['business_circle_ids'] ?? [];
$offset = $params['offset'] ?? 0;
$limit = $params['limit'] ?? 20;
......@@ -35,6 +36,12 @@ class TakePlaceService
if ($lifeAccountId) {
$where['life_account_id'] = $lifeAccountId;
}
if ($tagIds) {
$where['tag_id'] = $tagIds;
}
if ($businessCircleIds) {
$where['business_circle_id'] = $businessCircleIds;
}
if ($keywords) {
$where['OR'] = [
'take_place_name[~]' => $keywords,
......@@ -45,7 +52,17 @@ class TakePlaceService
$where['ORDER'] = ['take_place_id' => 'DESC'];
$where['LIMIT'] = [$offset, $limit];
$res['list'] = TakePlace::select('*', $where, []);
$list = TakePlace::select('*', $where, []);
$tagIds = array_unique(array_column($list, "tag_id"));
$businessCircleIds = array_unique(array_column($list, "business_circle_id"));
list ($tagArr, $businessCircleArr) = self::getTagAndBusinessCircle($tagIds, $businessCircleIds);
$data = [];
foreach ($list as $key => $item) {
$data[$key] = $item;
$data[$key]["tag_name"] = empty($tagArr[$item["tag_id"]]) ? "" : $tagArr[$item["tag_id"]]["tag_name"];
$data[$key]["business_circle_name"] = empty($businessCircleArr[$item["business_circle_id"]]) ? "" : $businessCircleArr[$item["business_circle_id"]]["business_circle_name"];
}
$res['list'] = $data;
unset($where['ORDER'], $where['LIMIT']);
$res['total'] = TakePlace::count('*', $where);
......@@ -60,7 +77,7 @@ class TakePlaceService
*/
public static function detail($takePlaceId)
{
$takePlace = TakePlace::get('*', ['take_place_id' => $takePlaceId]);
$takePlace = TakePlace::get('*', ['take_place_id' => $takePlaceId], []);
$takePlace["tag_name"] = "";
if (!empty($takePlace["tag_id"])) {
$tag = TagService::tagDetail(["tag_id" => $takePlace["tag_id"]]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment