|
|
@@ -9049,10 +9049,14 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function getMessageInfo(array $data): array
|
|
|
{
|
|
|
- $result = Message::where('id', $data['id'])->first();
|
|
|
+ $result = Message::where('message.id', $data['id'])
|
|
|
+ ->leftJoin('website_column', 'message.column_id', '=', 'website_column.id')
|
|
|
+ ->select('message.*', 'website_column.column_arr_id')
|
|
|
+ ->first();
|
|
|
if (empty($result)) {
|
|
|
return Result::error('留言不存在!');
|
|
|
}
|
|
|
+ $result['column_arr_id'] = json_decode($result['column_arr_id'] ?? [], true);
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
|
@@ -9065,6 +9069,10 @@ class NewsService implements NewsServiceInterface
|
|
|
$where = [];
|
|
|
if($data['is_master'] == 1){
|
|
|
$where['status'] = 1;
|
|
|
+ }else if($data['is_master'] == 2){
|
|
|
+ $where['status'] = 2;
|
|
|
+ }else if($data['is_master'] == 3){
|
|
|
+ $where['status'] = 0;
|
|
|
}
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
if (empty($user)) {
|
|
|
@@ -9093,4 +9101,29 @@ class NewsService implements NewsServiceInterface
|
|
|
];
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 网民留言-检查是否可编辑
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function checkMessageEdit(array $data): array
|
|
|
+ {
|
|
|
+ $message = Message::where('id', $data['id'])->first();
|
|
|
+ if (empty($message)) {
|
|
|
+ return Result::error('留言不存在!');
|
|
|
+ }
|
|
|
+
|
|
|
+ $web = Website::where('id', $data['website_id'])->first();
|
|
|
+ if (empty($web)) {
|
|
|
+ return Result::error('网站不存在!');
|
|
|
+ }
|
|
|
+ $column_arr = json_decode($web['website_column_arr_id'] ?? [], true);
|
|
|
+ if(empty($column_arr)){
|
|
|
+ return Result::error('该网站未关联任何属性!');
|
|
|
+ }
|
|
|
+ if(!in_array($message['column_id'], $column_arr)){
|
|
|
+ return Result::error('不可编辑');
|
|
|
+ }
|
|
|
+ return Result::success('可编辑');
|
|
|
+ }
|
|
|
}
|