Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
5e1d66cf
Commit
5e1d66cf
authored
Feb 26, 2021
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化币种搜索条件
parent
1ad2d8a6
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
11 additions
and
17 deletions
+11
-17
CoinController.php
api/controllers/CoinController.php
+2
-8
WalletCoinController.php
api/controllers/WalletCoinController.php
+4
-4
CoinController.php
backend/controllers/CoinController.php
+3
-3
Coin.php
common/models/psources/Coin.php
+1
-1
CoinRelationController.php
wallet/controllers/CoinRelationController.php
+1
-1
No files found.
api/controllers/CoinController.php
View file @
5e1d66cf
...
@@ -301,7 +301,7 @@ class CoinController extends BaseController
...
@@ -301,7 +301,7 @@ class CoinController extends BaseController
$query
=
Coin
::
find
()
$query
=
Coin
::
find
()
->
select
(
'id, sid, icon, name, optional_name, nickname, platform, chain, address as contract_address, treaty'
)
->
select
(
'id, sid, icon, name, optional_name, nickname, platform, chain, address as contract_address, treaty'
)
->
where
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
)
->
where
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
->
orderBy
(
'id'
);
->
orderBy
(
'id'
);
if
(
false
!=
$chain
)
{
if
(
false
!=
$chain
)
{
...
@@ -355,13 +355,7 @@ class CoinController extends BaseController
...
@@ -355,13 +355,7 @@ class CoinController extends BaseController
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
$condition
[]
=
[
'or'
,
[
'address'
=>
$name
],
[
'or'
,
[
'like'
,
'name'
,
$name
],
[
'like'
,
'nickname'
,
$name
]]];
}
}
if
(
$platform_ids
)
{
if
(
$platform_ids
)
{
/* $platform_id_arr = explode(',', $platform_ids);
$condition
[]
=
(
"JSON_CONTAINS(platform_id,'
$platform_ids
')"
);
$condition_arr = ['OR'];
foreach ($platform_id_arr as $key => $value) {
array_push($condition_arr, ['=', 'platform_id', $value]);
}
$condition[] = $condition_arr;*/
$condition
[]
=
[
'>'
,
"find_in_set(
$platform_ids
, platform_id)"
,
0
];
}
}
$result
=
ExchangeBusiness
::
SearchByName
(
$page
,
$limit
,
$condition
);
$result
=
ExchangeBusiness
::
SearchByName
(
$page
,
$limit
,
$condition
);
...
...
api/controllers/WalletCoinController.php
View file @
5e1d66cf
...
@@ -51,7 +51,7 @@ class WalletCoinController extends BaseController
...
@@ -51,7 +51,7 @@ class WalletCoinController extends BaseController
if
(
is_array
(
$val
))
{
if
(
is_array
(
$val
))
{
$model
=
WalletCoin
::
find
()
->
select
(
'id,icon,name,nickname,optional_name,introduce,platform,chain,address as contract_address,treaty'
)
$model
=
WalletCoin
::
find
()
->
select
(
'id,icon,name,nickname,optional_name,introduce,platform,chain,address as contract_address,treaty'
)
->
where
([
'name'
=>
$val
[
0
],
'platform'
=>
$val
[
1
]])
->
where
([
'name'
=>
$val
[
0
],
'platform'
=>
$val
[
1
]])
->
andWhere
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
)
->
andWhere
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
->
asArray
()
->
asArray
()
->
one
();
->
one
();
}
}
...
@@ -59,7 +59,7 @@ class WalletCoinController extends BaseController
...
@@ -59,7 +59,7 @@ class WalletCoinController extends BaseController
if
(
is_string
(
$val
))
{
if
(
is_string
(
$val
))
{
$model
=
WalletCoin
::
find
()
->
select
(
'id,icon,name,nickname,optional_name,introduce,platform,chain,address as contract_address,treaty'
)
$model
=
WalletCoin
::
find
()
->
select
(
'id,icon,name,nickname,optional_name,introduce,platform,chain,address as contract_address,treaty'
)
->
where
([
'name'
=>
$val
])
->
where
([
'name'
=>
$val
])
->
andWhere
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
)
->
andWhere
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
->
asArray
()
->
asArray
()
->
one
();
->
one
();
}
}
...
@@ -134,7 +134,7 @@ class WalletCoinController extends BaseController
...
@@ -134,7 +134,7 @@ class WalletCoinController extends BaseController
$query
=
WalletCoin
::
find
()
$query
=
WalletCoin
::
find
()
->
select
(
'id, icon, name, nickname, platform, chain, address as contract_address, treaty'
)
->
select
(
'id, icon, name, nickname, platform, chain, address as contract_address, treaty'
)
->
where
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
)
->
where
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
->
orderBy
(
'id'
);
->
orderBy
(
'id'
);
if
(
false
!=
$chain
)
{
if
(
false
!=
$chain
)
{
...
@@ -186,7 +186,7 @@ class WalletCoinController extends BaseController
...
@@ -186,7 +186,7 @@ class WalletCoinController extends BaseController
}
}
$this
->
data
=
WalletCoin
::
find
()
$this
->
data
=
WalletCoin
::
find
()
->
where
([
'id'
=>
$id
])
->
where
([
'id'
=>
$id
])
->
andWhere
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
)
->
andWhere
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
->
one
();
->
one
();
if
(
empty
(
$this
->
data
))
{
if
(
empty
(
$this
->
data
))
{
goto
doEnd
;
goto
doEnd
;
...
...
backend/controllers/CoinController.php
View file @
5e1d66cf
...
@@ -53,7 +53,7 @@ class CoinController extends BaseController
...
@@ -53,7 +53,7 @@ class CoinController extends BaseController
}
}
if
(
Yii
::
$app
->
user
->
id
!=
Yii
::
$app
->
params
[
'admin'
])
{
if
(
Yii
::
$app
->
user
->
id
!=
Yii
::
$app
->
params
[
'admin'
])
{
$platform_id
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$platform_id
=
Yii
::
$app
->
user
->
identity
->
platform_id
;
$condition
[]
=
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
;
$condition
[]
=
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
;
}
}
if
(
!
empty
(
$recommend
))
{
if
(
!
empty
(
$recommend
))
{
//使用连表查询推荐币种
//使用连表查询推荐币种
...
@@ -156,7 +156,7 @@ class CoinController extends BaseController
...
@@ -156,7 +156,7 @@ class CoinController extends BaseController
$can
=
false
;
$can
=
false
;
if
(
Yii
::
$app
->
params
[
'admin'
]
!=
Yii
::
$app
->
user
->
id
)
{
if
(
Yii
::
$app
->
params
[
'admin'
]
!=
Yii
::
$app
->
user
->
id
)
{
$coin
=
Coin
::
find
()
->
where
([
'id'
=>
$req
->
post
(
'id'
)])
->
andWhere
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
])
->
createCommand
()
->
getRawSql
(
);
$coin
=
Coin
::
find
()
->
where
([
'id'
=>
$req
->
post
(
'id'
)])
->
andWhere
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
);
if
(
$coin
)
{
if
(
$coin
)
{
$can
=
true
;
$can
=
true
;
}
}
...
@@ -325,7 +325,7 @@ class CoinController extends BaseController
...
@@ -325,7 +325,7 @@ class CoinController extends BaseController
}
}
if
(
$platform_id
)
{
if
(
$platform_id
)
{
$condition
[]
=
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
;
$condition
[]
=
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
)
;
}
}
$data
=
Coin
::
getSelectList
(
$page
,
$limit
,
[
'id'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
],
$condition
);
$data
=
Coin
::
getSelectList
(
$page
,
$limit
,
[
'id'
,
'name'
,
'nickname'
,
'platform'
,
'chain'
],
$condition
);
...
...
common/models/psources/Coin.php
View file @
5e1d66cf
...
@@ -170,7 +170,7 @@ class Coin extends BaseActiveRecord
...
@@ -170,7 +170,7 @@ class Coin extends BaseActiveRecord
if
(
!
ctype_alnum
(
$id
))
{
if
(
!
ctype_alnum
(
$id
))
{
return
false
;
return
false
;
}
}
$query
=
self
::
find
()
->
andWhere
(
[
'>'
,
"find_in_set(
$id
, platform_id)"
,
0
]
);
$query
=
self
::
find
()
->
andWhere
(
"JSON_CONTAINS(platform_id,'
$id
')"
);
$count
=
$query
->
count
();
$count
=
$query
->
count
();
if
(
$count
)
{
if
(
$count
)
{
$data
=
$query
->
limit
(
$limit
)
->
offset
((
$page
-
1
)
*
$limit
)
->
asArray
()
->
all
();
$data
=
$query
->
limit
(
$limit
)
->
offset
((
$page
-
1
)
*
$limit
)
->
asArray
()
->
all
();
...
...
wallet/controllers/CoinRelationController.php
View file @
5e1d66cf
...
@@ -19,7 +19,7 @@ class CoinRelationController extends BaseController
...
@@ -19,7 +19,7 @@ class CoinRelationController extends BaseController
$platform_id
=
\Yii
::
$app
->
request
->
get
(
'platform_id'
,
''
);
$platform_id
=
\Yii
::
$app
->
request
->
get
(
'platform_id'
,
''
);
$query
=
WalletCoin
::
find
()
$query
=
WalletCoin
::
find
()
->
select
(
'id, name, nickname, icon, introduce, official, paper, platform, chain, release, area_search, publish_count, circulate_count, decimals, address, treaty, platform_id'
)
->
select
(
'id, name, nickname, icon, introduce, official, paper, platform, chain, release, area_search, publish_count, circulate_count, decimals, address, treaty, platform_id'
)
->
where
(
[
'>'
,
"find_in_set(
$platform_id
, platform_id)"
,
0
]
);
->
where
(
"JSON_CONTAINS(platform_id,'
$platform_id
')"
);
if
(
false
!=
$name
)
{
if
(
false
!=
$name
)
{
$query
->
andWhere
([
'name'
=>
$name
]);
$query
->
andWhere
([
'name'
=>
$name
]);
}
}
...
...
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