You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
shipin/app/api/controller/v1/complaint/ComplaintController.php

57 lines
1.3 KiB

10 months ago
<?php
namespace app\api\controller\v1\complaint;
use app\Request;
use app\services\crud\UserComplaintServices;
class ComplaintController
{
protected $services = NUll;
public function __construct(UserComplaintServices $services)
{
$this->services = $services;
}
/**
* 投诉列表
*/
public function listComplaint(Request $request)
{
$uid = (int)$request->uid();
return app('json')->success($this->services->getCrudListIndex(['user_id', $uid]));
}
/**
* 投诉详情
*/
public function detailsComplaint(Request $request)
{
}
/**
* 添加投诉
*/
public function addComplaint(Request $request)
{
$data = $request->postMore([
['content', '']
]);
if (empty($data['content'])) {
return app('json')->fail(100100);
}
$user = $request->user()->toArray();
// echo '<pre>';
// var_dump($user);
// return false;
$data['school_id'] = $user['school_id'];
$data['user_id'] = $user['uid'];
$data['user_name'] = $user['real_name'];
$data['school_name'] = $this->services->getSchoolData($user['school_id'])['school_name'];
$this->services->crudSave($data);
return app('json')->success(100017);
}
}