46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
|
|
<?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);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|