投诉反馈

This commit is contained in:
chenbo 2023-09-23 15:12:45 +08:00
parent 866160869c
commit 92591b4b51
5 changed files with 421 additions and 0 deletions

View File

@ -0,0 +1,108 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\controller;
use app\adminapi\controller\BaseAdminController;
use app\adminapi\lists\CompanyComplaintFeedbackLists;
use app\adminapi\logic\CompanyComplaintFeedbackLogic;
use app\adminapi\validate\CompanyComplaintFeedbackValidate;
/**
* CompanyComplaintFeedback控制器
* Class CompanyComplaintFeedbackController
* @package app\adminapi\controller
*/
class CompanyComplaintFeedbackController extends BaseAdminController
{
/**
* @notes 获取列表
* @return \think\response\Json
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function lists()
{
return $this->dataLists(new CompanyComplaintFeedbackLists());
}
/**
* @notes 添加
* @return \think\response\Json
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function add()
{
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('add');
$result = CompanyComplaintFeedbackLogic::add($params);
if (true === $result) {
return $this->success('添加成功', [], 1, 1);
}
return $this->fail(CompanyComplaintFeedbackLogic::getError());
}
/**
* @notes 编辑
* @return \think\response\Json
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function edit()
{
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('edit');
$result = CompanyComplaintFeedbackLogic::edit($params);
if (true === $result) {
return $this->success('编辑成功', [], 1, 1);
}
return $this->fail(CompanyComplaintFeedbackLogic::getError());
}
/**
* @notes 删除
* @return \think\response\Json
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function delete()
{
$params = (new CompanyComplaintFeedbackValidate())->post()->goCheck('delete');
CompanyComplaintFeedbackLogic::delete($params);
return $this->success('删除成功', [], 1, 1);
}
/**
* @notes 获取详情
* @return \think\response\Json
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function detail()
{
$params = (new CompanyComplaintFeedbackValidate())->goCheck('detail');
$result = CompanyComplaintFeedbackLogic::detail($params);
return $this->data($result);
}
}

View File

@ -0,0 +1,77 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\lists;
use app\adminapi\lists\BaseAdminDataLists;
use app\common\model\CompanyComplaintFeedback;
use app\common\lists\ListsSearchInterface;
/**
* CompanyComplaintFeedback列表
* Class CompanyComplaintFeedbackLists
* @package app\adminapi\lists
*/
class CompanyComplaintFeedbackLists extends BaseAdminDataLists implements ListsSearchInterface
{
/**
* @notes 设置搜索条件
* @return \string[][]
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function setSearch(): array
{
return [
'%like%' => ['content'],
];
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function lists(): array
{
return CompanyComplaintFeedback::where($this->searchWhere)
->field(['id', 'content', 'create_time'])
->limit($this->limitOffset, $this->limitLength)
->order(['id' => 'desc'])
->select()
->toArray();
}
/**
* @notes 获取数量
* @return int
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function count(): int
{
return CompanyComplaintFeedback::where($this->searchWhere)->count();
}
}

View File

@ -0,0 +1,106 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\logic;
use app\common\model\CompanyComplaintFeedback;
use app\common\logic\BaseLogic;
use think\facade\Db;
/**
* CompanyComplaintFeedback逻辑
* Class CompanyComplaintFeedbackLogic
* @package app\adminapi\logic
*/
class CompanyComplaintFeedbackLogic extends BaseLogic
{
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/09/23 15:08
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
CompanyComplaintFeedback::create([
'content' => $params['content'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/09/23 15:08
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
CompanyComplaintFeedback::where('id', $params['id'])->update([
'content' => $params['content'],
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2023/09/23 15:08
*/
public static function delete(array $params): bool
{
return CompanyComplaintFeedback::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2023/09/23 15:08
*/
public static function detail($params): array
{
return CompanyComplaintFeedback::findOrEmpty($params['id'])->toArray();
}
}

View File

@ -0,0 +1,96 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\adminapi\validate;
use app\common\validate\BaseValidate;
/**
* CompanyComplaintFeedback验证器
* Class CompanyComplaintFeedbackValidate
* @package app\adminapi\validate
*/
class CompanyComplaintFeedbackValidate extends BaseValidate
{
/**
* 设置校验规则
* @var string[]
*/
protected $rule = [
'id' => 'require',
'content' => 'require',
];
/**
* 参数描述
* @var string[]
*/
protected $field = [
'id' => 'id',
'content' => '内容',
];
/**
* @notes 添加场景
* @return CompanyComplaintFeedbackValidate
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function sceneAdd()
{
return $this->only(['content']);
}
/**
* @notes 编辑场景
* @return CompanyComplaintFeedbackValidate
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function sceneEdit()
{
return $this->only(['id','content']);
}
/**
* @notes 删除场景
* @return CompanyComplaintFeedbackValidate
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function sceneDelete()
{
return $this->only(['id']);
}
/**
* @notes 详情场景
* @return CompanyComplaintFeedbackValidate
* @author likeadmin
* @date 2023/09/23 15:08
*/
public function sceneDetail()
{
return $this->only(['id']);
}
}

View File

@ -0,0 +1,34 @@
<?php
// +----------------------------------------------------------------------
// | likeadmin快速开发前后端分离管理后台PHP版
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | gitee下载https://gitee.com/likeshop_gitee/likeadmin
// | github下载https://github.com/likeshop-github/likeadmin
// | 访问官网https://www.likeadmin.cn
// | likeadmin团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeadminTeam
// +----------------------------------------------------------------------
namespace app\common\model;
use app\common\model\BaseModel;
/**
* CompanyComplaintFeedback模型
* Class CompanyComplaintFeedback
* @package app\common\model
*/
class CompanyComplaintFeedback extends BaseModel
{
protected $name = 'company_complaint_feedback';
}