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
bc6bbecc
Commit
bc6bbecc
authored
Aug 21, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pc
parent
585fc2c4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
903 additions
and
1 deletion
+903
-1
Search.php
application/controllers/Search.php
+18
-0
NameConst.php
application/library/Our/NameConst.php
+2
-0
RefundService.php
application/models/Business/Order/RefundService.php
+2
-0
SearchService.php
application/models/Business/Search/SearchService.php
+790
-0
ElasticsTool.php
application/models/Elasticsearch/ElasticsTool.php
+91
-1
No files found.
application/controllers/Search.php
0 → 100644
View file @
bc6bbecc
<?php
class
ShareController
extends
\Our\Controller_AbstractIndex
{
public
$memberId
;
public
function
createIndexAction
()
{
$shareService
=
\Business\User\ShareServiceModel
::
getInstance
();
$saveData
=
$shareService
->
getSaveData
(
$this
->
req
[
'data'
]);
$shareService
->
saveDataToSession
(
$saveData
);
$res
=
$shareService
->
excuteCommand
(
$this
->
key
);
$this
->
success
(
$res
);
}
}
application/library/Our/NameConst.php
View file @
bc6bbecc
...
...
@@ -151,6 +151,8 @@ class NameConst {
const
leftBracket
=
'['
;
const
rightBracket
=
']'
;
const
elasticName
=
'elastic.master'
;
const
searchDbName
=
'qmcs'
;
}
?>
\ No newline at end of file
application/models/Business/Order/RefundService.php
View file @
bc6bbecc
...
...
@@ -392,6 +392,8 @@ class RefundServiceModel extends \Business\AbstractModel
$refundArrayUnLine
=
Common
::
convertUnderline
(
$refundArray
);
$state
=
$refundReturnDao
->
addRefundReturn
(
$refundArray
,
$orderInfo
,
$orderGoods
);
if
(
$state
)
{
$orderDao
->
deleteOrderCache
(
$memberId
,
$refund
[
'orderId'
]);
$refundReturnDao
->
deleteRefundCache
(
$memberId
);
$refundStateName
=
$refundReturnDao
->
getRefundTextStatus
(
$refundArrayUnLine
);
$orderGoodsDao
->
update
(
array
(
'rec_id'
=>
$orderGoods
[
'recId'
]),
array
(
'refund_state_name'
=>
$refundStateName
,
'refund_id'
=>
$state
));
$orderLogDao
->
addRefundOrderLog
(
$orderInfo
[
'orderId'
],
$refundArray
[
'refund_type'
],
DescribeConst
::
buyer
,
$orderInfo
[
'buyerName'
],
$orderInfo
[
'orderState'
]);
...
...
application/models/Business/Search/SearchService.php
0 → 100644
View file @
bc6bbecc
This diff is collapsed.
Click to expand it.
application/models/Elasticsearch/ElasticsTool.php
View file @
bc6bbecc
<?php
namespace
DAO
;
namespace
Elasticsearch
;
use
Elasticsearch\ClientBuilder
;
use
Error\CodeConfigModel
;
use
Error\ErrorModel
;
...
...
@@ -50,9 +50,99 @@ class ElasticsTool{
'index'
=>
$this
->
dbName
,
];
$r
=
$this
->
client
->
indices
()
->
create
(
$indexParams
);
return
$r
;
}
catch
(
\Exception
$e
){
ErrorModel
::
throwException
(
CodeConfigModel
::
elasticsError
);
}
}
// public function create_index()
// {
// $indexParams['index'] = 'my_index';
// $indexParams['type'] = 'my_index';
// $indexParams['body']['settings']['number_of_shards'] = 2;
// $indexParams['body']['settings']['number_of_replicas'] = 0;
// $this->client->create($indexParams);
// }
public
function
add_document
()
{
$params
=
array
();
$params
[
'body'
]
=
array
(
'testField'
=>
'dfdsfdsf'
);
$params
[
'index'
]
=
'my_index'
;
$params
[
'type'
]
=
'my_index'
;
$params
[
'id'
]
=
'w1231313'
;
$ret
=
$this
->
client
->
index
(
$params
);
}
public
function
delete_index
()
{
$deleteParams
[
'index'
]
=
'my_index'
;
$this
->
client
->
indices
()
->
delete
(
$deleteParams
);
}
public
function
deleteDocumentById
(
$docId
)
{
$deleteParams
=
array
();
$deleteParams
[
'index'
]
=
$this
->
dbName
;
$deleteParams
[
'type'
]
=
$this
->
tbName
;
$deleteParams
[
'id'
]
=
$docId
;
$retDelete
=
$this
->
client
->
delete
(
$deleteParams
);
return
$retDelete
;
}
public
function
update_document
()
{
$updateParams
=
array
();
$updateParams
[
'index'
]
=
'my_index'
;
$updateParams
[
'type'
]
=
'my_index'
;
$updateParams
[
'id'
]
=
'my_id'
;
$updateParams
[
'body'
][
'doc'
][
'asas'
]
=
'111111'
;
$response
=
$this
->
client
->
update
(
$updateParams
);
}
public
function
search
()
{
$searchParams
[
'index'
]
=
'my_index'
;
$searchParams
[
'type'
]
=
'my_index'
;
$searchParams
[
'from'
]
=
0
;
$searchParams
[
'size'
]
=
100
;
$searchParams
[
'sort'
]
=
array
(
'_score'
=>
array
(
'order'
=>
'desc'
)
);
// $searchParams['body']['query']['match']['testField'] = 'abc';
$retDoc
=
$this
->
client
->
search
(
$searchParams
);
print_r
(
$retDoc
);
}
public
function
get_document
()
{
$getParams
=
array
();
$getParams
[
'index'
]
=
'my_index'
;
$getParams
[
'type'
]
=
'my_index'
;
$getParams
[
'id'
]
=
'AU4Kn-knWOmOrmyOj2qg'
;
$retDoc
=
$this
->
client
->
get
(
$getParams
);
print_r
(
$retDoc
);
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 单例模式获取类实例
*
*/
public
static
function
getInstance
(
$type
,
$index
=
NameConst
::
searchDbName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$index
,
$type
);
}
return
self
::
$_instance
;
}
}
\ 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