80 lines
2.2 KiB
PHP
80 lines
2.2 KiB
PHP
<?php
|
||
// +------------------------------------------------+
|
||
// |http://www.cjango.com |
|
||
// +------------------------------------------------+
|
||
// | 修复BUG不是一朝一夕的事情,等我喝醉了再说吧! |
|
||
// +------------------------------------------------+
|
||
// | Author: 小陈叔叔 <Jason.Chen> |
|
||
// +------------------------------------------------+
|
||
namespace app\mobile\controller;
|
||
|
||
use app\common\model\Suggest as SuggestModel;
|
||
use app\common\service\Suggest as SuggestService;
|
||
use think\Request;
|
||
|
||
class Suggest extends Center
|
||
{
|
||
/**
|
||
* 意见列表
|
||
* @param string $title 要搜索的意见标题
|
||
* @return [type] [description]
|
||
*/
|
||
public function index()
|
||
{
|
||
$map['uid'] = UID;
|
||
$map['pid'] = 0;
|
||
|
||
$this->list = SuggestModel::where($map)->order('create_time desc')->paginate();
|
||
$this->meta_title = '反馈管理';
|
||
return $this->fetch();
|
||
}
|
||
|
||
/**
|
||
* 添加意见
|
||
* @param Request $Request 数据集
|
||
*/
|
||
public function add(Request $Request)
|
||
{
|
||
if (IS_POST) {
|
||
$data = $Request->post();
|
||
$result = SuggestService::create($data);
|
||
if ($result === true) {
|
||
return $this->success('添加反馈成功', url('suggest/index'));
|
||
} else {
|
||
return $this->error($result);
|
||
}
|
||
} else {
|
||
$this->meta_title = '添加反馈';
|
||
return $this->fetch();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 回复意见
|
||
* @param Request $Request 数据集
|
||
*/
|
||
public function revert(Request $Request)
|
||
{
|
||
if (IS_POST) {
|
||
$data = $Request->post();
|
||
$result = SuggestService::create($data);
|
||
return $this->back($result);
|
||
} else {
|
||
$this->info = SuggestService::read($Request->param('id'));
|
||
return $this->fetch();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 删除意见
|
||
* @param [type] $id 意见id
|
||
* @return [type] [description]
|
||
*/
|
||
public function del($id)
|
||
{
|
||
$result = SuggestService::del($id);
|
||
return $this->back($result);
|
||
}
|
||
|
||
}
|