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
0b45424d
Commit
0b45424d
authored
Oct 23, 2018
by
ZhuChunYang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
应用排序修改
parent
b8554db4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
5 deletions
+80
-5
ApplicationCategoryController.php
backend/controllers/ApplicationCategoryController.php
+22
-0
ApplicationController.php
backend/controllers/ApplicationController.php
+23
-0
index.php
backend/views/application-category/index.php
+16
-2
list.php
backend/views/application/list.php
+17
-1
ApplicationBusiness.php
common/business/ApplicationBusiness.php
+2
-2
No files found.
backend/controllers/ApplicationCategoryController.php
View file @
0b45424d
...
@@ -73,4 +73,25 @@ class ApplicationCategoryController extends BaseController
...
@@ -73,4 +73,25 @@ class ApplicationCategoryController extends BaseController
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
}
}
public
function
actionSetSort
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
get
(
'id'
,
''
);
$sort
=
$request
->
get
(
'sort'
,
1
);
if
(
$id
){
$category
=
CoinApplicationCategory
::
getCategoryById
(
$id
);
if
(
!
$category
){
return
[
'code'
=>
1
,
'msg'
=>
'分类不存在,不能设置排序'
];
}
$category
->
sort
=
$sort
;
$category
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'分类排序设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'分类排序设置失败'
];
}
}
}
}
}
\ No newline at end of file
backend/controllers/ApplicationController.php
View file @
0b45424d
...
@@ -184,4 +184,26 @@ class ApplicationController extends BaseController
...
@@ -184,4 +184,26 @@ class ApplicationController extends BaseController
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
}
}
public
function
actionSetSort
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
Yii
::
$app
->
response
->
format
=
'json'
;
$request
=
Yii
::
$app
->
request
;
$id
=
$request
->
get
(
'id'
,
''
);
$category_id
=
$request
->
get
(
'category_id'
,
''
);
$sort
=
$request
->
get
(
'sort'
,
1
);
if
(
$id
&&
$category_id
){
$app_cate
=
CoinAppCate
::
getAppCate
(
$category_id
,
$id
);
if
(
!
$app_cate
){
return
[
'code'
=>
1
,
'msg'
=>
'应用不存在,不能设置排序'
];
}
$app_cate
->
sort
=
$sort
;
$app_cate
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'应用排序设置成功'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'应用排序设置失败'
];
}
}
}
}
}
\ No newline at end of file
backend/views/application-category/index.php
View file @
0b45424d
...
@@ -119,7 +119,6 @@
...
@@ -119,7 +119,6 @@
page
:
true
,
page
:
true
,
limit
:
10
,
limit
:
10
,
skin
:
'row'
,
skin
:
'row'
,
even
:
true
,
url
:
'/admin/application-category/index'
,
url
:
'/admin/application-category/index'
,
cols
:
[[
cols
:
[[
{
{
...
@@ -142,7 +141,8 @@
...
@@ -142,7 +141,8 @@
},
},
{
{
field
:
'sort'
,
field
:
'sort'
,
title
:
'排序'
title
:
'排序'
,
edit
:
'text'
},
},
{
{
field
:
'banner'
,
field
:
'banner'
,
...
@@ -332,4 +332,17 @@
...
@@ -332,4 +332,17 @@
}
}
});
});
//监听单元格编辑
table
.
on
(
'edit(table1)'
,
function
(
obj
){
var
value
=
obj
.
value
;
//得到修改后的值
var
data
=
obj
.
data
;
//得到所在行所有键值
$
.
get
(
'/admin/application-category/set-sort'
,
{
id
:
data
.
id
,
sort
:
value
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
table
.
reload
(
'table1'
,{});
}
else
{
}
});
});
</script>
</script>
\ No newline at end of file
backend/views/application/list.php
View file @
0b45424d
...
@@ -90,7 +90,8 @@
...
@@ -90,7 +90,8 @@
},
},
{
{
field
:
'sort'
,
field
:
'sort'
,
title
:
'排序'
title
:
'排序'
,
edit
:
'text'
},
},
{
{
field
:
'has_h5'
,
field
:
'has_h5'
,
...
@@ -234,4 +235,18 @@
...
@@ -234,4 +235,18 @@
});
});
}
}
});
});
//监听单元格编辑
table
.
on
(
'edit(table1)'
,
function
(
obj
){
var
value
=
obj
.
value
;
//得到修改后的值
var
data
=
obj
.
data
;
//得到所在行所有键值
$
.
get
(
'/admin/application/set-sort'
,
{
id
:
data
.
id
,
category_id
:
category_id
,
sort
:
value
},
function
(
rev
)
{
layer
.
msg
(
rev
.
msg
);
if
(
0
==
rev
.
code
)
{
table
.
reload
(
'table1'
,{});
}
else
{
}
});
});
</script>
</script>
\ No newline at end of file
common/business/ApplicationBusiness.php
View file @
0b45424d
...
@@ -76,8 +76,8 @@ class ApplicationBusiness
...
@@ -76,8 +76,8 @@ class ApplicationBusiness
{
{
$app_cate_Model
=
CoinAppCate
::
find
();
$app_cate_Model
=
CoinAppCate
::
find
();
$data
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
$data
=
$app_cate_Model
->
JoinWith
([
'application'
],
false
)
->
select
(
'cate_id,app_id,name,icon,
sort,type,native_url,h5_url,android_url,ios_url,app_store_url,redirect_type,
'
)
->
select
(
'cate_id,app_id,name,icon,
type,native_url,h5_url,android_url,ios_url,app_store_url,redirect_type,'
.
CoinAppCate
::
tableName
()
.
'.sort
'
)
->
orderBy
(
'
sort asc'
)
->
asArray
()
->
all
();
->
orderBy
(
CoinAppCate
::
tableName
()
.
'.
sort asc'
)
->
asArray
()
->
all
();
$icon_Items
=
array_column
(
$data
,
'icon'
);
$icon_Items
=
array_column
(
$data
,
'icon'
);
$icon_Items
=
array_unique
(
$icon_Items
);
$icon_Items
=
array_unique
(
$icon_Items
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$icon_Items
);
$icon_Infos
=
CoinImage
::
getItemsByIds
(
$icon_Items
);
...
...
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