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
b72bad8d
Commit
b72bad8d
authored
Aug 27, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
80cf90a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
CoinController.php
backend/controllers/CoinController.php
+11
-2
index.js
backend/web/js/coin/index.js
+4
-2
No files found.
backend/controllers/CoinController.php
View file @
b72bad8d
...
...
@@ -163,19 +163,28 @@ class CoinController extends BaseController
public
function
actionDelete
()
{
Yii
::
$app
->
response
->
format
=
'json'
;
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
if
(
$id
)
{
$model
=
Coin
::
findOne
([
'id'
=>
$id
]);
if
(
$model
)
{
$role
=
Yii
::
$app
->
user
->
identity
->
group
;
if
(
'administrator'
!=
$role
)
{
$coin
=
Coin
::
find
()
->
select
([
'group'
])
->
where
([
'id'
=>
$id
])
->
one
();
if
(
$role
==
$coin
->
group
)
{
try
{
$model
->
delete
();
$this
->
success
(
'删除成功'
,
'/admin/coin/index'
,
true
)
;
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
]
;
}
catch
(
\Throwable
$t
)
{
}
catch
(
\Exception
$e
)
{
}
}
else
{
return
[
'code'
=>
-
1
,
'msg'
=>
'没有权限修改'
];
}
}
}
}
$this
->
error
(
'删除失败'
,
Yii
::
$app
->
request
->
getReferrer
(),
true
)
;
return
[
'code'
=>
-
1
,
'msg'
=>
'删除失败'
]
;
}
public
function
actionGetExchangeListById
()
...
...
backend/web/js/coin/index.js
View file @
b72bad8d
...
...
@@ -56,11 +56,13 @@ table.on('tool(table1)', function (obj) {
});
}
else
if
(
obj
.
event
==
'delete'
)
{
layer
.
confirm
(
'真的要删除'
+
data
.
name
+
'吗?'
,
{
icon
:
3
,
title
:
'删除'
},
function
(
index
)
{
obj
.
del
();
//删除对应行(tr)的DOM结构
layer
.
close
(
index
);
//向服务端发送删除指令
$
.
get
(
'/admin/coin/delete?id='
+
obj
.
data
.
id
,
function
(
data
,
status
)
{
layer
.
msg
(
data
.
info
);
if
(
data
.
code
==
0
)
{
obj
.
del
();
//删除对应行(tr)的DOM结构
}
layer
.
msg
(
data
.
msg
);
});
});
}
else
if
(
obj
.
event
==
'edit'
)
{
...
...
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