Files
midi-php/application/api/controller/Report.php
2025-08-13 10:43:56 +08:00

46 lines
1.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use think\Db;
class Report extends BaseCom
{
//举报类型列表
public function report_type_list(){
$list = db::name('vs_user_inform_type')->where(['delete_time' => ['<',1]])->select();
foreach ($list as &$item) {
$item['createtime'] = date('Y-m-d H:i:s', $item['createtime']);
}
return V(1,"成功", $list);
}
//举报
public function report(){
// $user_id = input('user_id', '');//举报者
$type_id = input('type_id', '');//举报类型
$report_type = input('report_type', '');//1-用户2房间3动态
$content = input('content', '');//举报内容
$image = input('image', '');//举报图片,多个用英文逗号隔开
$from_id = input('from_id', '');//举报来源id
if($type_id == '' || $report_type == '' || $from_id == ''){
return V(0,"参数错误",null);
}
$data = [
'user_id' => $this->uid,
'type_id' => $type_id,
'report_type' => $report_type,
'content' => $content,
'image' => $image,
'from_id' => $from_id,
'createtime' => time(),
];
$res = db::name('vs_user_inform')->insert($data);
return V($res ? 1 : 0, $res ? "成功" : "失败", null);
}
}