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
6c2d4607
Commit
6c2d4607
authored
Oct 13, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
9d5c6fe8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
18 deletions
+42
-18
ApplicationCategoryController.php
backend/controllers/ApplicationCategoryController.php
+3
-16
CoinApplicationCategoryForm.php
backend/models/coin/CoinApplicationCategoryForm.php
+5
-2
index.php
backend/views/application-category/index.php
+34
-0
No files found.
backend/controllers/ApplicationCategoryController.php
View file @
6c2d4607
...
...
@@ -31,8 +31,8 @@ class ApplicationCategoryController extends BaseController
$data
=
CoinApplicationCategory
::
getList
(
$page
,
$limit
,
$where
);
return
$data
;
}
//
$items = CoinApplicationCategory::getItemsByPid(0);
return
$this
->
render
(
'index'
);
$items
=
CoinApplicationCategory
::
getItemsByPid
(
0
);
return
$this
->
render
(
'index'
,[
'items'
=>
$items
]
);
}
/**
...
...
@@ -42,7 +42,7 @@ class ApplicationCategoryController extends BaseController
{
if
(
Yii
::
$app
->
request
->
isPost
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
];
$fields
=
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'pid'
];
$params
=
$this
->
initParams
(
Yii
::
$app
->
request
->
post
(),
$fields
);
$application_category
=
new
CoinApplicationCategoryForm
();
if
(
$params
[
'id'
]){
//edit
...
...
@@ -75,16 +75,4 @@ class ApplicationCategoryController extends BaseController
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
}
public
function
actionUpload
()
{
Yii
::
$app
->
response
->
format
=
'json'
;
try
{
$apk
=
UploadedFile
::
getInstanceByName
(
'apk'
);
$filepath
=
Yii
::
$app
->
uploader
->
upload
(
$apk
);
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
,
'path'
=>
$filepath
];
}
catch
(
\Exception
$e
)
{
return
[
'code'
=>
$e
->
getCode
(),
'msg'
=>
$e
->
getMessage
()];
}
}
}
\ No newline at end of file
backend/models/coin/CoinApplicationCategoryForm.php
View file @
6c2d4607
...
...
@@ -25,7 +25,7 @@ class CoinApplicationCategoryForm extends BaseForm
{
return
[
self
::
SCENARIO_ADD
=>
[
'name'
,
'sort'
,
'icon'
,
'pid'
],
self
::
SCENARIO_EDIT
=>
[
'id'
,
'name'
,
'sort'
,
'icon'
],
self
::
SCENARIO_EDIT
=>
[
'id'
,
'name'
,
'sort'
,
'icon'
,
'pid'
],
];
}
...
...
@@ -37,6 +37,7 @@ class CoinApplicationCategoryForm extends BaseForm
'name'
=>
'名称'
,
'icon'
=>
'图标'
,
'sort'
=>
'排序'
,
'pid'
=>
'父级分类ID'
];
}
...
...
@@ -47,6 +48,7 @@ class CoinApplicationCategoryForm extends BaseForm
[[
'id'
,
'name'
,
'sort'
],
'required'
,
'on'
=>
self
::
SCENARIO_EDIT
],
[
'sort'
,
'default'
,
'value'
=>
99
],
[
'icon'
,
'default'
,
'value'
=>
0
],
[
'pid'
,
'default'
,
'value'
=>
0
],
[
'name'
,
'checkName'
],
];
}
...
...
@@ -92,7 +94,8 @@ class CoinApplicationCategoryForm extends BaseForm
if
(
$coin_applicate_category
){
$coin_applicate_category
->
setAttributes
(
$this
->
attributes
,
false
);
$coin_applicate_category
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'应用分类修改成功!'
];
$items
=
CoinApplicationCategory
::
getItemsByPid
(
0
);
return
[
'code'
=>
0
,
'msg'
=>
'应用分类修改成功!'
,
'items'
=>
$items
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用分类不存在'
];
}
...
...
backend/views/application-category/index.php
View file @
6c2d4607
...
...
@@ -35,6 +35,18 @@
<form
class=
"layui-form form_add"
action=
"javascript:void(0)"
id=
"form1"
method=
"post"
lay-filter=
"form1"
>
<input
type=
"hidden"
name=
"_csrf"
value=
"
<?=
Yii
::
$app
->
request
->
getCsrfToken
()
?>
"
>
<input
type=
"hidden"
name=
"id"
value=
""
>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
style=
"margin-bottom: 0; width: 100px;"
>
所属分类
</label>
<div
class=
"layui-input-block"
>
<select
name=
"pid"
id=
"select"
>
<option
value=
"0"
>
顶级分类
</option>
<?php
foreach
(
$items
as
$key
=>
$value
)
:
?>
<option
value=
"
<?=
$key
?>
"
>
<?=
$value
?>
</option>
<?php
endforeach
;
?>
</select>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
>
名称
</label>
<div
class=
"layui-input-block"
>
...
...
@@ -113,6 +125,13 @@
width
:
50
},
{
field
:
'pid'
,
title
:
'所属父级'
,
hide
:
true
,
width
:
50
},
]],
});
...
...
@@ -135,6 +154,7 @@
name
:
data
.
name
,
icon
:
data
.
icon
,
sort
:
data
.
sort
,
pid
:
data
.
pid
,
});
$
(
"#icon1"
).
attr
(
'src'
,
data
.
icon_url
);
},
...
...
@@ -149,6 +169,8 @@
curr
:
1
}
});
refreshSelect
(
rev
.
items
);
}
});
},
...
...
@@ -241,8 +263,19 @@
name
:
''
,
icon
:
''
,
sort
:
''
,
pid
:
0
,
});
$
(
"#icon1"
).
attr
(
'src'
,
''
);
}
//刷新分类下拉框
function
refreshSelect
(
items
){
var
html
=
'<option value="0">顶级分类</option>'
;
$
.
each
(
items
,
function
(
i
,
c
)
{
html
+=
'<option value="'
+
i
+
'">'
+
c
+
'</option>'
;
});
$
(
'#select'
).
html
(
html
);
form
.
render
(
'select'
);
}
</script>
\ 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