|
@@ -5879,9 +5879,9 @@ class NewsService implements NewsServiceInterface
|
|
|
$segList1 = array_slice($segList, 0, 8);
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
- if ($data['introduce'] == '') {
|
|
|
+ if ($data['introduce'] == '' || empty($data['introduce'])) {
|
|
|
//提取内容中的描述
|
|
|
- $data['introduce'] = substr(str_replace(' ', '', strip_tags($data['content'])), 0, 100);
|
|
|
+ $data['introduce'] = mb_substr(str_replace(' ', '', strip_tags($data['content'])), 0, 100) ?? '';
|
|
|
}
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
if(empty($user)){
|
|
@@ -5904,10 +5904,12 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function upCompany(array $data): array
|
|
|
{
|
|
|
- $data['category_id'] = isset($data['cat_arr_id']) ? end($data['cat_arr_id']) : '';
|
|
|
+
|
|
|
+
|
|
|
if(isset($data['cat_arr_id']) &&!empty($data['cat_arr_id']) && is_array($data['cat_arr_id'])){
|
|
|
$car_arr_id = array_values(array_unique(array_map('intval', $data['cat_arr_id'])));
|
|
|
$data['cat_arr_id'] = json_encode($car_arr_id);
|
|
|
+ $data['category_id'] = isset($data['cat_arr_id']) ? end($car_arr_id) : '';
|
|
|
}else{
|
|
|
$data['cat_arr_id'] = '';
|
|
|
}
|
|
@@ -5933,9 +5935,13 @@ class NewsService implements NewsServiceInterface
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
if ($data['introduce'] == '') {
|
|
|
- //提取内容中的描述
|
|
|
- $data['introduce'] = substr(str_replace(' ', '', strip_tags($data['content'])), 0, 100);
|
|
|
+ //提取内容中的描述
|
|
|
+ // var_dump(11111);
|
|
|
+ $data['introduce'] = mb_substr(str_replace(' ', '', strip_tags($data['content'])), 0, 100);
|
|
|
+ // var_dump($data['introduce']);
|
|
|
}
|
|
|
+ // return Result::success($data);
|
|
|
+
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
if(empty($user)){
|
|
|
return Result::error('用户不存在!');
|