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
817b744e
Commit
817b744e
authored
Nov 15, 2019
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
407587bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
ExploreController.php
api/controllers/ExploreController.php
+18
-5
ExploreAppCategory.php
common/models/psources/ExploreAppCategory.php
+2
-1
No files found.
api/controllers/ExploreController.php
View file @
817b744e
...
...
@@ -22,15 +22,25 @@ class ExploreController extends BaseController
goto
doEnd
;
}
$app_category_model
=
ExploreAppCategory
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'status'
=>
ExploreAppCategory
::
STATUS_ON
])
->
all
();
foreach
(
$app_category_model
as
&
$val
)
{
$app_category_model
=
ExploreAppCategory
::
find
()
->
where
([
'platform_id'
=>
$platform_id
,
'status'
=>
ExploreAppCategory
::
STATUS_ON
])
->
orderBy
(
'sort'
)
->
all
();
if
(
false
==
$app_category_model
)
{
$msg
=
'success'
;
$code
=
0
;
$data
=
null
;
goto
doEnd
;
}
foreach
(
$app_category_model
as
$key
=>
$val
)
{
unset
(
$val
->
apps
);
$val
->
name
=
$val
->
name
[
$this
->
lang
];
$apps_model
=
ExploreApp
::
find
()
->
select
(
'id, name, icon, type, app_url, slogan'
)
->
where
([
'app_category_id'
=>
(
int
)
$val
->
id
])
->
where
([
'app_category_id'
=>
(
int
)
$val
->
id
,
'status'
=>
ExploreApp
::
STATUS_ON
])
->
orderBy
(
'sort'
)
->
limit
(
$val
->
limit
)
->
all
();
if
(
empty
(
$apps_model
))
{
unset
(
$app_category_model
[
$key
]);
continue
;
}
foreach
(
$apps_model
as
&
$app
)
{
$app
->
name
=
$app
->
name
[
$this
->
lang
];
}
...
...
@@ -39,7 +49,9 @@ class ExploreController extends BaseController
unset
(
$val
->
limit
);
unset
(
$val
->
platform_id
);
}
$data
=
$app_category_model
;
foreach
(
$app_category_model
as
$val
)
{
$data
[]
=
$val
;
}
$msg
=
'success'
;
$code
=
0
;
doEnd
:
...
...
@@ -95,7 +107,8 @@ class ExploreController extends BaseController
$id_arr
=
explode
(
','
,
$ids
);
$order
=
"FIELD(`id`,
$ids
)"
;
$apps_model
=
ExploreApp
::
find
()
->
select
(
'id, name, icon, type, app_url, slogan'
)
->
where
([
'in'
,
'id'
,
$id_arr
])
->
where
([
'status'
=>
ExploreApp
::
STATUS_ON
])
->
andWhere
([
'in'
,
'id'
,
$id_arr
])
->
orderBy
([
$order
=>
true
])
->
limit
(
4
)
->
all
();
...
...
common/models/psources/ExploreAppCategory.php
View file @
817b744e
...
...
@@ -59,7 +59,7 @@ class ExploreAppCategory extends BaseActiveRecord
public
function
getApplications
()
{
return
$this
->
hasMany
(
ExploreApp
::
className
(),
[
'app_category_id'
=>
'id'
])
->
select
([
'id'
,
'name'
,
'icon'
,
'app_url'
,
'slogan'
,
'type'
]);
return
$this
->
hasMany
(
ExploreApp
::
className
(),
[
'app_category_id'
=>
'id'
])
->
select
([
'id'
,
'name'
,
'icon'
,
'app_url'
,
'slogan'
,
'type'
])
->
orderBy
(
'sort'
)
;
}
}
\ 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