| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\controller;
- use app\BaseController;
- use think\facade\Db;
- //投诉反馈控制器
- class Feedback extends BaseController
- {
- protected $noNeedLogin = [];
- // 获取我的投诉与反馈
- public function getMyFeedback()
- {
- $user_id = $this->getUser()->user_id;
- if(!is_numeric($user_id)){
- $this->fail(500, '无法获取用户信息');
- }
- $data = Db::table('tb_feedback')->where('user_id')->select();
- $this->success('success', $data);
- }
- // 发起投诉与反馈
- public function submitFeedback()
- {
- $content = $this->request->post('content'); // 投诉建议正文
- $user_id = $this->getUser()->user_id;
- if(!is_numeric($user_id)||!$content){
- $this->fail(500, '参数校验错误!');
- }
- Db::table('tb_feedback')
- ->insert([
- 'user_id' => $user_id,
- 'content' => $content,
- 'create_at' => time()
- ]);
- $this->success('success', null);
- }
- // 获取我反馈的Bug
- public function getMyReportBug()
- {
- $user_id = $this->getUser()->user_id;
- if(!is_numeric($user_id)){
- $this->fail(500, '无法获取用户信息');
- }
- $data = Db::table('tb_user_bug')->where('user_id')->select();
- $this->success('success', $data);
- }
- // 发起Bug反馈
- public function reportBug()
- {
- $type = $this->request->post('type'); // 反馈类型 1单机游戏 2收费辅助
- $game_id = $this->request->post('game_id'); // 对应游戏ID
- $content = $this->request->post('content'); // Bug反馈正文(富文本)
- $content = html_entity_decode($content);
- $user_id = $this->getUser()->user_id;
- if(!is_numeric($type)||!is_numeric($game_id)||!is_numeric($user_id)||!$content){
- $this->fail(500, '参数校验错误!');
- }
- Db::table('tb_user_bug')
- ->insert([
- 'user_id' => $user_id,
- 'type' => $type,
- 'content' => $content,
- 'create_at' => time()
- ]);
- $this->success('success', null);
- }
- }
|