|
@@ -334,6 +334,7 @@ class NewsService implements NewsServiceInterface
|
|
|
var_dump($data, '----------12-----------1');
|
|
|
unset($data['user_type']);
|
|
|
unset($data['nav_add_pool_id']);
|
|
|
+ // unset($data['commend_id']);
|
|
|
// $data['cat_arr_id'] = is_string($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
|
Db::beginTransaction();
|
|
|
try {
|
|
@@ -457,6 +458,7 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
Db::commit();
|
|
|
return Result::success(['id' => $id]);
|
|
|
} catch (\Throwable $ex) {
|
|
@@ -925,6 +927,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'article.id' => $data['id'],
|
|
|
'article.status' => 1,
|
|
|
];
|
|
|
+
|
|
|
$result = Article::where($where)->leftJoin("article_data", "article.id", "article_data.article_id")
|
|
|
->where(function ($query) use ($data) {
|
|
|
$query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
@@ -1968,7 +1971,12 @@ class NewsService implements NewsServiceInterface
|
|
|
//20250324 通知,公告,消息
|
|
|
public function delNotice(array $data): array
|
|
|
{
|
|
|
- return Result::success();
|
|
|
+ $result = Notice::where('id', $data['id'])->delete();
|
|
|
+ if ($result) {
|
|
|
+ return Result::success();
|
|
|
+ } else {
|
|
|
+ return Result::error("删除失败", 0);
|
|
|
+ }
|
|
|
}
|
|
|
public function getNoticeInfo(array $data): array
|
|
|
{
|
|
@@ -2298,12 +2306,51 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
public function getComplaintList(array $data): array
|
|
|
{
|
|
|
- $result = Notice::where('status', 1)->get();
|
|
|
- return Result::success($result);
|
|
|
+
|
|
|
+ $type_id = isset($data['type_id']) ? $data['type_id'] : '';
|
|
|
+ unset($data['type_id']);
|
|
|
+ $user_id = isset($data['user_id']) ? $data['user_id'] : '';
|
|
|
+ $where = [];
|
|
|
+ if ($type_id != 10000) {
|
|
|
+ $where['user_id'] = $user_id;
|
|
|
+ }
|
|
|
+ if (!empty($data['title'])) {
|
|
|
+ $where['title'] = ['like', '%' . $data['title'] . '%'];
|
|
|
+ }
|
|
|
+ if (!empty($data['deal'])) {
|
|
|
+ $where['deal'] = ['=', $data['deal']];
|
|
|
+ }
|
|
|
+ if (!empty($data['status'])) {
|
|
|
+ $where['status'] = ['=', $data['status']];
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = Complaint::where($where)
|
|
|
+ ->when(!empty($data['sattus1']), function ($query) use ($data) {
|
|
|
+ $query->whereIn('status', [1, 3]); //1待审核2已审核3已拒绝
|
|
|
+ })
|
|
|
+ ->leftJoin('department', 'complaint.department_id', '=', 'department.id')
|
|
|
+ // ->leftJoin('user', 'complaint.user_id', '=', 'user.id')
|
|
|
+ ->leftJoin('district', 'district.id', '=', 'complaint.city_id')
|
|
|
+ ->select('complaint.*', 'department.name as department_name', 'district.name as cityname')
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->paginate($data['page_size'], ['*'], 'page', $data['page']);
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无投诉信息", 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 取出数据
|
|
|
+ $rows = $result->items();
|
|
|
+ $count = $result->total();
|
|
|
+
|
|
|
+ $responseData = [
|
|
|
+ 'rows' => $rows,
|
|
|
+ 'count' => $count,
|
|
|
+ ];
|
|
|
+ return Result::success($responseData);
|
|
|
}
|
|
|
public function getComplaintInfo(array $data): array
|
|
|
{
|
|
|
- $result = Notice::where('id', $data['id'])->first();
|
|
|
+ $result = Complaint::where('id', $data['id'])->first();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|
|
@@ -2311,22 +2358,27 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
public function addComplaint(array $data): array
|
|
|
{
|
|
|
- $result = Notice::create($data);
|
|
|
+ date_default_timezone_set('Asia/Shanghai');
|
|
|
+ $data['created_at'] = date('Y-m-d H:i:s');
|
|
|
+ $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
+ $result = Complaint::create($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function updateComplaint(array $data): array
|
|
|
{
|
|
|
- $result = Notice::where('id', $data['id'])->update($data);
|
|
|
+ date_default_timezone_set('Asia/Shanghai');
|
|
|
+ $data['updated_at'] = date('Y-m-d H:i:s');
|
|
|
+ $result = Complaint::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function deleteComplaint(array $data): array
|
|
|
{
|
|
|
- $result = Notice::where('id', $data['id'])->delete();
|
|
|
+ $result = Complaint::where('id', $data['id'])->delete();
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
public function getComplainInfo(array $data): array
|
|
|
{
|
|
|
- $result = Notice::where('id', $data['id'])->first();
|
|
|
+ $result = Complaint::where('id', $data['id'])->first();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("查询失败", 0);
|
|
|
}
|