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
ba10f198
Commit
ba10f198
authored
Oct 29, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
探索后端接口
parent
4959b00e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
85 additions
and
0 deletions
+85
-0
ExploreController.php
wallet/controllers/ExploreController.php
+85
-0
No files found.
wallet/controllers/ExploreController.php
0 → 100644
View file @
ba10f198
<?php
namespace
wallet\controllers
;
use
common\models\psources\CoinPlatformWithHold
;
use
common\models\psources\ExploreApp
;
use
common\models\psources\ExploreAppCategory
;
use
common\service\chain33\Chain33Service
;
use
Yii
;
use
wallet\base\BaseController
;
use
yii\data\Pagination
;
class
ExploreController
extends
BaseController
{
/**
* landing
* @return array
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public
function
actionIndex
()
{
$msg
=
'ok'
;
$code
=
0
;
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$query
=
ExploreAppCategory
::
find
()
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
();
$app_category_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
foreach
(
$app_category_model
as
&
$val
)
{
$name
=
json_decode
(
$val
[
'name'
],
true
);
$val
[
'name'
]
=
$name
[
'zh-CN'
];
unset
(
$val
[
'platform_id'
]);
}
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$app_category_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
public
function
actionCategory
()
{
$msg
=
'ok'
;
$code
=
0
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();;
$category_id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
if
(
false
==
$platform_id
||
false
==
$category_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$query
=
ExploreApp
::
find
()
->
select
(
'id, name, icon, sort, status, created_at'
)
->
where
([
'app_category_id'
=>
$category_id
])
->
andWhere
([
'platform_id'
=>
$platform_id
])
->
asArray
();
$app_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
foreach
(
$app_model
as
&
$val
)
{
$name
=
json_decode
(
$val
[
'name'
],
true
);
$val
[
'name'
]
=
$name
[
'zh-CN'
];
}
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$app_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ 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