Files
yusheng-php/application/api/controller/Report.php

63 lines
2.0 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动态4公会
$content = input('content', '');//举报内容
$image = input('image', '');//举报图片,多个用英文逗号隔开
$from_id = input('from_id', '');//举报来源id
if($type_id == '' || $report_type == '' || $from_id == ''){
return V(0,"参数错误",null);
}
if($content == '' && $image == ''){
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);
}
//安卓日志提交
public function android_log_report(){
$log_name = input('log_name', '');
$log_url = input('log_url', '');
$user_id = $this->uid;
$data = [
'log_name' => $log_name,
'log_url' => $log_url,
'user_id' => $user_id,
'createtime' => time(),
];
$res = db::name('vs_android_log')->insert($data);
return V($res ? 1 : 0, $res ? "成功" : "失败", null);
}
}