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
a37df770
Commit
a37df770
authored
Jul 01, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:es data list
parent
73e3960c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
4 deletions
+15
-4
GoodsToEs.php
application/modules/Cli/controllers/GoodsToEs.php
+1
-0
ElasticGoodService.php
application/services/goods/ElasticGoodService.php
+12
-4
GoodsService.php
application/services/goods/GoodsService.php
+2
-0
No files found.
application/modules/Cli/controllers/GoodsToEs.php
View file @
a37df770
...
...
@@ -93,6 +93,7 @@ class GoodsToEsController extends Cli
"life_account_icon"
=>
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
],
"shop_name"
=>
empty
(
$subShopList
[
0
][
"shop_name"
])
?
""
:
$subShopList
[
0
][
"shop_name"
],
"shop_location"
=>
$latitude
.
","
.
$longitude
,
"update_time"
=>
strtotime
(
$goodsSkuInfo
[
"update_time"
]),
];
return
ElasticGoodService
::
indexDoc
(
$goodsSkuId
,
$data
);
}
...
...
application/services/goods/ElasticGoodService.php
View file @
a37df770
...
...
@@ -153,7 +153,7 @@ class ElasticGoodService
$result
[
"list"
][
$key
][
"life_account_name"
]
=
$source
[
"_source"
][
"life_account_name"
];
$result
[
"list"
][
$key
][
"life_account_icon"
]
=
$source
[
"_source"
][
"life_account_icon"
];
$result
[
"list"
][
$key
][
"distance"
]
=
empty
(
$source
[
"sort"
][
1
])
?
""
:
round
(
$source
[
"sort"
][
1
],
2
)
.
"km"
;
$result
[
"list"
][
$key
][
"update_time"
]
=
$source
[
"_source"
][
"update_time"
];
}
}
//为避免空数据时候返回给前端错误结构
...
...
@@ -171,14 +171,22 @@ class ElasticGoodService
$sortType
=
empty
(
$params
[
"sort_type"
])
?
self
::
SORT_TYPE_COMPREHENSIVE
:
$params
[
"sort_type"
];
$latitude
=
empty
(
$params
[
"latitude"
])
?
""
:
$params
[
"latitude"
];
$longitude
=
empty
(
$params
[
"longitude"
])
?
""
:
$params
[
"longitude"
];
$subjectName
=
empty
(
$params
[
"subject_name"
])
?
""
:
$params
[
"subject_name"
];
$subjectSort
=
[];
if
(
$subjectName
==
"本周上新"
)
{
$subjectSort
=
[
"update_time"
=>
"desc"
];
}
$sortList
=
[
[
"price_sort"
=>
"asc"
,
"total_amount_sold"
=>
"desc"
],
[],
[
"total_amount_sold"
=>
"desc"
],
[
"price_sort"
=>
"asc"
],
];
$sort
=
array_merge
(
$sortList
[
$sortType
],
$subjectSort
);
$data
=
[
"sort"
=>
$sort
List
[
$sortType
]
,
"sort"
=>
$sort
,
];
if
(
!
empty
(
$latitude
)
&&
!
empty
(
$longitude
))
{
...
...
@@ -203,7 +211,7 @@ class ElasticGoodService
*/
private
static
function
getSearchConditions
(
$params
=
[])
{
$from
=
empty
(
$params
[
"from"
])
?
0
:
(
int
)
$params
[
"from"
];
$from
=
empty
(
$params
[
"from"
])
?
1
:
(
int
)
$params
[
"from"
];
$size
=
empty
(
$params
[
"size"
])
?
10
:
(
int
)
$params
[
"size"
];
$latitude
=
empty
(
$params
[
"latitude"
])
?
""
:
$params
[
"latitude"
];
$longitude
=
empty
(
$params
[
"longitude"
])
?
""
:
$params
[
"longitude"
];
...
...
@@ -211,7 +219,7 @@ class ElasticGoodService
$subjectName
=
empty
(
$params
[
"subject_name"
])
?
""
:
$params
[
"subject_name"
];
$data
=
[
"from"
=>
$from
*
$size
,
"from"
=>
(
$from
-
1
)
*
$size
,
"size"
=>
$size
,
];
...
...
application/services/goods/GoodsService.php
View file @
a37df770
...
...
@@ -953,6 +953,7 @@ class GoodsService
"life_account_icon"
=>
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
],
"shop_name"
=>
empty
(
$subShopList
[
0
][
"shop_name"
])
?
""
:
$subShopList
[
0
][
"shop_name"
],
"shop_location"
=>
$subShop
[
"latitude"
]
.
","
.
$subShop
[
"longitude"
],
"update_time"
=>
strtotime
(
$goodsSkuInfo
[
"update_time"
]),
],
];
$isHaveId
=
ElasticGoodService
::
isHaveById
(
$goodsSkuId
);
...
...
@@ -1001,6 +1002,7 @@ class GoodsService
"category_2_name"
=>
$nameList
[
1
],
"life_account_name"
=>
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_name"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_name"
],
"life_account_icon"
=>
empty
(
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
])
?
""
:
$lifeAccountRes
[
"response"
][
"result"
][
"life_account_icon"
],
"update_time"
=>
time
(),
];
$esRes
=
ElasticGoodService
::
indexDoc
(
$skuParams
[
"goods_sku_id"
],
$data
);
if
(
$esRes
[
"result"
]
==
"created"
&&
$esRes
[
"_shards"
][
"successful"
]
==
1
)
{
...
...
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