|
@@ -5910,8 +5910,6 @@ class NewsService implements NewsServiceInterface
|
|
|
*/
|
|
|
public function upCompany(array $data): array
|
|
|
{
|
|
|
-
|
|
|
-
|
|
|
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);
|
|
@@ -5919,14 +5917,12 @@ class NewsService implements NewsServiceInterface
|
|
|
}else{
|
|
|
$data['cat_arr_id'] = '';
|
|
|
}
|
|
|
-
|
|
|
- // $data['cat_arr_id'] = isset($data['cat_arr_id']) ? json_encode($data['cat_arr_id']) : '';
|
|
|
if ($data['imgurl'] == '') {
|
|
|
//content中提取图片第一个图,正则提取
|
|
|
$reg = '/<img.*?src=[\"|\']?(.*?)[\"|\']?\s.*?>/i';
|
|
|
preg_match_all($reg, $data['content'], $matches);
|
|
|
if (isset($matches[1][0])) {
|
|
|
- //截取varchar240
|
|
|
+ //截取varchar
|
|
|
$data['imgurl'] = substr($matches[1][0], 0, 240);
|
|
|
}
|
|
|
}
|
|
@@ -5944,10 +5940,12 @@ class NewsService implements NewsServiceInterface
|
|
|
//提取内容中的描述
|
|
|
// var_dump(11111);
|
|
|
$data['introduce'] = mb_substr(str_replace(' ', '', strip_tags($data['content'])), 0, 100);
|
|
|
- // var_dump($data['introduce']);
|
|
|
}
|
|
|
- // return Result::success($data);
|
|
|
-
|
|
|
+ if(isset($data['level']) && $data['level'] != null){
|
|
|
+ $data['level'] = intval($data['level']);
|
|
|
+ }else{
|
|
|
+ $data['level'] = null;
|
|
|
+ }
|
|
|
$user = User::where('id', $data['user_id'])->first();
|
|
|
if(empty($user)){
|
|
|
return Result::error('用户不存在!');
|