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
52b4ccbd
Commit
52b4ccbd
authored
Oct 17, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
5bc86d2a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
1 deletion
+64
-1
ApplicationController.php
backend/controllers/ApplicationController.php
+29
-0
CoinApplicationCategoryForm.php
backend/models/coin/CoinApplicationCategoryForm.php
+3
-0
CoinApplicationForm.php
backend/models/coin/CoinApplicationForm.php
+3
-0
image-index.php
backend/views/application/image-index.php
+7
-0
list.php
backend/views/application/list.php
+3
-1
CoinApplicateRecommend.php
common/models/psources/CoinApplicateRecommend.php
+19
-0
No files found.
backend/controllers/ApplicationController.php
View file @
52b4ccbd
...
...
@@ -128,5 +128,33 @@ class ApplicationController extends BaseController
}
}
/**
* @return array|string
* 应用图片页面
*/
public
function
actionImageIndex
()
{
if
(
Yii
::
$app
->
request
->
isAjax
){
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$data
=
[];
return
$data
;
}
else
{
$id
=
Yii
::
$app
->
request
->
get
(
'id'
);
if
(
$id
){
$applicate
=
CoinApplication
::
getApplicate
(
$id
);
if
(
$applicate
){
$this
->
layout
=
false
;
return
$this
->
render
(
'image-index'
,[
'applicate'
=>
$applicate
]);
}
else
{
$this
->
error
(
'id参数不合法'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
else
{
$this
->
error
(
'id参数不能为空'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
}
}
\ No newline at end of file
backend/models/coin/CoinApplicationCategoryForm.php
View file @
52b4ccbd
...
...
@@ -10,6 +10,7 @@ namespace backend\models\coin;
use
backend\models\BaseForm
;
use
common\models\psources\CoinAppCate
;
use
common\models\psources\CoinApplicateRecommend
;
use
common\models\psources\CoinApplicationCategory
;
class
CoinApplicationCategoryForm
extends
BaseForm
...
...
@@ -101,6 +102,7 @@ class CoinApplicationCategoryForm extends BaseForm
if
(
$coin_applicate_category
){
$coin_applicate_category
->
setAttributes
(
$this
->
attributes
,
false
);
$coin_applicate_category
->
save
();
CoinApplicateRecommend
::
updateName
(
$this
->
id
,
1
,
$this
->
name
);
return
[
'code'
=>
0
,
'msg'
=>
'应用分类修改成功!'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用分类不存在'
];
...
...
@@ -124,6 +126,7 @@ class CoinApplicationCategoryForm extends BaseForm
return
[
'code'
=>
1
,
'msg'
=>
'分类下有应用,无法删除'
];
}
$coin_applicate_category
->
delete
();
CoinApplicateRecommend
::
del
(
$id
,
1
);
//删除首页推荐
return
[
'code'
=>
0
,
'msg'
=>
'应用分类删除成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用分类不存在'
];
...
...
backend/models/coin/CoinApplicationForm.php
View file @
52b4ccbd
...
...
@@ -9,6 +9,7 @@ namespace backend\models\coin;
use
backend\models\BaseForm
;
use
common\models\psources\CoinAppCate
;
use
common\models\psources\CoinApplicateRecommend
;
use
common\models\psources\CoinApplication
;
use
Yii
;
class
CoinApplicationForm
extends
BaseForm
...
...
@@ -131,6 +132,7 @@ class CoinApplicationForm extends BaseForm
if
(
$coin_applicate
){
$coin_applicate
->
setAttributes
(
$this
->
attributes
,
false
);
$coin_applicate
->
save
();
CoinApplicateRecommend
::
updateName
(
$this
->
id
,
2
,
$this
->
name
);
//更新首页推荐name
return
[
'code'
=>
0
,
'msg'
=>
'应用修改成功!'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用不存在'
];
...
...
@@ -155,6 +157,7 @@ class CoinApplicationForm extends BaseForm
if
(
$cate_count
==
1
){
$applicate
=
CoinApplication
::
getApplicate
(
$id
);
$applicate
->
delete
();
CoinApplicateRecommend
::
del
(
$id
,
2
);
//删除首页推荐
}
$coin_app_cate
->
delete
();
$tr
->
commit
();
...
...
backend/views/application/image-index.php
0 → 100644
View file @
52b4ccbd
<?php
/**
* Created by PhpStorm.
* User: ZCY
* Date: 2018/10/17
* Time: 16:27
*/
backend/views/application/list.php
View file @
52b4ccbd
...
...
@@ -23,6 +23,7 @@
<div
class=
"layui-col-md10"
>
<table
class=
"layui-table"
id=
"table1"
lay-filter=
"table1"
></table>
</div>
<!-- 添加页面 -->
<div
class=
"layui-row"
style=
"display: none;padding: 5px;"
id=
"_form"
>
<div
class=
"layui-col-xs6 layui-col-sm6 layui-col-md11"
>
...
...
@@ -43,6 +44,7 @@
</div>
</div>
<script
type=
"text/html"
id=
"iconTpl"
>
<
img
src
=
"{{d.icon_url}}"
style
=
"max-width: 32px; max-height: 32px;"
/>
</script>
...
...
@@ -50,7 +52,7 @@
<
a
class
=
"layui-btn layui-btn-xs"
lay
-
event
=
"edit"
>
编辑
<
/a>
<
a
class
=
"layui-btn layui-btn-danger layui-btn-xs"
lay
-
event
=
"del"
>
删除
<
/a>
<
a
class
=
"layui-btn layui-btn-normal layui-btn-xs"
lay
-
event
=
"add_category"
>
添加所属分类
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
lay
-
event
=
"image_info"
>
详情图管理
<
/a>
<
a
class
=
"layui-btn layui-btn-primary layui-btn-xs"
href
=
"/admin/application/image-index?id={{d.id}}"
>
详情图管理
<
/a>
</script>
<script
type=
"text/html"
id=
"recommendTpl"
>
<
input
type
=
"checkbox"
name
=
"isrecommend"
value
=
"{{d.id}}"
lay
-
skin
=
"switch"
lay
-
text
=
"是|否"
lay
-
filter
=
"recommendDemo"
{{
d
.
isrecommend
==
1
?
'checked'
:
''
}}
>
...
...
common/models/psources/CoinApplicateRecommend.php
View file @
52b4ccbd
...
...
@@ -43,5 +43,23 @@ class CoinApplicateRecommend extends BaseActiveRecord
return
array_column
(
$data
,
null
,
'relate_id'
);
}
public
static
function
updateName
(
$id
,
$type
,
$name
)
{
$recommend
=
self
::
find
()
->
where
([
'relate_id'
=>
$id
,
'type'
=>
$type
])
->
one
();
if
(
$recommend
){
$recommend
->
name
=
$name
;
$recommend
->
save
();
}
}
public
static
function
del
(
$id
,
$type
)
{
$recommend
=
self
::
find
()
->
where
([
'relate_id'
=>
$id
,
'type'
=>
$type
])
->
one
();
if
(
$recommend
){
$recommend
->
delete
();
}
}
}
\ 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