Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
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
chenchuanwen
my-yaf-project
Commits
a7c9ccb3
Commit
a7c9ccb3
authored
Aug 23, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pc
parent
520df153
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
5 deletions
+45
-5
Search.php
application/controllers/Search.php
+6
-0
ApiConst.php
application/library/Our/ApiConst.php
+2
-1
SearchService.php
application/models/Business/Search/SearchService.php
+9
-0
ElasticsTool.php
application/models/Elastics/ElasticsTool.php
+10
-4
search.php
public/test/Search/search.php
+18
-0
No files found.
application/controllers/Search.php
View file @
a7c9ccb3
...
...
@@ -25,6 +25,12 @@ class SearchController extends \Our\Controller_AbstractIndex {
$res
=
$serchService
->
insertRows
();
$this
->
success
(
$res
);
}
public
function
searchAction
()
{
$serchService
=
\Business\Search\SearchServiceModel
::
getInstance
();
$res
=
$serchService
->
searchRows
();
$this
->
success
(
$res
);
}
...
...
application/library/Our/ApiConst.php
View file @
a7c9ccb3
...
...
@@ -11,7 +11,8 @@ class ApiConst
const
randLengh
=
8
;
//10天数秒
const
tenDaySecond
=
864000
;
// const tenDaySecond = 864000;
const
tenDaySecond
=
300
;
//一天
const
oneDaySecond
=
86400
;
//半天
...
...
application/models/Business/Search/SearchService.php
View file @
a7c9ccb3
...
...
@@ -54,6 +54,15 @@ class SearchServiceModel extends \Business\AbstractModel
return
$res
;
}
public
function
searchRows
(){
$elasticsToolElasticssearch
=
\Elastics\ElasticsToolModel
::
getInstance
(
'orders'
);
$query
=
array
(
'goodsName'
=>
'希拉里和韩国'
,
);
$res
=
$elasticsToolElasticssearch
->
searchMatch
(
$query
);
return
$res
;
}
/**
* 类实例
...
...
application/models/Elastics/ElasticsTool.php
View file @
a7c9ccb3
...
...
@@ -158,15 +158,21 @@ class ElasticsToolModel
{
$searchParams
[
'index'
]
=
$this
->
dbName
;
$searchParams
[
'type'
]
=
$this
->
tbName
;
$from
=
(
$pageIndex
-
ApiConst
::
one
)
*
$pageSize
;
$from
=
(
$pageIndex
)
*
$pageSize
;
$searchParams
[
'from'
]
=
$from
;
$searchParams
[
'size'
]
=
$pageSize
;
$searchParams
[
'sort'
]
=
$sort
;
$searchParams
[
'
quer
y'
]
=
array
(
'
match'
=>
$where
$searchParams
[
'
bod
y'
]
=
array
(
'
query'
=>
array
(
'match'
=>
$where
),
);
$retDoc
=
$this
->
client
->
search
(
$searchParams
);
return
$retDoc
;
if
(
!
isset
(
$retDoc
[
'hits'
])){
ErrorModel
::
throwException
(
CodeConfigModel
::
elasticsError
);
}
$htis
=
$retDoc
[
'hits'
][
'hits'
];
$returnData
[
'list'
]
=
array_column
(
$htis
,
'_source'
);
$returnData
[
'total'
]
=
$retDoc
[
'hits'
][
'total'
];
return
$returnData
;
}
public
function
getDocById
(
$id
)
...
...
public/test/Search/search.php
0 → 100644
View file @
a7c9ccb3
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<title>
简单的html5 File测试 for pic2base64
</title>
<style>
</style>
</head>
<body>
<form
action=
"/search/search"
method=
"post"
>
用户登录状态key:
<input
name=
"data[key]"
value=
"52da049f7e2fbf0e10da32dfe909850e"
/><br
/>
<p
id=
"img_area"
></p>
<input
type=
"submit"
value=
"提交"
>
</form>
</body>
</html>
\ 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