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
93423ebe
Commit
93423ebe
authored
Oct 31, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fi
parent
aee81d07
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
106 additions
and
60 deletions
+106
-60
ApplicationCategoryController.php
backend/controllers/ApplicationCategoryController.php
+1
-0
ExploreAppCategory.php
common/models/psources/ExploreAppCategory.php
+10
-1
ExploreAppController.php
wallet/controllers/ExploreAppController.php
+51
-59
ExploreBannerController.php
wallet/controllers/ExploreBannerController.php
+44
-0
No files found.
backend/controllers/ApplicationCategoryController.php
View file @
93423ebe
...
...
@@ -105,6 +105,7 @@ class ApplicationCategoryController extends BaseController
unset
(
$params
[
'name'
]);
$params
[
'name'
]
=
$name
;
echo
json_encode
(
$params
);
exit
;
$model
->
load
(
$params
,
''
);
$result
=
$model
->
add
();
if
(
0
===
$result
[
'code'
])
{
...
...
common/models/psources/ExploreAppCategory.php
View file @
93423ebe
...
...
@@ -35,7 +35,6 @@ class ExploreAppCategory extends BaseActiveRecord
return
array_merge
(
parent
::
attributes
(),
[
'apps'
]);
}
public
function
scenarios
()
{
$scenarios
=
[
...
...
@@ -44,6 +43,16 @@ class ExploreAppCategory extends BaseActiveRecord
return
array_merge
(
parent
::
scenarios
(),
$scenarios
);
}
public
function
attributeLabels
()
{
return
[
'name'
=>
'应用分类名称'
,
'sort'
=>
'应用分类排序'
,
'limit'
=>
'该分类下首页可显示的应用数量'
,
'style'
=>
'应用分类展示样式'
];
}
public
function
getApplications
()
{
return
$this
->
hasMany
(
ExploreApp
::
className
(),
[
'app_category_id'
=>
'id'
])
->
select
([
'name'
,
'icon'
,
'app_url'
,
'slogan'
]);
...
...
wallet/controllers/ExploreController.php
→
wallet/controllers/Explore
App
Controller.php
View file @
93423ebe
...
...
@@ -6,45 +6,70 @@ use Yii;
use
yii\data\Pagination
;
use
wallet\base\BaseController
;
use
common\models\psources\ExploreApp
;
use
common\models\psources\CoinBannerItem
;
use
common\models\psources\ExploreAppCategory
;
class
ExploreController
extends
BaseController
class
Explore
App
Controller
extends
BaseController
{
/**
* landing
* @return array
* @throws \yii\base\Exception
* @throws \yii\base\InvalidConfigException
*/
public
function
actionIndex
()
public
function
actionCategory
()
{
$msg
=
'ok'
;
$code
=
0
;
$data
=
null
;
$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'
]);
if
(
Yii
::
$app
->
request
->
isPost
)
{
$model
=
new
ExploreAppCategory
();
$model
->
setScenario
(
ExploreAppCategory
::
SCENARIOS_CREATE
);
$params
=
Yii
::
$app
->
request
->
post
();
$params
[
'platform_id'
]
=
$platform_id
;
$lang
=
[
'zh-CN'
,
'en-US'
,
'ja'
];
$name_arr
=
$params
[
'name'
];
$name
=
[];
foreach
(
$name_arr
as
$key
=>
$val
)
{
$name
[
$lang
[
$key
]]
=
$val
;
}
unset
(
$params
[
'name'
]);
$params
[
'name'
]
=
$name
;
if
(
$model
->
load
(
$params
,
''
)
&&
$model
->
save
())
{
goto
doEnd
;
}
$msg
=
$model
->
errors
;
$code
=
-
1
;
goto
doEnd
;
}
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$app_category_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
if
(
Yii
::
$app
->
request
->
isGet
)
{
$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
action
Category
()
public
function
action
Apps
()
{
$msg
=
'ok'
;
$code
=
0
;
...
...
@@ -80,36 +105,4 @@ class ExploreController extends BaseController
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
public
function
actionBanner
()
{
$msg
=
'ok'
;
$code
=
0
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$query
=
CoinBannerItem
::
find
()
->
select
(
'id, banner_url, image_url'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
();
$banner_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$banner_model
,
'page'
=>
[
'pageCount'
=>
$pages
->
pageCount
,
'pageSize'
=>
10
,
'currentPage'
=>
$page
,
]
];
doEnd
:
return
[
'code'
=>
$code
,
'msg'
=>
$msg
,
'data'
=>
$data
];
}
}
\ No newline at end of file
wallet/controllers/ExploreBannerController.php
0 → 100644
View file @
93423ebe
<?php
namespace
wallet\controllers
;
use
Yii
;
use
yii\data\Pagination
;
use
wallet\base\BaseController
;
use
common\models\psources\CoinBannerItem
;
class
ExploreBannerController
extends
BaseController
{
public
function
actionBanner
()
{
$msg
=
'ok'
;
$code
=
0
;
$platform_id
=
Yii
::
$app
->
request
->
getPlatformId
();
$page
=
Yii
::
$app
->
request
->
get
(
'page'
,
1
);
if
(
false
==
$platform_id
)
{
$msg
=
'参数错误'
;
$code
=
-
1
;
$data
=
null
;
goto
doEnd
;
}
$query
=
CoinBannerItem
::
find
()
->
select
(
'id, banner_url, image_url'
)
->
where
([
'platform_id'
=>
$platform_id
])
->
asArray
();
$banner_model
=
$query
->
offset
((
$page
-
1
)
*
10
)
->
limit
(
10
)
->
asArray
()
->
all
();
$countQuery
=
clone
$query
;
$pages
=
new
Pagination
([
'totalCount'
=>
$countQuery
->
count
(),
'pageSize'
=>
'10'
]);
$data
=
[
'list'
=>
$banner_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