74 lines
2.0 KiB
PHP
74 lines
2.0 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ywxapp<admin@ywxapp.cn>
|
|
// +----------------------------------------------------------------------
|
|
namespace addon\wxchat\controller\api;
|
|
|
|
use think\facade\Db;
|
|
use think\facade\Request;
|
|
use ywxapp\controller\FrontendBase;
|
|
|
|
/**
|
|
* Feedback 类
|
|
*
|
|
* @author ywxapp <admin@ywxapp.cn>
|
|
*/
|
|
class Feedback extends FrontendBase
|
|
{
|
|
protected $noNeedLogin = [];
|
|
protected $noNeedVerify = ['*'];
|
|
|
|
|
|
protected function initialize()
|
|
{}
|
|
|
|
/**
|
|
* 提交意见反馈
|
|
* type: 1-功能建议 2-投诉举报 3-其他
|
|
*/
|
|
public function save()
|
|
{
|
|
$uid = $this->uid;
|
|
$content = trim((string) Request::post('content', ''));
|
|
$type = (int) Request::post('type', 1);
|
|
$contact = trim((string) Request::post('contact', ''));
|
|
|
|
if ($content === '') {
|
|
$this->error('反馈内容不能为空');
|
|
}
|
|
if (mb_strlen($content) > 500) {
|
|
$this->error('反馈内容过长(最多500字)');
|
|
}
|
|
|
|
Db::name('wxchat_feedback')->insert([
|
|
'uid' => $uid,
|
|
'type' => $type,
|
|
'content' => $content,
|
|
'contact' => $contact,
|
|
'status' => 0,
|
|
'create_at' => time(),
|
|
]);
|
|
|
|
$this->success([], '提交成功');
|
|
}
|
|
|
|
/**
|
|
* 我的反馈列表
|
|
*/
|
|
public function index()
|
|
{
|
|
$uid = $this->uid;
|
|
$list = Db::name('wxchat_feedback')
|
|
->where('uid', $uid)
|
|
->order('create_at', 'desc')
|
|
->limit(50)
|
|
->field('id,type,content,status,create_at')
|
|
->select();
|
|
$this->success(['list' => $list]);
|
|
}
|
|
}
|