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
f7fd62cb
Commit
f7fd62cb
authored
Nov 09, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
43b86d1d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
3 deletions
+33
-3
ApplicationController.php
api/controllers/ApplicationController.php
+25
-0
ApplicationBusiness.php
common/business/ApplicationBusiness.php
+7
-3
CoinApplicationCategory.php
common/models/psources/CoinApplicationCategory.php
+1
-0
No files found.
api/controllers/ApplicationController.php
View file @
f7fd62cb
...
...
@@ -12,6 +12,7 @@ use api\base\BaseController;
use
common\business\ApplicationBusiness
;
use
common\models\psources\CoinApplicateRank
;
use
common\models\psources\CoinApplication
;
use
common\models\psources\CoinApplicationCategory
;
use
common\models\psources\CoinImage
;
use
Yii
;
...
...
@@ -140,7 +141,30 @@ class ApplicationController extends BaseController
}
}
return
[
'code'
=>
0
,
'data'
=>
[]];
}
/**
* 分类下的应用列表
*/
public
function
actionGetAppsByCate
()
{
$request
=
Yii
::
$app
->
request
;
$cate_id
=
$request
->
get
(
'cate_id'
,
''
);
if
(
$cate_id
){
$cate_info
=
CoinApplicationCategory
::
getCategoryById
(
$cate_id
);
$cate_info_data
[
'id'
]
=
$cate_info
->
id
;
$cate_info_data
[
'name'
]
=
$cate_info
->
name
;
$appItems
=
ApplicationBusiness
::
getCateAppInfo
(
0
,[[
'cate_id'
=>
$cate_id
]]);
if
(
$appItems
){
$appItems
=
array_shift
(
$appItems
);
foreach
(
$appItems
as
&
$value
){
$value
[
'app_user_num'
]
=
ApplicationBusiness
::
getAppUserNum
(
$value
[
'app_id'
]);
}
$cate_info_data
[
'apps'
]
=
$appItems
;
return
[
'code'
=>
0
,
'data'
=>
$cate_info_data
];
}
}
return
[
'code'
=>
0
,
'data'
=>
[]];
}
}
\ No newline at end of file
common/business/ApplicationBusiness.php
View file @
f7fd62cb
...
...
@@ -72,12 +72,16 @@ class ApplicationBusiness
* @return mixed
* 获取分类以及应用
*/
public
static
function
getCateAppInfo
(
$limit
=
0
)
public
static
function
getCateAppInfo
(
$limit
=
0
,
$condition
=
[]
)
{
$app_cate_Model
=
CoinAppCate
::
find
();
$
data
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
$
query
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
->
select
(
'cate_id,app_id,name,icon,type,native_url,native_login_url,h5_url,android_url,ios_url,app_store_url,redirect_type,'
.
CoinAppCate
::
tableName
()
.
'.sort'
)
->
orderBy
(
CoinAppCate
::
tableName
()
.
'.sort asc'
)
->
asArray
()
->
all
();
->
orderBy
(
CoinAppCate
::
tableName
()
.
'.sort asc'
);
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
}
$data
=
$query
->
asArray
()
->
all
();
$icon_Items
=
array_column
(
$data
,
'icon'
);
$icon_Items
=
array_unique
(
$icon_Items
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$icon_Items
);
...
...
common/models/psources/CoinApplicationCategory.php
View file @
f7fd62cb
...
...
@@ -104,4 +104,5 @@ class CoinApplicationCategory extends BaseActiveRecord
}
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