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
0423b061
Commit
0423b061
authored
Oct 16, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
c0fadf4b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
3 deletions
+29
-3
CoinApplicationCategoryForm.php
backend/models/coin/CoinApplicationCategoryForm.php
+5
-0
index.php
backend/views/application-category/index.php
+5
-1
CoinAppCate.php
common/models/psources/CoinAppCate.php
+11
-0
CoinApplication.php
common/models/psources/CoinApplication.php
+0
-2
CoinApplicationCategory.php
common/models/psources/CoinApplicationCategory.php
+8
-0
No files found.
backend/models/coin/CoinApplicationCategoryForm.php
View file @
0423b061
...
...
@@ -9,6 +9,7 @@
namespace
backend\models\coin
;
use
backend\models\BaseForm
;
use
common\models\psources\CoinAppCate
;
use
common\models\psources\CoinApplicationCategory
;
class
CoinApplicationCategoryForm
extends
BaseForm
...
...
@@ -118,6 +119,10 @@ class CoinApplicationCategoryForm extends BaseForm
{
$coin_applicate_category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
$coin_applicate_category
){
$hasApp
=
CoinAppCate
::
getAppCountByCateId
(
$id
);
if
(
$hasApp
){
return
[
'code'
=>
1
,
'msg'
=>
'分类下有应用,无法删除'
];
}
$coin_applicate_category
->
delete
();
return
[
'code'
=>
0
,
'msg'
=>
'应用分类删除成功'
];
}
else
{
...
...
backend/views/application-category/index.php
View file @
0423b061
...
...
@@ -26,7 +26,7 @@
</form>
</div>
</div>
<div
class=
"layui-col-md
8
"
>
<div
class=
"layui-col-md
9
"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
...
...
@@ -125,6 +125,10 @@
field
:
'name'
,
title
:
'名称'
,
},
{
field
:
'app_count'
,
title
:
'应用'
,
},
{
field
:
'icon_url'
,
...
...
common/models/psources/CoinAppCate.php
View file @
0423b061
...
...
@@ -28,4 +28,14 @@ class CoinAppCate extends BaseActiveRecord
return
self
::
find
()
->
where
([
'cate_id'
=>
$cate_id
])
->
asArray
()
->
all
();
}
public
static
function
getAppCountByCateId
(
$cate_id
)
{
return
self
::
find
()
->
where
([
'cate_id'
=>
$cate_id
])
->
count
();
}
public
static
function
getAppCountByCateIds
(
$cate_ids
)
{
$data
=
self
::
find
()
->
select
(
'cate_id,count(*) as num'
)
->
where
([
'in'
,
'cate_id'
,
$cate_ids
])
->
groupBy
(
'cate_id'
)
->
asArray
()
->
all
();
return
array_column
(
$data
,
'num'
,
'cate_id'
);
}
}
\ No newline at end of file
common/models/psources/CoinApplication.php
View file @
0423b061
...
...
@@ -55,6 +55,5 @@ class CoinApplication extends BaseActiveRecord
}
}
return
[
'count'
=>
$count
,
'data'
=>
$data
,
'code'
=>
0
];
}
}
\ No newline at end of file
common/models/psources/CoinApplicationCategory.php
View file @
0423b061
...
...
@@ -55,8 +55,11 @@ class CoinApplicationCategory extends BaseActiveRecord
$data
=
$data
->
asArray
()
->
all
();
$icon_Items
=
array_column
(
$data
,
'icon'
);
$banner_Items
=
array_column
(
$data
,
'banner'
);
$id_Items
=
array_column
(
$data
,
'id'
);
$image_Items
=
array_merge
(
$icon_Items
,
$banner_Items
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$image_Items
);
//获取分类应用数量
$cate_app_items
=
CoinAppCate
::
getAppCountByCateIds
(
$id_Items
);
foreach
(
$data
as
$key
=>
&
$value
){
if
(
$value
[
'icon'
]){
$value
[
'icon_url'
]
=
$icon_Infos
[
$value
[
'icon'
]][
'base_url'
]
.
$icon_Infos
[
$value
[
'icon'
]][
'file_url'
];
...
...
@@ -68,6 +71,11 @@ class CoinApplicationCategory extends BaseActiveRecord
}
else
{
$value
[
'banner_image_url'
]
=
''
;
}
if
(
isset
(
$cate_app_items
[
$value
[
'id'
]])){
$value
[
'app_count'
]
=
$cate_app_items
[
$value
[
'id'
]];
}
else
{
$value
[
'app_count'
]
=
0
;
}
}
return
[
'count'
=>
$count
,
'data'
=>
$data
,
'code'
=>
0
];
}
...
...
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