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
f34f5d06
Commit
f34f5d06
authored
Jun 07, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
反馈
parent
61885b6f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
199 additions
and
0 deletions
+199
-0
FeedbackController.php
api/controllers/FeedbackController.php
+47
-0
SourceController.php
backend/controllers/SourceController.php
+46
-0
feedback.php
backend/views/source/feedback.php
+70
-0
Feedback.php
common/models/pwallet/Feedback.php
+36
-0
No files found.
api/controllers/FeedbackController.php
0 → 100644
View file @
f34f5d06
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-7
* Time: 下午4:52
*/
namespace
api\controllers
;
use
Yii
;
use
api\base\BaseController
;
use
common\models\pwallet\Feedback
;
/**
* 用户反馈接口
* Class FeedbackController
* @package api\controllers
*/
class
FeedbackController
extends
BaseController
{
/**
* 添加反馈
*/
public
function
actionAdd
()
{
$reqest
=
Yii
::
$app
->
request
;
$type
=
$reqest
->
post
(
'type'
,
0
);
$content
=
$reqest
->
post
(
'content'
,
null
);
$connect
=
$reqest
->
post
(
'connect'
,
null
);
try
{
if
(
empty
(
$content
))
{
throw
new
\Exception
(
'反馈内容不能为空'
,
1
);
}
$feedback
=
new
Feedback
();
$feedback
->
type
=
$type
;
$feedback
->
content
=
$content
;
$feedback
->
connect
=
$connect
;
$feedback
->
create_at
=
date
(
'Y-m-d H:i:s'
);
$feedback
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
];
}
catch
(
\Exception
$exception
)
{
return
[
'code'
=>
$exception
->
getCode
(),
'msg'
=>
$exception
->
getMessage
()];
}
}
}
\ No newline at end of file
backend/controllers/SourceController.php
View file @
f34f5d06
...
@@ -13,6 +13,7 @@ use backend\models\coin\NoticeForm;
...
@@ -13,6 +13,7 @@ use backend\models\coin\NoticeForm;
use
Yii
;
use
Yii
;
use
common\models\pwallet\Article
;
use
common\models\pwallet\Article
;
use
common\models\pwallet\Notice
;
use
common\models\pwallet\Notice
;
use
common\models\pwallet\Feedback
;
use
yii\db\Exception
;
use
yii\db\Exception
;
class
SourceController
extends
BaseController
class
SourceController
extends
BaseController
...
@@ -254,4 +255,48 @@ class SourceController extends BaseController
...
@@ -254,4 +255,48 @@ class SourceController extends BaseController
}
}
$this
->
error
(
'删除失败'
,
Yii
::
$app
->
request
->
getReferrer
());
$this
->
error
(
'删除失败'
,
Yii
::
$app
->
request
->
getReferrer
());
}
}
public
function
actionFeedback
()
{
if
(
Yii
::
$app
->
request
->
isAjax
)
{
$request
=
Yii
::
$app
->
request
;
$page
=
$request
->
get
(
'page'
,
1
);
$limit
=
$request
->
get
(
'limit'
,
10
);
$type
=
$request
->
get
(
'type'
,
0
);
$connect
=
$request
->
get
(
'connect'
,
null
);
$condition
=
[];
if
(
isset
(
$type
))
{
$condition
[]
=
[
'type'
=>
$type
];
}
if
(
isset
(
$connect
))
{
$condition
[]
=
[
'like'
,
'connect'
,
$connect
];
}
$data
=
Feedback
::
getList
(
$page
,
$limit
,
$condition
);
Yii
::
$app
->
response
->
format
=
'json'
;
Yii
::
$app
->
response
->
data
=
$data
;
Yii
::
$app
->
response
->
send
();
}
if
(
Yii
::
$app
->
request
->
isGet
)
{
$operation
=
Yii
::
$app
->
request
->
get
(
'operation'
,
0
);
$id
=
Yii
::
$app
->
request
->
get
(
'id'
,
0
);
if
(
$operation
==
1
)
{
//删除反馈
$feedback
=
Feedback
::
findOne
([
'id'
=>
$id
]);
if
(
$feedback
)
{
try
{
$feedback
->
delete
();
$this
->
success
(
'删除成功'
,
'/admin/source/feedback'
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Throwable
$throwable
)
{
}
}
$this
->
error
(
'删除成功'
,
'/admin/source/feedback'
);
}
}
return
$this
->
render
(
'feedback'
);
}
}
}
\ No newline at end of file
backend/views/source/feedback.php
0 → 100644
View file @
f34f5d06
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-7
* Time: 下午4:15
*/
?>
<div
class=
"layui-row"
>
<div
class=
"layui-col-md5"
>
<form
class=
"layui-form"
>
<div
class=
"layui-inline"
style=
"display: none;"
>
<label
class=
"layui-form-label"
>
类别
</label>
<div
class=
"layui-input-inline"
>
<select
name=
"type"
>
<option
value=
"0"
>
1
</option>
<option
value=
"1"
>
1
</option>
<option
value=
"2"
>
1
</option>
<option
value=
"3"
>
1
</option>
</select>
</div>
</div>
<div
class=
"layui-inline"
>
<label
class=
"layui-form-label"
style=
"width: 100px; margin-bottom: 0"
>
联系方式
</label>
<div
class=
"layui-input-inline"
>
<input
class=
"layui-input"
type=
"text"
name=
"connect"
>
</div>
</div>
<div
class=
"layui-inline"
>
<button
class=
"layui-btn"
lay-submit
lay-filter=
"submit1"
>
查询
</button>
<button
class=
"layui-btn"
>
导出cvs
</button>
</div>
</form>
</div>
</div>
<div
class=
"layui-row"
>
<table
class=
"layui-table"
id=
"table1"
></table>
</div>
<script>
var
form
=
layui
.
form
;
form
.
render
();
var
table
=
layui
.
table
;
table
.
render
({
elem
:
"#table1"
,
page
:
1
,
limit
:
10
,
url
:
'/admin/source/feedback'
,
cols
:
[[
{
field
:
'id'
,
title
:
'ID'
},
{
field
:
'content'
,
title
:
'内容'
},
{
field
:
'connect'
,
title
:
'联系方式'
},
{
field
:
'create_at'
,
title
:
'反馈时间'
},
{
field
:
'id'
,
title
:
'操作'
,
templet
:
"#operationTpl"
}
]]
});
form
.
on
(
'submit(submit1)'
,
function
(
data
)
{
table
.
reload
(
'table1'
,
{
where
:
data
.
field
,
page
:
{
curr
:
1
},
});
return
false
;
});
</script>
<script
type=
"text/html"
id=
"operationTpl"
>
<
a
href
=
"/admin/source/feedback?id={{d.id}}&operation=1"
>
<
button
class
=
"layui-btn layui-btn-danger layui-btn-sm"
>
删除
<
/button
>
<
/a
>
</script>
\ No newline at end of file
common/models/pwallet/Feedback.php
0 → 100644
View file @
f34f5d06
<?php
/**
* Created by PhpStorm.
* User: rlgyzhcn
* Date: 18-6-7
* Time: 下午4:31
*/
namespace
common\models\pwallet
;
use
common\base\Exception
;
use
Yii
;
use
common\core\BaseActiveRecord
;
class
Feedback
extends
BaseActiveRecord
{
public
static
function
getDb
()
{
return
Yii
::
$app
->
get
(
'db_pwallet'
);
}
public
static
function
getList
(
$page
=
1
,
$limit
=
10
,
$condition
=
[])
{
$query
=
self
::
find
();
foreach
(
$condition
as
$item
)
{
$query
=
$query
->
andWhere
(
$item
);
}
$count
=
$query
->
count
();
if
(
$count
)
{
$data
=
$query
->
offset
((
$page
-
1
)
*
$limit
)
->
limit
(
$limit
)
->
asArray
()
->
all
();
return
[
'code'
=>
0
,
'count'
=>
$count
,
'data'
=>
$data
];
}
return
[
'code'
=>
1
,
'msg'
=>
'数据为空'
];
}
}
\ 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