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
76f57275
Commit
76f57275
authored
Mar 17, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/optimize' into develop
parents
58c9eac6
1124f57f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
11 deletions
+25
-11
RecommendCoinController.php
api/controllers/RecommendCoinController.php
+21
-3
SupportedChainController.php
api/controllers/SupportedChainController.php
+0
-5
CoinSupportedChain.php
common/models/psources/CoinSupportedChain.php
+2
-2
WalletRecommendCoin.php
common/models/psources/WalletRecommendCoin.php
+2
-1
No files found.
api/controllers/RecommendCoinController.php
View file @
76f57275
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
namespace
api\controllers
;
namespace
api\controllers
;
use
common\business\ExchangeBusiness
;
use
common\business\ExchangeBusiness
;
use
common\models\psources\CoinSupportedChain
;
use
Yii
;
use
Yii
;
use
api\base\BaseController
;
use
api\base\BaseController
;
use
common\models\psources\WalletRecommendCoin
;
use
common\models\psources\WalletRecommendCoin
;
...
@@ -39,7 +40,6 @@ class RecommendCoinController extends BaseController
...
@@ -39,7 +40,6 @@ class RecommendCoinController extends BaseController
$temp
[
'platform'
]
=
$coin
->
coin
[
'platform'
];
$temp
[
'platform'
]
=
$coin
->
coin
[
'platform'
];
$temp
[
'chain'
]
=
$coin
->
coin
[
'chain'
];
$temp
[
'chain'
]
=
$coin
->
coin
[
'chain'
];
$temp
[
'treaty'
]
=
$coin
->
coin
[
'treaty'
];
$temp
[
'treaty'
]
=
$coin
->
coin
[
'treaty'
];
$temp
[
'exchange_id'
]
=
$coin
->
coin
[
'exchange_id'
];
$nickname
=
json_decode
(
$coin
->
coin
[
'nickname'
],
true
);
$nickname
=
json_decode
(
$coin
->
coin
[
'nickname'
],
true
);
$temp
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$temp
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$introduce
=
json_decode
(
$coin
->
coin
[
'introduce'
],
true
);
$introduce
=
json_decode
(
$coin
->
coin
[
'introduce'
],
true
);
...
@@ -92,6 +92,7 @@ class RecommendCoinController extends BaseController
...
@@ -92,6 +92,7 @@ class RecommendCoinController extends BaseController
$category
[
'name'
]
=
isset
(
$name
[
$this
->
lang
])
?
$name
[
$this
->
lang
]
:
''
;
$category
[
'name'
]
=
isset
(
$name
[
$this
->
lang
])
?
$name
[
$this
->
lang
]
:
''
;
$recommend_coin
=
WalletRecommendCoin
::
find
()
->
where
([
'category_id'
=>
$category
[
'id'
]])
->
all
();
$recommend_coin
=
WalletRecommendCoin
::
find
()
->
where
([
'category_id'
=>
$category
[
'id'
]])
->
all
();
unset
(
$category
[
'id'
]);
$items
=
[];
$items
=
[];
foreach
(
$recommend_coin
as
$coin
)
{
foreach
(
$recommend_coin
as
$coin
)
{
$temp
[
'icon'
]
=
$coin
->
coin
[
'icon'
];
$temp
[
'icon'
]
=
$coin
->
coin
[
'icon'
];
...
@@ -99,7 +100,6 @@ class RecommendCoinController extends BaseController
...
@@ -99,7 +100,6 @@ class RecommendCoinController extends BaseController
$temp
[
'platform'
]
=
$coin
->
coin
[
'platform'
];
$temp
[
'platform'
]
=
$coin
->
coin
[
'platform'
];
$temp
[
'chain'
]
=
$coin
->
coin
[
'chain'
];
$temp
[
'chain'
]
=
$coin
->
coin
[
'chain'
];
$temp
[
'treaty'
]
=
$coin
->
coin
[
'treaty'
];
$temp
[
'treaty'
]
=
$coin
->
coin
[
'treaty'
];
$temp
[
'exchange_id'
]
=
$coin
->
coin
[
'exchange_id'
];
$nickname
=
json_decode
(
$coin
->
coin
[
'nickname'
],
true
);
$nickname
=
json_decode
(
$coin
->
coin
[
'nickname'
],
true
);
$temp
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$temp
[
'nickname'
]
=
isset
(
$nickname
[
$this
->
lang
])
?
$nickname
[
$this
->
lang
]
:
''
;
$introduce
=
json_decode
(
$coin
->
coin
[
'introduce'
],
true
);
$introduce
=
json_decode
(
$coin
->
coin
[
'introduce'
],
true
);
...
@@ -108,8 +108,26 @@ class RecommendCoinController extends BaseController
...
@@ -108,8 +108,26 @@ class RecommendCoinController extends BaseController
}
}
$category
[
'items'
]
=
$items
;
$category
[
'items'
]
=
$items
;
}
}
$this
->
data
=
$recommend_category
;
$this
->
data
=
$recommend_category
;
$supported_chain_model
=
CoinSupportedChain
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
all
();
$data
=
[];
if
(
false
!=
$supported_chain_model
)
{
foreach
(
$supported_chain_model
as
$key
=>
&
$val
)
{
$data
[
$key
][
'icon'
]
=
isset
(
$val
->
coin
->
icon
)
?
$val
->
coin
->
icon
:
''
;
$data
[
$key
][
'name'
]
=
isset
(
$val
->
coin
->
name
)
?
$val
->
coin
->
name
:
''
;
$data
[
$key
][
'platform'
]
=
isset
(
$val
->
coin
->
platform
)
?
$val
->
coin
->
platform
:
''
;
$data
[
$key
][
'chain'
]
=
isset
(
$val
->
coin
->
chain
)
?
$val
->
coin
->
chain
:
''
;
$data
[
$key
][
'treaty'
]
=
isset
(
$val
->
coin
->
treaty
)
?
$val
->
coin
->
treaty
:
''
;
$data
[
$key
][
'nickname'
]
=
isset
(
$val
->
coin
->
nickname
[
$this
->
lang
])
?
$val
->
coin
->
nickname
[
$this
->
lang
]
:
''
;
$data
[
$key
][
'introduce'
]
=
isset
(
$val
->
coin
->
introduce
[
$this
->
lang
])
?
$val
->
coin
->
introduce
[
$this
->
lang
]
:
''
;
}
$supported_chain
=
[
'name'
=>
'主链'
,
'items'
=>
$data
];
array_unshift
(
$this
->
data
,
$supported_chain
);
}
doEnd
:
doEnd
:
return
[
'code'
=>
$this
->
code
,
'data'
=>
$this
->
data
,
'msg'
=>
$this
->
msg
];
return
[
'code'
=>
$this
->
code
,
'data'
=>
$this
->
data
,
'msg'
=>
$this
->
msg
];
}
}
...
...
api/controllers/SupportedChainController.php
View file @
76f57275
...
@@ -33,15 +33,10 @@ class SupportedChainController extends BaseController
...
@@ -33,15 +33,10 @@ class SupportedChainController extends BaseController
$data
[
$key
][
'name'
]
=
isset
(
$val
->
coin
->
name
)
?
$val
->
coin
->
name
:
''
;
$data
[
$key
][
'name'
]
=
isset
(
$val
->
coin
->
name
)
?
$val
->
coin
->
name
:
''
;
$data
[
$key
][
'icon'
]
=
isset
(
$val
->
coin
->
icon
)
?
$val
->
coin
->
icon
:
''
;
$data
[
$key
][
'icon'
]
=
isset
(
$val
->
coin
->
icon
)
?
$val
->
coin
->
icon
:
''
;
$data
[
$key
][
'name'
]
=
isset
(
$val
->
coin
->
name
)
?
$val
->
coin
->
name
:
''
;
$data
[
$key
][
'name'
]
=
isset
(
$val
->
coin
->
name
)
?
$val
->
coin
->
name
:
''
;
$data
[
$key
][
'sid'
]
=
isset
(
$val
->
coin
->
sid
)
?
$val
->
coin
->
sid
:
''
;
$data
[
$key
][
'nickname'
]
=
isset
(
$val
->
coin
->
nickname
[
$this
->
lang
])
?
$val
->
coin
->
nickname
[
$this
->
lang
]
:
''
;
$data
[
$key
][
'nickname'
]
=
isset
(
$val
->
coin
->
nickname
[
$this
->
lang
])
?
$val
->
coin
->
nickname
[
$this
->
lang
]
:
''
;
$data
[
$key
][
'chain'
]
=
isset
(
$val
->
coin
->
chain
)
?
$val
->
coin
->
chain
:
''
;
$data
[
$key
][
'chain'
]
=
isset
(
$val
->
coin
->
chain
)
?
$val
->
coin
->
chain
:
''
;
$data
[
$key
][
'platform'
]
=
isset
(
$val
->
coin
->
platform
)
?
$val
->
coin
->
platform
:
''
;
$data
[
$key
][
'platform'
]
=
isset
(
$val
->
coin
->
platform
)
?
$val
->
coin
->
platform
:
''
;
$data
[
$key
][
'sort'
]
=
isset
(
$val
->
coin
->
sort
)
?
$val
->
coin
->
sort
:
0
;
$data
[
$key
][
'treaty'
]
=
isset
(
$val
->
coin
->
treaty
)
?
$val
->
coin
->
treaty
:
''
;
$data
[
$key
][
'treaty'
]
=
isset
(
$val
->
coin
->
treaty
)
?
$val
->
coin
->
treaty
:
''
;
$data
[
$key
][
'optional_name'
]
=
isset
(
$val
->
coin
->
optional_name
)
?
$val
->
coin
->
optional_name
:
''
;
$data
[
$key
][
'rmb'
]
=
0
;
$data
[
$key
][
'rmb'
]
=
0
;
$data
[
$key
][
'usd'
]
=
0
;
$data
[
$key
][
'usd'
]
=
0
;
...
...
common/models/psources/CoinSupportedChain.php
View file @
76f57275
...
@@ -46,7 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord
...
@@ -46,7 +46,7 @@ class CoinSupportedChain extends BaseActiveRecord
public
function
getCoin
()
public
function
getCoin
()
{
{
return
$this
->
hasOne
(
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
return
$this
->
hasOne
(
Wallet
Coin
::
className
(),
[
'id'
=>
'coin_id'
])
->
select
(
'id,
sid, icon, name, introduce, optional_nam
e, nickname, platform, chain, treaty'
);
->
select
(
'id,
icon, name, introduc
e, nickname, platform, chain, treaty'
);
}
}
}
}
common/models/psources/WalletRecommendCoin.php
View file @
76f57275
...
@@ -19,6 +19,6 @@ class WalletRecommendCoin extends BaseActiveRecord
...
@@ -19,6 +19,6 @@ class WalletRecommendCoin extends BaseActiveRecord
public
function
getCoin
()
public
function
getCoin
()
{
{
return
$this
->
hasOne
(
WalletCoin
::
className
(),
[
'id'
=>
'cid'
])
->
select
([
'id'
,
'icon'
,
'name'
,
'introduce'
,
'nickname'
,
'platform'
,
'chain'
,
'treaty'
,
'exchange_id'
])
->
asArray
();
return
$this
->
hasOne
(
WalletCoin
::
className
(),
[
'id'
=>
'cid'
])
->
select
([
'id'
,
'icon'
,
'name'
,
'introduce'
,
'nickname'
,
'platform'
,
'chain'
,
'treaty'
])
->
asArray
();
}
}
}
}
\ 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