|
@@ -2,6 +2,9 @@
|
|
|
namespace App\JsonRpc;
|
|
|
use App\Model\District;
|
|
|
use App\Model\LevelUser;
|
|
|
+use App\Model\UserLevel;
|
|
|
+use App\Model\LetterOfComplaint;
|
|
|
+use App\Model\LetterType;
|
|
|
use Hyperf\RpcServer\Annotation\RpcService;
|
|
|
use App\Tools\Result;
|
|
|
#[RpcService(name: "PublicRpcService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
@@ -51,14 +54,14 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
$result = [];
|
|
|
if(isset($data['pageSize'])){
|
|
|
- $rep = LevelUser::where($where)->limit($data['pageSize'])->offset(($data['page']-1)*$data['pageSize'])->orderBy("id","asc")->get();
|
|
|
- $count = LevelUser::where($where)->count();
|
|
|
+ $rep = UserLevel::where($where)->limit($data['pageSize'])->offset(($data['page']-1)*$data['pageSize'])->orderBy("id","asc")->get();
|
|
|
+ $count = UserLevel::where($where)->count();
|
|
|
$result = [
|
|
|
'rows'=>$rep,
|
|
|
'count'=>$count
|
|
|
];
|
|
|
}else{
|
|
|
- $result = LevelUser::orderBy("id","asc")->get();
|
|
|
+ $result = UserLevel::orderBy("id","asc")->get();
|
|
|
}
|
|
|
return $result?Result::success($result):Result::error("没有查到数据");
|
|
|
}
|
|
@@ -102,4 +105,268 @@ class PublicRpcService implements PublicRpcServiceInterface
|
|
|
}
|
|
|
return Result::error("删除失败");
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询投诉举报信息
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getLetterOfComplaint(array $data=[]) :array{
|
|
|
+ $where = [];
|
|
|
+
|
|
|
+ if(isset($data['user_id']) && !empty($data['user_id'])){
|
|
|
+ array_push($where,['letter_of_complaint.user_id','=',$data['user_id']]);
|
|
|
+ }
|
|
|
+ if(isset($data['nature']) && !empty($data['nature'])){
|
|
|
+ array_push($where,['letter_of_complaint.nature','=',$data['nature']]);
|
|
|
+ }
|
|
|
+ if(isset($data['type']) && !empty($data['type'])){
|
|
|
+ array_push($where,['letter_of_complaint.type','=',$data['type']]);
|
|
|
+ }
|
|
|
+ if(isset($data['nature_level']) && !empty($data['nature_level'])){
|
|
|
+ array_push($where,['letter_of_complaint.nature_level','=',$data['nature_level']]);
|
|
|
+ }
|
|
|
+ if(isset($data['type_level']) && !empty($data['type_level'])){
|
|
|
+ array_push($where,['letter_of_complaint.type_level','=',$data['type_level']]);
|
|
|
+ }
|
|
|
+ if(isset($data['status']) && !empty($data['status'])){
|
|
|
+ array_push($where,['letter_of_complaint.status','=',$data['status']]);
|
|
|
+ }
|
|
|
+ $result = [];
|
|
|
+ if(isset($data['pageSize'])){
|
|
|
+ $rep = LetterOfComplaint::where($where)
|
|
|
+ ->leftJoin("letter_type as type_a","letter_of_complaint.nature","type_a.id")
|
|
|
+ ->leftJoin("letter_type as type_b","letter_of_complaint.type","type_b.id")
|
|
|
+ ->leftJoin("letter_type as type_c","letter_of_complaint.nature_level","type_c.id")
|
|
|
+ ->leftJoin("letter_type as type_d","letter_of_complaint.status","type_d.id")
|
|
|
+ ->leftJoin("letter_type as type_e","letter_of_complaint.type_level","type_e.id")
|
|
|
+ ->select("letter_of_complaint.*",
|
|
|
+ "type_a.type_name as nature_name",
|
|
|
+ "type_b.type_name as type_name",
|
|
|
+ "type_c.type_name as nature_level_name",
|
|
|
+ "type_d.type_name as status_name",
|
|
|
+ "type_e.type_name as type_level_name")
|
|
|
+ ->limit($data['pageSize'])->offset(($data['page']-1)*$data['pageSize'])->orderBy("letter_of_complaint.id","desc")->get();
|
|
|
+ $count = LetterOfComplaint::where($where)->count();
|
|
|
+ if($rep){
|
|
|
+ foreach ($rep as $val){
|
|
|
+ if($val['judgment']){
|
|
|
+ $val['judgment'] = json_decode( $val['judgment']);
|
|
|
+ }
|
|
|
+ if($val['audio_and_video']){
|
|
|
+ $val['audio_and_video'] = json_decode( $val['audio_and_video']);
|
|
|
+ }
|
|
|
+ if($val['contract']){
|
|
|
+ $val['contract'] = json_decode( $val['contract']);
|
|
|
+ }
|
|
|
+ if($val['qualifications']){
|
|
|
+ $val['qualifications'] = json_decode( $val['qualifications']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $result = [
|
|
|
+ 'rows'=>$rep,
|
|
|
+ 'count'=>$count
|
|
|
+ ];
|
|
|
+ }else{
|
|
|
+ $result = LetterOfComplaint::where($where)
|
|
|
+ ->leftJoin("letter_type as type_a","letter_of_complaint.nature","type_a.id")
|
|
|
+ ->leftJoin("letter_type as type_b","letter_of_complaint.type","type_b.id")
|
|
|
+ ->leftJoin("letter_type as type_c","letter_of_complaint.nature_level","type_c.id")
|
|
|
+ ->leftJoin("letter_type as type_d","letter_of_complaint.status","type_d.id")
|
|
|
+ ->leftJoin("letter_type as type_e","letter_of_complaint.type_level","type_e.id")
|
|
|
+ ->select("letter_of_complaint.*",
|
|
|
+ "type_a.type_name as nature_name",
|
|
|
+ "type_b.type_name as type_name",
|
|
|
+ "type_c.type_name as nature_level_name",
|
|
|
+ "type_d.type_name as status_name",
|
|
|
+ "type_e.type_name as type_level_name")
|
|
|
+ ->orderBy("letter_of_complaint.id","desc")->get();
|
|
|
+ }
|
|
|
+ return $result?Result::success($result):Result::error("没有查到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加投诉举报信息
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function addLetterOfComplaint(array $data) :array{
|
|
|
+ $data['judgment'] = $data['judgment']?json_encode($data['judgment']):'';
|
|
|
+ $data['audio_and_video'] = $data['audio_and_video']?json_encode($data['audio_and_video']):'';
|
|
|
+ $data['contract'] = $data['contract']?json_encode($data['contract']):'';
|
|
|
+ $data['qualifications'] = $data['qualifications']?json_encode($data['qualifications']):'';
|
|
|
+ unset($data['id']);
|
|
|
+ $result = LetterOfComplaint::insertGetId($data);
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("创建失败", 0);
|
|
|
+ } else {
|
|
|
+ return Result::success(["id" => $result]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 用户端更新投诉举报
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function userUpLetterOfComplaint(array $data) :array
|
|
|
+ {
|
|
|
+ $data['judgment'] = $data['judgment']?json_encode($data['judgment']):'';
|
|
|
+ $data['audio_and_video'] = $data['audio_and_video']?json_encode($data['audio_and_video']):'';
|
|
|
+ $data['contract'] = $data['contract']?json_encode($data['contract']):'';
|
|
|
+ $data['qualifications'] = $data['qualifications']?json_encode($data['qualifications']):'';
|
|
|
+ $result = LetterOfComplaint::where(['id'=>$data['id']])->update($data);
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("创建失败", 0);
|
|
|
+ } else {
|
|
|
+ return Result::success(["id" => $result]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 管理后台更新投诉举报信息
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function upLetterOfComplaint(array $data) :array{
|
|
|
+ var_dump("admin:",$data);
|
|
|
+ $where = [
|
|
|
+ 'id'=>$data['id']
|
|
|
+ ];
|
|
|
+
|
|
|
+ $filtered_array = array_filter($data, function($value) {
|
|
|
+ return $value !== "" && $value !== null && $value !== false && !is_array($value) || !empty($value);
|
|
|
+ });
|
|
|
+ $filtered_array['judgment'] = isset($filtered_array['judgment'])?json_encode($filtered_array['judgment']):'';
|
|
|
+ $filtered_array['audio_and_video'] = isset($filtered_array['audio_and_video'])?json_encode($filtered_array['audio_and_video']):'';
|
|
|
+ $filtered_array['contract'] = isset($filtered_array['contract'])?json_encode($filtered_array['contract']):'';
|
|
|
+ $filtered_array['qualifications'] = isset($filtered_array['qualifications'])?json_encode($filtered_array['qualifications']):'';
|
|
|
+ unset($filtered_array['nature_name']);
|
|
|
+ unset($filtered_array['type_name']);
|
|
|
+ unset($filtered_array['nature_level_name']);
|
|
|
+ unset($filtered_array['status_name']);
|
|
|
+ unset($filtered_array['is_admin']);
|
|
|
+ unset($filtered_array['type_level_name']);
|
|
|
+ $result = LetterOfComplaint::where($where)->update($filtered_array);
|
|
|
+ if($result){
|
|
|
+ return Result::success( $result);
|
|
|
+ }
|
|
|
+ return Result::error("更新失败", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询投诉举报记录
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getLetterOfComplaintInfo(array $data) :array{
|
|
|
+ $where = [
|
|
|
+ 'letter_of_complaint.id'=>$data['id'],
|
|
|
+ ];
|
|
|
+ if(isset($data['user_id']) && !empty($data['user_id'])){
|
|
|
+ array_push($where,['letter_of_complaint.user_id','=',$data['user_id']]);
|
|
|
+ }
|
|
|
+ $result = LetterOfComplaint::where($where)
|
|
|
+ ->leftJoin("letter_type as type_a","letter_of_complaint.nature","type_a.id")
|
|
|
+ ->leftJoin("letter_type as type_b","letter_of_complaint.type","type_b.id")
|
|
|
+ ->leftJoin("letter_type as type_c","letter_of_complaint.nature_level","type_c.id")
|
|
|
+ ->leftJoin("letter_type as type_d","letter_of_complaint.status","type_d.id")
|
|
|
+ ->leftJoin("letter_type as type_e","letter_of_complaint.type_level","type_e.id")
|
|
|
+ ->select("letter_of_complaint.*",
|
|
|
+ "type_a.type_name as nature_name",
|
|
|
+ "type_b.type_name as type_name",
|
|
|
+ "type_c.type_name as nature_level_name",
|
|
|
+ "type_d.type_name as status_name",
|
|
|
+ "type_e.type_name as type_level_name")
|
|
|
+ ->first();
|
|
|
+ return Result::success( $result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除投诉举报信息
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function delLetterOfComplaint(array $data) :array{
|
|
|
+ $where = [
|
|
|
+ 'id'=> $data['id'],
|
|
|
+ 'user_id'=>$data['user_id']
|
|
|
+ ];
|
|
|
+ $result = LetterOfComplaint::where($where)->delete();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("删除失败", 0);
|
|
|
+ } else {
|
|
|
+ return Result::success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 获取举报信息类型
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getLetterType(array $data) :array{
|
|
|
+ $where = [];
|
|
|
+ if(isset($data['type'])){
|
|
|
+ array_push($where,['type','=',$data['type']]);
|
|
|
+ }
|
|
|
+ $result = LetterType::where($where)->get();
|
|
|
+ return $result?Result::success($result):Result::error("没有查到数据");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新举报类型
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function upLetterType(array $data) :array{
|
|
|
+ return [];
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加举报类型
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function addLetterType(array $data) :array{
|
|
|
+ $result = LetterType::insertGetId($data);
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("创建失败", 0);
|
|
|
+ } else {
|
|
|
+ return Result::success(["id" => $result]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除举报类型
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function delLetterType(array $data) :array{
|
|
|
+ $result = LetterType::where('id', $data['id'])->delete();
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("删除失败", 0);
|
|
|
+ } else {
|
|
|
+ return Result::success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检测是否已经被接案
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function checkMeasure(array $data) :array{
|
|
|
+ $where = [
|
|
|
+ 'id'=>$data['id']
|
|
|
+ ];
|
|
|
+ $letterOfComplaintInfo = LetterOfComplaint::where($where)->first();
|
|
|
+ var_dump("查询数据:",$letterOfComplaintInfo['admin_id'],$data['user_id']);
|
|
|
+ //操作人和当前登陆用户id 相等说明是当前人接收的案件
|
|
|
+ if(($letterOfComplaintInfo['admin_id'] == $data['user_id']) || empty($letterOfComplaintInfo['admin_id'])){
|
|
|
+ return Result::success();
|
|
|
+ }else{
|
|
|
+ return Result::error("您不能处理其他人已经接过的案件", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|