|
@@ -5960,6 +5960,11 @@ class NewsService implements NewsServiceInterface
|
|
|
if($user['type_id']== 10000){
|
|
|
$data['status'] = 1;
|
|
|
}
|
|
|
+ if(isset($data['level']) && $data['level'] != null){
|
|
|
+ $data['level'] = intval($data['level']);
|
|
|
+ }else{
|
|
|
+ $data['level'] = null;
|
|
|
+ }
|
|
|
$result = Company::insertGetId($data);
|
|
|
if ($result) {
|
|
|
return Result::success($result);
|
|
@@ -5974,8 +5979,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);
|
|
@@ -5983,14 +5986,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);
|
|
|
}
|
|
|
}
|
|
@@ -6008,10 +6009,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('用户不存在!');
|