|
@@ -64,7 +64,8 @@ use Illuminate\Support\Facades\Cache;
|
|
|
|
|
|
use App\Model\Company;
|
|
|
use Hyperf\Paginator\Paginator;
|
|
|
-use App\Model\Project;
|
|
|
+use App\Model\Project;
|
|
|
+
|
|
|
#[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
|
|
|
class NewsService implements NewsServiceInterface
|
|
|
{
|
|
@@ -1071,11 +1072,18 @@ class NewsService implements NewsServiceInterface
|
|
|
$query->whereRaw("JSON_CONTAINS(ignore_ids, '" . intval($data['website_id']) . "') = 0")
|
|
|
->orWhereNull("ignore_ids");
|
|
|
})
|
|
|
- ->select('article.*','article_data.content','article_data.article_id',
|
|
|
- 'article_extend.website_url','article_extend.email','article_extend.contacts',
|
|
|
- 'article_extend.contacts_mobile','article_extend.contacts_address','article_extend.zip_code',
|
|
|
- 'article_extend.enterprise_name'
|
|
|
- )
|
|
|
+ ->select(
|
|
|
+ 'article.*',
|
|
|
+ 'article_data.content',
|
|
|
+ 'article_data.article_id',
|
|
|
+ 'article_extend.website_url',
|
|
|
+ 'article_extend.email',
|
|
|
+ 'article_extend.contacts',
|
|
|
+ 'article_extend.contacts_mobile',
|
|
|
+ 'article_extend.contacts_address',
|
|
|
+ 'article_extend.zip_code',
|
|
|
+ 'article_extend.enterprise_name'
|
|
|
+ )
|
|
|
->first();
|
|
|
if (empty($result)) {
|
|
|
return Result::error("暂无此新闻!", 0);
|
|
@@ -3945,68 +3953,6 @@ class NewsService implements NewsServiceInterface
|
|
|
$user_id = json_encode($user_id);
|
|
|
$data['re_user_ids'] = $user_id;
|
|
|
$result = Notice::insertGetId($data);
|
|
|
- if ($result && $data['is_group'] == 1) {
|
|
|
- //chat_group
|
|
|
- $group_id = PublicData::uuid();
|
|
|
- $groupData = [
|
|
|
- 'id' => $group_id,
|
|
|
- 'creator_id' => $data['user_id'],
|
|
|
- 'group_name' => $data['group_name'] ?? '',
|
|
|
- 'profile' => $data['profile'] ?? 0,
|
|
|
- ];
|
|
|
- var_dump($groupData, '-----------------groupData-------');
|
|
|
-
|
|
|
- $groupResult = ChatGroups::insertGetId($groupData);
|
|
|
- var_dump($groupResult, '-----------------groupid-------');
|
|
|
- $groupMemberData = [
|
|
|
- 'id' => PublicData::uuid(),
|
|
|
- 'user_id' => $data['user_id'],
|
|
|
- 'group_id' => $group_id,
|
|
|
- 'leader' => 2,
|
|
|
- ];
|
|
|
- $groupMemberResult = ChatGroupsMember::insertGetId($groupMemberData);
|
|
|
-
|
|
|
- //$chat_ids 去除掉$data['user_id']
|
|
|
- $chat_ids = array_diff($chat_ids, [$data['user_id']]);
|
|
|
- //插入群成员表
|
|
|
- $groupMemberDataUser = [];
|
|
|
- $chatData = [];
|
|
|
- foreach ($chat_ids as $key => $value) {
|
|
|
- $groupMemberDataUser[] = [
|
|
|
- 'id' => PublicData::uuid(),
|
|
|
- 'user_id' => $value,
|
|
|
- 'group_id' => $group_id,
|
|
|
- 'leader' => 1,
|
|
|
- ];
|
|
|
- $chatData[] = [
|
|
|
- 'user_id' => $value,
|
|
|
- 'msg_type' => 1,
|
|
|
- 'receiver_id' => $group_id,
|
|
|
- 'content' => '通过通知创建群聊',
|
|
|
- 'group_receiver_id' => $data['user_id'],
|
|
|
- 'action' => 'recieved',
|
|
|
- 'created_at' => date('Y-m-d H:i:s'),
|
|
|
- ];
|
|
|
- }
|
|
|
- var_dump($groupMemberDataUser, '-----------------groupMemberDataUser-------');
|
|
|
- ChatGroupsMember::insert($groupMemberDataUser);
|
|
|
- //插入一条管理员聊天记录
|
|
|
- $chatData[] = [
|
|
|
- 'user_id' => $data['user_id'],
|
|
|
- 'msg_type' => 1,
|
|
|
- 'receiver_id' => $group_id,
|
|
|
- 'content' => '通过通知创建群聊',
|
|
|
- 'group_receiver_id' => $data['user_id'],
|
|
|
- 'action' => 'said',
|
|
|
- 'created_at' => date('Y-m-d H:i:s'),
|
|
|
- ];
|
|
|
- var_dump($chatData, '-----------------chatData-------');
|
|
|
- $chatResult = ChatRecords::insert($chatData);
|
|
|
-
|
|
|
- //更新result的 group_id
|
|
|
- $data['group_id'] = $group_id;
|
|
|
- Notice::where(['id' => $result])->update($data);
|
|
|
- }
|
|
|
|
|
|
if (empty($result)) {
|
|
|
return Result::error("添加失败", 0);
|
|
@@ -4304,6 +4250,74 @@ class NewsService implements NewsServiceInterface
|
|
|
$type_id = $data['type_id'] ?? 0;
|
|
|
unset($data['user_id']);
|
|
|
unset($data['type_id']);
|
|
|
+ //查询公告
|
|
|
+ $notice = Notice::where('id', $data['id'])->first();
|
|
|
+ if (empty($notice)) {
|
|
|
+ return Result::error("公告不存在", 0);
|
|
|
+ }
|
|
|
+ //如果公告的状态是2,且是群聊公告,且状态是1,则创建群聊,第一次审核通过的时候处理成群聊
|
|
|
+ if ($data['status'] == 2 && $notice['is_group'] == 1 && $notice['status'] == 1 && empty($notice['group_id'])) {
|
|
|
+ //chat_group
|
|
|
+ $group_id = PublicData::uuid();
|
|
|
+ $groupData = [
|
|
|
+ 'id' => $group_id,
|
|
|
+ 'creator_id' => $notice['user_id'],
|
|
|
+ 'group_name' => $notice['group_name'] ?? '',
|
|
|
+ 'profile' => $notice['profile'] ?? 0,
|
|
|
+ ];
|
|
|
+ var_dump($groupData, '-----------------groupData-------');
|
|
|
+
|
|
|
+ $groupResult = ChatGroups::insertGetId($groupData);
|
|
|
+ var_dump($groupResult, '-----------------groupid-------');
|
|
|
+ $groupMemberData = [
|
|
|
+ 'id' => PublicData::uuid(),
|
|
|
+ 'user_id' => $notice['user_id'],
|
|
|
+ 'group_id' => $group_id,
|
|
|
+ 'leader' => 2,
|
|
|
+ ];
|
|
|
+ $groupMemberResult = ChatGroupsMember::insertGetId($groupMemberData);
|
|
|
+ //$chat_ids 去除掉$data['user_id']
|
|
|
+ $chat_ids = json_decode($notice['re_user_ids'], true);
|
|
|
+ $chat_ids = array_diff($chat_ids, [$notice['user_id']]);
|
|
|
+ //插入群成员表
|
|
|
+ $groupMemberDataUser = [];
|
|
|
+ $chatData = [];
|
|
|
+ foreach ($chat_ids as $key => $value) {
|
|
|
+ $groupMemberDataUser[] = [
|
|
|
+ 'id' => PublicData::uuid(),
|
|
|
+ 'user_id' => $value,
|
|
|
+ 'group_id' => $group_id,
|
|
|
+ 'leader' => 1,
|
|
|
+ ];
|
|
|
+ $chatData[] = [
|
|
|
+ 'user_id' => $value,
|
|
|
+ 'msg_type' => 1,
|
|
|
+ 'receiver_id' => $group_id,
|
|
|
+ 'content' => '通过通知创建群聊',
|
|
|
+ 'group_receiver_id' => $notice['user_id'],
|
|
|
+ 'action' => 'recieved',
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ var_dump($groupMemberDataUser, '-----------------groupMemberDataUser-------');
|
|
|
+ ChatGroupsMember::insert($groupMemberDataUser);
|
|
|
+ //插入一条管理员聊天记录
|
|
|
+ $chatData[] = [
|
|
|
+ 'user_id' => $notice['user_id'],
|
|
|
+ 'msg_type' => 1,
|
|
|
+ 'receiver_id' => $group_id,
|
|
|
+ 'content' => '通过通知创建群聊',
|
|
|
+ 'group_receiver_id' => $notice['user_id'],
|
|
|
+ 'action' => 'said',
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
+ ];
|
|
|
+ var_dump($chatData, '-----------------chatData-------');
|
|
|
+ $chatResult = ChatRecords::insert($chatData);
|
|
|
+
|
|
|
+ //更新result的 group_id
|
|
|
+ $data['group_id'] = $group_id;
|
|
|
+ Notice::where(['id' => $data['id']])->update($data);
|
|
|
+ }
|
|
|
$result = Notice::where('id', $data['id'])->update($data);
|
|
|
return Result::success($result);
|
|
|
}
|
|
@@ -5722,58 +5736,58 @@ class NewsService implements NewsServiceInterface
|
|
|
* @return array
|
|
|
*/
|
|
|
public function getCompanyList(array $data): array
|
|
|
- {
|
|
|
- // return Result::success($data);
|
|
|
- $where = [];
|
|
|
- $user = User::where('id', $data['user_id'])->first();
|
|
|
- if(empty($user)){
|
|
|
- return Result::error('用户不存在!');
|
|
|
- }
|
|
|
- if($user['type_id']!= 10000){
|
|
|
- $where['user_id'] = $data['user_id'];
|
|
|
- }
|
|
|
- if(isset($data['title']) && !empty($data['title'])){
|
|
|
- array_push($where, ['company.title', 'like', '%'. $data['title']. '%']);
|
|
|
- }
|
|
|
- if(isset($data['website_id']) && !empty($data['website_id'])){
|
|
|
- array_push($where, ['website.id', $data['website_id']]);
|
|
|
- }
|
|
|
- if(isset($data['ischeck']) && !empty($data['ischeck'])){
|
|
|
- if($data['ischeck'] == 1){
|
|
|
- if(isset($data['status']) && $data['status'] != ''){
|
|
|
- array_push($where, ['company.status', $data['status']]);
|
|
|
- $query = Company::where($where);
|
|
|
- }else{
|
|
|
- $query = Company::whereIn('company.status', [0,2]);
|
|
|
- }
|
|
|
- }else{
|
|
|
- $query = Company::where('company.status', 1);
|
|
|
- }
|
|
|
+ {
|
|
|
+ // return Result::success($data);
|
|
|
+ $where = [];
|
|
|
+ $user = User::where('id', $data['user_id'])->first();
|
|
|
+ if (empty($user)) {
|
|
|
+ return Result::error('用户不存在!');
|
|
|
+ }
|
|
|
+ if ($user['type_id'] != 10000) {
|
|
|
+ $where['user_id'] = $data['user_id'];
|
|
|
+ }
|
|
|
+ if (isset($data['title']) && !empty($data['title'])) {
|
|
|
+ array_push($where, ['company.title', 'like', '%' . $data['title'] . '%']);
|
|
|
+ }
|
|
|
+ if (isset($data['website_id']) && !empty($data['website_id'])) {
|
|
|
+ array_push($where, ['website.id', $data['website_id']]);
|
|
|
+ }
|
|
|
+ if (isset($data['ischeck']) && !empty($data['ischeck'])) {
|
|
|
+ if ($data['ischeck'] == 1) {
|
|
|
+ if (isset($data['status']) && $data['status'] != '') {
|
|
|
+ array_push($where, ['company.status', $data['status']]);
|
|
|
+ $query = Company::where($where);
|
|
|
+ } else {
|
|
|
+ $query = Company::whereIn('company.status', [0, 2]);
|
|
|
}
|
|
|
- $result = $query->where($where)
|
|
|
- ->leftJoin('website_category', function ($query) {
|
|
|
- $query->on('website_category.category_id', '=', 'company.category_id')
|
|
|
- ->on('website_category.website_id', '=', 'company.website_id');
|
|
|
- })
|
|
|
- ->leftJoin('website', 'company.website_id', '=', 'website.id')
|
|
|
- ->select(
|
|
|
- 'company.id',
|
|
|
- 'company.title',
|
|
|
- 'company.website_id',
|
|
|
- 'company.category_id',
|
|
|
- 'website.website_name',
|
|
|
- 'website_category.alias as category_name',
|
|
|
- 'company.status',
|
|
|
- 'company.updated_at',
|
|
|
- )
|
|
|
- ->orderBy('company.updated_at', 'desc')
|
|
|
- ->paginate($data['pageSize'], ['*'], 'page', $data['page']);
|
|
|
-
|
|
|
- if($result->isEmpty()){
|
|
|
- return Result::error("暂无企业", 0);
|
|
|
+ } else {
|
|
|
+ $query = Company::where('company.status', 1);
|
|
|
}
|
|
|
- return Result::success($result);
|
|
|
}
|
|
|
+ $result = $query->where($where)
|
|
|
+ ->leftJoin('website_category', function ($query) {
|
|
|
+ $query->on('website_category.category_id', '=', 'company.category_id')
|
|
|
+ ->on('website_category.website_id', '=', 'company.website_id');
|
|
|
+ })
|
|
|
+ ->leftJoin('website', 'company.website_id', '=', 'website.id')
|
|
|
+ ->select(
|
|
|
+ 'company.id',
|
|
|
+ 'company.title',
|
|
|
+ 'company.website_id',
|
|
|
+ 'company.category_id',
|
|
|
+ 'website.website_name',
|
|
|
+ 'website_category.alias as category_name',
|
|
|
+ 'company.status',
|
|
|
+ 'company.updated_at',
|
|
|
+ )
|
|
|
+ ->orderBy('company.updated_at', 'desc')
|
|
|
+ ->paginate($data['pageSize'], ['*'], 'page', $data['page']);
|
|
|
+
|
|
|
+ if ($result->isEmpty()) {
|
|
|
+ return Result::error("暂无企业", 0);
|
|
|
+ }
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
/**
|
|
|
* 添加企业
|
|
|
* @param array $data
|
|
@@ -5968,104 +5982,126 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
}
|
|
|
/**
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getWebsiteCompany(array $data): array
|
|
|
- {
|
|
|
- $categorys = json_decode($data['id'], true);
|
|
|
- $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
- $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
- $catiall = $category_arr['catiall'];
|
|
|
- foreach($categorys as $key => $value){
|
|
|
- if(array_key_exists('level',$value)){
|
|
|
- $parts = explode(',', $value['level']);
|
|
|
- $level = $parts[0] ?? null;
|
|
|
- $imgnum = $parts[1] ?? null;
|
|
|
- $textnum = $parts[2] ?? null;
|
|
|
- if(!empty($textnum) && $textnum > 0){
|
|
|
- $text_num = Company::where('level', $level)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->select('company.id','company.title','company.description','company.updated_at',
|
|
|
- 'company.category_id','company.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- if(!empty($imgnum) && $imgnum > 0){
|
|
|
- $img_num = Company::where('level', $level)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->where('imgurl','!=', '')
|
|
|
- ->whereNotNull('imgurl')
|
|
|
- ->select('company.id','company.title','company.description','company.updated_at',
|
|
|
- 'company.imgurl as imgs','company.category_id','company.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($imgnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if(array_key_exists('id',$value)){
|
|
|
- $parts = explode(',', $value['id']);
|
|
|
- $category_id = $parts[0] ?? null;
|
|
|
- $imgnum = $parts[1] ?? null;
|
|
|
- $textnum = $parts[2] ?? null;
|
|
|
- $category_arr = array_merge([$category_id], $cat_1st_arr[$category_id] ?? [0]);
|
|
|
- if(!empty($textnum) && $textnum > 0){
|
|
|
- $text_num = Company::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->select('company.id','company.title','company.description','company.updated_at',
|
|
|
- 'company.category_id','company.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- if(!empty($imgnum) && $imgnum > 0){
|
|
|
-
|
|
|
- $img_num = Company::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->where('imgurl','!=', '')
|
|
|
- ->whereNotNull('imgurl')
|
|
|
- ->select('company.id','company.title','company.description','company.updated_at',
|
|
|
- 'company.imgurl as imgs','company.category_id','company.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($imgnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- if(!empty($text_num)){
|
|
|
- foreach ($text_num as $k => $v) {
|
|
|
- $text_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
- $text_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
- }
|
|
|
- }
|
|
|
- if(!empty($img_num)){
|
|
|
- foreach ($img_num as $k => $v) {
|
|
|
- $img_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
- $imgurl = json_decode($v['imgs'], true);
|
|
|
- if(!empty($imgurl)){
|
|
|
- $img_num[$k]->imgurl = $imgurl[0];
|
|
|
- }
|
|
|
- $img_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- $company[$key]['img_num'] = $img_num ?? [];
|
|
|
- $company[$key]['text_num'] = $text_num ?? [];
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteCompany(array $data): array
|
|
|
+ {
|
|
|
+ $categorys = json_decode($data['id'], true);
|
|
|
+ $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
+ $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
+ $catiall = $category_arr['catiall'];
|
|
|
+ foreach ($categorys as $key => $value) {
|
|
|
+ if (array_key_exists('level', $value)) {
|
|
|
+ $parts = explode(',', $value['level']);
|
|
|
+ $level = $parts[0] ?? null;
|
|
|
+ $imgnum = $parts[1] ?? null;
|
|
|
+ $textnum = $parts[2] ?? null;
|
|
|
+ if (!empty($textnum) && $textnum > 0) {
|
|
|
+ $text_num = Company::where('level', $level)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->select(
|
|
|
+ 'company.id',
|
|
|
+ 'company.title',
|
|
|
+ 'company.description',
|
|
|
+ 'company.updated_at',
|
|
|
+ 'company.category_id',
|
|
|
+ 'company.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($textnum)
|
|
|
+ ->get()->all();
|
|
|
}
|
|
|
-
|
|
|
- if(empty($company)){
|
|
|
- return Result::error("暂无相关企业信息", 0);
|
|
|
+ if (!empty($imgnum) && $imgnum > 0) {
|
|
|
+ $img_num = Company::where('level', $level)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->whereNotNull('imgurl')
|
|
|
+ ->select(
|
|
|
+ 'company.id',
|
|
|
+ 'company.title',
|
|
|
+ 'company.description',
|
|
|
+ 'company.updated_at',
|
|
|
+ 'company.imgurl as imgs',
|
|
|
+ 'company.category_id',
|
|
|
+ 'company.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($imgnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (array_key_exists('id', $value)) {
|
|
|
+ $parts = explode(',', $value['id']);
|
|
|
+ $category_id = $parts[0] ?? null;
|
|
|
+ $imgnum = $parts[1] ?? null;
|
|
|
+ $textnum = $parts[2] ?? null;
|
|
|
+ $category_arr = array_merge([$category_id], $cat_1st_arr[$category_id] ?? [0]);
|
|
|
+ if (!empty($textnum) && $textnum > 0) {
|
|
|
+ $text_num = Company::whereIn('category_id', $category_arr)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->select(
|
|
|
+ 'company.id',
|
|
|
+ 'company.title',
|
|
|
+ 'company.description',
|
|
|
+ 'company.updated_at',
|
|
|
+ 'company.category_id',
|
|
|
+ 'company.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($textnum)
|
|
|
+ ->get()->all();
|
|
|
}
|
|
|
+ if (!empty($imgnum) && $imgnum > 0) {
|
|
|
+
|
|
|
+ $img_num = Company::whereIn('category_id', $category_arr)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->whereNotNull('imgurl')
|
|
|
+ ->select(
|
|
|
+ 'company.id',
|
|
|
+ 'company.title',
|
|
|
+ 'company.description',
|
|
|
+ 'company.updated_at',
|
|
|
+ 'company.imgurl as imgs',
|
|
|
+ 'company.category_id',
|
|
|
+ 'company.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($imgnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($text_num)) {
|
|
|
+ foreach ($text_num as $k => $v) {
|
|
|
+ $text_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
+ $text_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!empty($img_num)) {
|
|
|
+ foreach ($img_num as $k => $v) {
|
|
|
+ $img_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
+ $imgurl = json_decode($v['imgs'], true);
|
|
|
+ if (!empty($imgurl)) {
|
|
|
+ $img_num[$k]->imgurl = $imgurl[0];
|
|
|
+ }
|
|
|
+ $img_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $company[$key]['img_num'] = $img_num ?? [];
|
|
|
+ $company[$key]['text_num'] = $text_num ?? [];
|
|
|
+ }
|
|
|
|
|
|
- return Result::success($company);
|
|
|
+ if (empty($company)) {
|
|
|
+ return Result::error("暂无相关企业信息", 0);
|
|
|
}
|
|
|
+
|
|
|
+ return Result::success($company);
|
|
|
+ }
|
|
|
/**
|
|
|
* @param array $data
|
|
|
* @return array
|
|
@@ -6082,7 +6118,7 @@ class NewsService implements NewsServiceInterface
|
|
|
}
|
|
|
$query = Company::where($where);
|
|
|
$company = $this->processArticle(
|
|
|
- $query->select('id', 'title', 'introduce', 'description', 'content', 'category_id', 'cat_arr_id','updated_at')
|
|
|
+ $query->select('id', 'title', 'introduce', 'description', 'content', 'category_id', 'cat_arr_id', 'updated_at')
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
->limit($data['pageSize'])
|
|
@@ -6183,23 +6219,23 @@ class NewsService implements NewsServiceInterface
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
if ($data['description'] == '') {
|
|
|
- //提取内容中的描述
|
|
|
- // var_dump(11111);
|
|
|
- //提取内容中的描述
|
|
|
- $content = $data['introduce'];
|
|
|
- // 去除 <style> 和 <script> 标签及其内容
|
|
|
- $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
- // 去除所有 HTML 标签
|
|
|
- $content = strip_tags($content);
|
|
|
- // 去除 HTML 实体
|
|
|
- $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
- // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
- $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
- // 去除多余空白
|
|
|
- $content = preg_replace('/\s+/u', '', $content);
|
|
|
- // 截取 100 个字符
|
|
|
- $data['description'] = mb_substr($content, 0, 100);
|
|
|
- // 过滤 HTML 标签并去除空格,然后截取前 100 个字符
|
|
|
+ //提取内容中的描述
|
|
|
+ // var_dump(11111);
|
|
|
+ //提取内容中的描述
|
|
|
+ $content = $data['introduce'];
|
|
|
+ // 去除 <style> 和 <script> 标签及其内容
|
|
|
+ $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
+ // 去除所有 HTML 标签
|
|
|
+ $content = strip_tags($content);
|
|
|
+ // 去除 HTML 实体
|
|
|
+ $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
+ // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
+ $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
+ // 去除多余空白
|
|
|
+ $content = preg_replace('/\s+/u', '', $content);
|
|
|
+ // 截取 100 个字符
|
|
|
+ $data['description'] = mb_substr($content, 0, 100);
|
|
|
+ // 过滤 HTML 标签并去除空格,然后截取前 100 个字符
|
|
|
}
|
|
|
$project = Project::insertGetId($data);
|
|
|
if (empty($project)) {
|
|
@@ -6241,23 +6277,23 @@ class NewsService implements NewsServiceInterface
|
|
|
$data['keyword'] = implode(',', $segList1);
|
|
|
}
|
|
|
if ($data['description'] == '') {
|
|
|
- //提取内容中的描述
|
|
|
- // var_dump(11111);
|
|
|
- //提取内容中的描述
|
|
|
- $content = $data['introduce'];
|
|
|
- // 去除 <style> 和 <script> 标签及其内容
|
|
|
- $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
- // 去除所有 HTML 标签
|
|
|
- $content = strip_tags($content);
|
|
|
- // 去除 HTML 实体
|
|
|
- $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
- // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
- $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
- // 去除多余空白
|
|
|
- $content = preg_replace('/\s+/u', '', $content);
|
|
|
- // 截取 100 个字符
|
|
|
- $data['description'] = mb_substr($content, 0, 100);
|
|
|
- // 过滤 HTML 标签并去除空格,然后截取前 100 个字符
|
|
|
+ //提取内容中的描述
|
|
|
+ // var_dump(11111);
|
|
|
+ //提取内容中的描述
|
|
|
+ $content = $data['introduce'];
|
|
|
+ // 去除 <style> 和 <script> 标签及其内容
|
|
|
+ $content = preg_replace('/<(style|script)[^>]*>.*?<\/\1>/is', '', $content);
|
|
|
+ // 去除所有 HTML 标签
|
|
|
+ $content = strip_tags($content);
|
|
|
+ // 去除 HTML 实体
|
|
|
+ $content = html_entity_decode($content, ENT_QUOTES | ENT_HTML5, 'UTF-8');
|
|
|
+ // 只保留文本和标点符号(去除所有字母数字以外的特殊符号,可根据需要调整正则)
|
|
|
+ $content = preg_replace('/[^\p{L}\p{N}\p{P}\p{Zs}]+/u', '', $content);
|
|
|
+ // 去除多余空白
|
|
|
+ $content = preg_replace('/\s+/u', '', $content);
|
|
|
+ // 截取 100 个字符
|
|
|
+ $data['description'] = mb_substr($content, 0, 100);
|
|
|
+ // 过滤 HTML 标签并去除空格,然后截取前 100 个字符
|
|
|
}
|
|
|
$result = Project::where('id', $id)->update($data);
|
|
|
if (empty($result)) {
|
|
@@ -6335,56 +6371,56 @@ class NewsService implements NewsServiceInterface
|
|
|
|
|
|
public function getWebsiteCompanyInfo(array $data): array
|
|
|
{
|
|
|
- $company = Company::where('id', $data['id'])
|
|
|
- ->leftJoin('job_industry','job_industry.hyid','company.hy_id')
|
|
|
- ->where('status', 1)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
- ->select('company.*','job_industry.hyname as hy_name')
|
|
|
- ->first();
|
|
|
- // 企业性质:0:市场监管;1:信访纪检;2:公检法司;3:高关注机构
|
|
|
-
|
|
|
- switch($company->jobnature_id){
|
|
|
- case null:
|
|
|
- $company->jobnature_name = '';
|
|
|
- break;
|
|
|
- case 0:
|
|
|
- $company->jobnature_name = '市场监督';
|
|
|
- break;
|
|
|
- case 1:
|
|
|
- $company->jobnature_name = '信访纪检';
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- $company->jobnature_name = '公检法司';
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- $company->jobnature_name = '高关注机构';
|
|
|
- break;
|
|
|
- default:
|
|
|
- $company->jobnature_name = '';
|
|
|
- break;
|
|
|
- }
|
|
|
- $city_arr = $company->city_arr_id;
|
|
|
- if(!empty($city_arr)){
|
|
|
- $city_arr = json_decode($city_arr, true);
|
|
|
- $cityNames = District::whereIn('id', $city_arr)
|
|
|
- ->pluck('name')
|
|
|
- ->implode('-');
|
|
|
- $company->city_name = $cityNames;
|
|
|
- }else{
|
|
|
- $company->city_name = '';
|
|
|
- }
|
|
|
- if(empty($company)){
|
|
|
- return Result::error("暂无相关公司信息", 0);
|
|
|
- }
|
|
|
- return Result::success($company);
|
|
|
+ $company = Company::where('id', $data['id'])
|
|
|
+ ->leftJoin('job_industry', 'job_industry.hyid', 'company.hy_id')
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->select('company.*', 'job_industry.hyname as hy_name')
|
|
|
+ ->first();
|
|
|
+ // 企业性质:0:市场监管;1:信访纪检;2:公检法司;3:高关注机构
|
|
|
+
|
|
|
+ switch ($company->jobnature_id) {
|
|
|
+ case null:
|
|
|
+ $company->jobnature_name = '';
|
|
|
+ break;
|
|
|
+ case 0:
|
|
|
+ $company->jobnature_name = '市场监督';
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ $company->jobnature_name = '信访纪检';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $company->jobnature_name = '公检法司';
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $company->jobnature_name = '高关注机构';
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ $company->jobnature_name = '';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ $city_arr = $company->city_arr_id;
|
|
|
+ if (!empty($city_arr)) {
|
|
|
+ $city_arr = json_decode($city_arr, true);
|
|
|
+ $cityNames = District::whereIn('id', $city_arr)
|
|
|
+ ->pluck('name')
|
|
|
+ ->implode('-');
|
|
|
+ $company->city_name = $cityNames;
|
|
|
+ } else {
|
|
|
+ $company->city_name = '';
|
|
|
}
|
|
|
+ if (empty($company)) {
|
|
|
+ return Result::error("暂无相关公司信息", 0);
|
|
|
+ }
|
|
|
+ return Result::success($company);
|
|
|
+ }
|
|
|
public function getMSG(array $data): array
|
|
|
{
|
|
|
$type_id = isset($data['type_id']) ? $data['type_id'] : 1;
|
|
|
// '1:个人会员 2:政务会员 3:企业会员 4:调研员 10000:管理员 20000:游客(小程序)
|
|
|
$user_id = isset($data['user_id']) ? $data['user_id'] : 0; //用户id
|
|
|
$result = [];
|
|
|
- if ($type_id == 1) {
|
|
|
+ if ($type_id == 1 or $type_id == 2 or $type_id == 3) {
|
|
|
//最近的5篇已审的文章
|
|
|
$apply_articale = Article::where('status', 1)
|
|
|
->where('admin_user_id', $user_id)
|
|
@@ -6475,7 +6511,7 @@ class NewsService implements NewsServiceInterface
|
|
|
'job_resume' => $job_resume,
|
|
|
'count' => $count,
|
|
|
];
|
|
|
- } elseif ($type_id == 2) {
|
|
|
+ } elseif ($type_id == 12) {
|
|
|
//最近的5篇已审的文章
|
|
|
$apply_articale = Article::where('status', 1)
|
|
|
->where('admin_user_id', $user_id)
|
|
@@ -6497,6 +6533,13 @@ class NewsService implements NewsServiceInterface
|
|
|
->where('user_id', $user_id)
|
|
|
->orderBy('updated_at', 'desc')
|
|
|
->limit(5)->get();
|
|
|
+ //获取5条用户的book
|
|
|
+ $book = Book::where('status', 2)
|
|
|
+ ->where('user_id', $user_id)
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit(5)->get();
|
|
|
+ //获取5条用户的求职
|
|
|
+ //获取5条用户的求职 1
|
|
|
//count($chat) + count($chat_group)
|
|
|
$count = count($apply_articale) + count($good);
|
|
|
$result = [
|
|
@@ -6504,9 +6547,10 @@ class NewsService implements NewsServiceInterface
|
|
|
'chat' => $chat,
|
|
|
'chat_group' => $chat_group,
|
|
|
'good' => $good,
|
|
|
+ 'book' => $book,
|
|
|
'count' => $count,
|
|
|
];
|
|
|
- } elseif ($type_id == 3) {
|
|
|
+ } elseif ($type_id == 13) {
|
|
|
//最近的5篇已审的文章
|
|
|
$apply_articale = Article::where('status', 1)
|
|
|
->where('admin_user_id', $user_id)
|
|
@@ -6644,262 +6688,313 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getWebsiteProject(array $data): array
|
|
|
- {
|
|
|
- $categorys = json_decode($data['id'], true);
|
|
|
- if(!empty($categorys)){
|
|
|
- $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
- $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
- $catiall = $category_arr['catiall'];
|
|
|
- // return Result::success($catiall);
|
|
|
- foreach($categorys as $key => $val){
|
|
|
- if(isset($val['level'][0]) && !empty($val['level'][0])){
|
|
|
- $level = explode(',', $val['level'])[0];
|
|
|
- $imgnum = explode(',', $val['level'])[1] ?? null;
|
|
|
- $textnum = explode(',', $val['level'])[2] ?? null;
|
|
|
- if($level == 1){
|
|
|
- if(!empty($textnum) && $textnum > 0){
|
|
|
- $text_num = Project::where('level', $level)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- if(!empty($imgnum) && $imgnum > 0){
|
|
|
- $img_num = Project::where('level', $level)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->where('imgurl','!=', '')
|
|
|
- ->whereNotNull('imgurl')
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.imgurl as imgs','project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($imgnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- }else{
|
|
|
- if(!empty($textnum) && $textnum > 0){
|
|
|
- $text_num = Project::where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.category_id','project.cat_arr_id','project.website_id','project.updated_at',
|
|
|
- 'project.created_at')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- if(!empty($imgnum) && $imgnum > 0){
|
|
|
- $img_num = Project::where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->where('imgurl','!=', '')
|
|
|
- ->whereNotNull('imgurl')
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.imgurl as imgs','project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($imgnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- if(isset($val['id'][0]) && !empty($val['id'][0])){
|
|
|
- $category_ids = explode(',', $val['id'])[0];
|
|
|
- $cat_imgnum = explode(',', $val['id'])[1] ?? null;
|
|
|
- $cat_textnum = explode(',', $val['id'])[2] ?? null;
|
|
|
- $category_arr = array_merge([$category_ids], $cat_1st_arr[$category_ids] ?? [0]);
|
|
|
- if(!empty($cat_textnum) && $cat_textnum > 0){
|
|
|
- $text_num = Project::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($cat_textnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- if(!empty($cat_imgnum) && $cat_imgnum > 0){
|
|
|
- $img_num = Project::whereIn('category_id', $category_arr)
|
|
|
- ->where('website_id',$data['website_id'])
|
|
|
- ->where('status',1)
|
|
|
- ->where('imgurl','!=', '')
|
|
|
- ->whereNotNull('imgurl')
|
|
|
- ->select('project.id','project.title','project.description','project.updated_at',
|
|
|
- 'project.imgurl as imgs','project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($cat_imgnum)
|
|
|
- ->get()->all();
|
|
|
- }
|
|
|
- }
|
|
|
- if(!empty($img_num)){
|
|
|
- foreach ($img_num as $k => $v) {
|
|
|
- $img_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
- $imgurl = json_decode($v['imgs'], true);
|
|
|
- if(!empty($imgurl)){
|
|
|
- $img_num[$k]->imgurl = $imgurl[0];
|
|
|
- }
|
|
|
- $img_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- if(!empty($text_num)){
|
|
|
- foreach ($text_num as $k => $v) {
|
|
|
- $text_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
- $text_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
- }
|
|
|
- }
|
|
|
- $project[$key]['img_num'] = $img_num ?? [];
|
|
|
- $project[$key]['text_num'] = $text_num ?? [];
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteProject(array $data): array
|
|
|
+ {
|
|
|
+ $categorys = json_decode($data['id'], true);
|
|
|
+ if (!empty($categorys)) {
|
|
|
+ $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
+ $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
+ $catiall = $category_arr['catiall'];
|
|
|
+ // return Result::success($catiall);
|
|
|
+ foreach ($categorys as $key => $val) {
|
|
|
+ if (isset($val['level'][0]) && !empty($val['level'][0])) {
|
|
|
+ $level = explode(',', $val['level'])[0];
|
|
|
+ $imgnum = explode(',', $val['level'])[1] ?? null;
|
|
|
+ $textnum = explode(',', $val['level'])[2] ?? null;
|
|
|
+ if ($level == 1) {
|
|
|
+ if (!empty($textnum) && $textnum > 0) {
|
|
|
+ $text_num = Project::where('level', $level)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($textnum)
|
|
|
+ ->get()->all();
|
|
|
}
|
|
|
+ if (!empty($imgnum) && $imgnum > 0) {
|
|
|
+ $img_num = Project::where('level', $level)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->whereNotNull('imgurl')
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.imgurl as imgs',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($imgnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (!empty($textnum) && $textnum > 0) {
|
|
|
+ $text_num = Project::where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id',
|
|
|
+ 'project.website_id',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.created_at'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($textnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ if (!empty($imgnum) && $imgnum > 0) {
|
|
|
+ $img_num = Project::where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->whereNotNull('imgurl')
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.imgurl as imgs',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($imgnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- if(empty($project)){
|
|
|
- return Result::error("暂无相关项目信息", 0);
|
|
|
+ if (isset($val['id'][0]) && !empty($val['id'][0])) {
|
|
|
+ $category_ids = explode(',', $val['id'])[0];
|
|
|
+ $cat_imgnum = explode(',', $val['id'])[1] ?? null;
|
|
|
+ $cat_textnum = explode(',', $val['id'])[2] ?? null;
|
|
|
+ $category_arr = array_merge([$category_ids], $cat_1st_arr[$category_ids] ?? [0]);
|
|
|
+ if (!empty($cat_textnum) && $cat_textnum > 0) {
|
|
|
+ $text_num = Project::whereIn('category_id', $category_arr)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($cat_textnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
+ if (!empty($cat_imgnum) && $cat_imgnum > 0) {
|
|
|
+ $img_num = Project::whereIn('category_id', $category_arr)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('imgurl', '!=', '')
|
|
|
+ ->whereNotNull('imgurl')
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.updated_at',
|
|
|
+ 'project.imgurl as imgs',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($cat_imgnum)
|
|
|
+ ->get()->all();
|
|
|
+ }
|
|
|
}
|
|
|
- return Result::success($project);
|
|
|
- }
|
|
|
- /**
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getWebsiteProjectInfo(array $data): array
|
|
|
- {
|
|
|
- $project = Project::where('id', $data['id'])
|
|
|
- ->where('status', 1)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
- ->select('project.*')
|
|
|
- ->first();
|
|
|
- if(empty($project)){
|
|
|
- return Result::error("暂无相关项目信息", 0);
|
|
|
+ if (!empty($img_num)) {
|
|
|
+ foreach ($img_num as $k => $v) {
|
|
|
+ $img_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
+ $imgurl = json_decode($v['imgs'], true);
|
|
|
+ if (!empty($imgurl)) {
|
|
|
+ $img_num[$k]->imgurl = $imgurl[0];
|
|
|
+ }
|
|
|
+ $img_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
+ }
|
|
|
}
|
|
|
- return Result::success($project);
|
|
|
+ if (!empty($text_num)) {
|
|
|
+ foreach ($text_num as $k => $v) {
|
|
|
+ $text_num[$k]->category_name = $catiall[$v->category_id]['alias'];
|
|
|
+ $text_num[$k]->pinyin = $catiall[$v->category_id]['pinyin'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $project[$key]['img_num'] = $img_num ?? [];
|
|
|
+ $project[$key]['text_num'] = $text_num ?? [];
|
|
|
+ }
|
|
|
}
|
|
|
- /**
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getWebsiteProjectList(array $data): array
|
|
|
- {
|
|
|
- $where = [];
|
|
|
- if(isset($data['category_id']) && !empty($data['category_id'])){
|
|
|
- $where['category_id'] = $data['category_id'];
|
|
|
+ if (empty($project)) {
|
|
|
+ return Result::error("暂无相关项目信息", 0);
|
|
|
+ }
|
|
|
+ return Result::success($project);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteProjectInfo(array $data): array
|
|
|
+ {
|
|
|
+ $project = Project::where('id', $data['id'])
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->select('project.*')
|
|
|
+ ->first();
|
|
|
+ if (empty($project)) {
|
|
|
+ return Result::error("暂无相关项目信息", 0);
|
|
|
+ }
|
|
|
+ return Result::success($project);
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteProjectList(array $data): array
|
|
|
+ {
|
|
|
+ $where = [];
|
|
|
+ if (isset($data['category_id']) && !empty($data['category_id'])) {
|
|
|
+ $where['category_id'] = $data['category_id'];
|
|
|
+ }
|
|
|
+ if (isset($data['keyword']) && !empty($data['keyword'])) {
|
|
|
+ $where[] = ['title', 'like', '%' . $data['keyword'] . '%'];
|
|
|
+ }
|
|
|
+ $query = Project::where($where)
|
|
|
+ ->where('status', 1)
|
|
|
+ ->where('website_id', $data['website_id'])
|
|
|
+ ->select(
|
|
|
+ 'project.id',
|
|
|
+ 'project.title',
|
|
|
+ 'project.description',
|
|
|
+ 'project.imgurl as imgs',
|
|
|
+ 'project.category_id',
|
|
|
+ 'project.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc');
|
|
|
+ $count = $query->count();
|
|
|
+ $project = $query->clone()
|
|
|
+ ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
+ ->limit($data['pageSize'])
|
|
|
+ ->get()->all();
|
|
|
+ if (empty($project)) {
|
|
|
+ return Result::error("暂无相关项目信息", 0);
|
|
|
+ }
|
|
|
+ $categorys = $this->processArticlePro($data['website_id']);
|
|
|
+ $catiall = $categorys['catiall'];
|
|
|
+ foreach ($project as $key => $val) {
|
|
|
+ $project[$key]->category_name = $catiall[$val->category_id]['alias'];
|
|
|
+ if (!empty($val['imgs'])) {
|
|
|
+ $imgurl = json_decode($val['imgs'], true);
|
|
|
+ if (!empty($imgurl)) {
|
|
|
+ $project[$key]->imgurl = $imgurl[0];
|
|
|
}
|
|
|
- if(isset($data['keyword']) && !empty($data['keyword'])){
|
|
|
- $where[] = ['title','like', '%' . $data['keyword'] . '%'];
|
|
|
+ } else {
|
|
|
+ $project[$key]->imgurl = '';
|
|
|
+ }
|
|
|
+
|
|
|
+ $project[$key]->pinyin = $catiall[$val->category_id]['pinyin'];
|
|
|
+ }
|
|
|
+ $result = [
|
|
|
+ 'rows' => $project,
|
|
|
+ 'count' => $count,
|
|
|
+ ];
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param array $data
|
|
|
+ * @return array
|
|
|
+ */
|
|
|
+ public function getWebsiteCategoryJob(array $data): array
|
|
|
+ {
|
|
|
+ $categorys = json_decode($data['id'], true);
|
|
|
+ if (!empty($categorys)) {
|
|
|
+ $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
+ $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
+ $catiall = $category_arr['catiall'];
|
|
|
+ foreach ($categorys as $key => $val) {
|
|
|
+ if (isset($val['id']) && !empty($val['id'])) {
|
|
|
+ $catid = explode(',', $val['id'])[0] ?? null;
|
|
|
+ $type = explode(',', $val['id'])[1] ?? null;
|
|
|
+ $textnum = explode(',', $val['id'])[2] ?? null;
|
|
|
}
|
|
|
- $query = Project::where($where)
|
|
|
- ->where('status', 1)
|
|
|
- ->where('website_id', $data['website_id'])
|
|
|
- ->select('project.id','project.title','project.description','project.imgurl as imgs',
|
|
|
- 'project.category_id','project.cat_arr_id')
|
|
|
- ->orderBy('updated_at', 'desc');
|
|
|
- $count = $query->count();
|
|
|
- $project = $query->clone()
|
|
|
- ->offset(($data['page'] - 1) * $data['pageSize'])
|
|
|
- ->limit($data['pageSize'])
|
|
|
+
|
|
|
+ // 4:招聘;5:求职;
|
|
|
+ if ($textnum > 0 && $type == 4 && !empty($catid)) {
|
|
|
+ // 状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;
|
|
|
+ $job = JobRecruiting::WhereRaw("JSON_CONTAINS(job_recruiting.cat_arr_id, '" . intval($catid) . "') = 1")
|
|
|
+ ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
+ ->where('job_recruiting.status', 1)
|
|
|
+ ->where('job_recruiting.website_id', $data['website_id'])
|
|
|
+ ->select(
|
|
|
+ 'job_recruiting.id',
|
|
|
+ 'job_recruiting.title',
|
|
|
+ 'job_company.business_name',
|
|
|
+ 'job_recruiting.updated_at',
|
|
|
+ 'job_recruiting.cat_arr_id'
|
|
|
+ )
|
|
|
+ ->orderBy('job_recruiting.updated_at', 'desc')
|
|
|
+
|
|
|
+ ->limit($textnum)
|
|
|
+ ->get()->all();
|
|
|
+ } else if ($textnum > 0 && $type == 5 && !empty($catid)) {
|
|
|
+ // 状态 审核状态,1待审核2已审核3已拒绝
|
|
|
+ $job = JobHunting::WhereRaw("JSON_CONTAINS(job_hunting.cat_arr_id, '" . intval($catid) . "') = 1")
|
|
|
+ ->leftJoin('job_position', 'job_hunting.job_name_get', '=', 'job_position.zwid')
|
|
|
+ ->where('job_hunting.status', 2)
|
|
|
+ ->where('job_hunting.website_id', $data['website_id'])
|
|
|
+ ->select(
|
|
|
+ 'job_hunting.id',
|
|
|
+ 'job_hunting.name',
|
|
|
+ 'job_hunting.catid',
|
|
|
+ 'job_position.zwname as job_name',
|
|
|
+ 'job_hunting.updated_at'
|
|
|
+ )
|
|
|
+ ->orderBy('updated_at', 'desc')
|
|
|
+ ->limit($textnum)
|
|
|
->get()->all();
|
|
|
- if(empty($project)){
|
|
|
- return Result::error("暂无相关项目信息", 0);
|
|
|
+ } else {
|
|
|
+ $job = [];
|
|
|
}
|
|
|
- $categorys = $this->processArticlePro($data['website_id']);
|
|
|
- $catiall = $categorys['catiall'];
|
|
|
- foreach($project as $key => $val){
|
|
|
- $project[$key]->category_name = $catiall[$val->category_id]['alias'];
|
|
|
- if(!empty($val['imgs'])){
|
|
|
- $imgurl = json_decode($val['imgs'], true);
|
|
|
- if(!empty($imgurl)){
|
|
|
- $project[$key]->imgurl = $imgurl[0];
|
|
|
- }
|
|
|
- }else{
|
|
|
- $project[$key]->imgurl = '';
|
|
|
+ // var_dump($catid.'222uuuuuuu'.$key);
|
|
|
+ if (!empty($job)) {
|
|
|
+ foreach ($job as $k => $value) {
|
|
|
+ if (isset($value->catid)) {
|
|
|
+ $catId = $value->catid;
|
|
|
+ } else if (isset($value->cat_arr_id)) {
|
|
|
+ $catArr = json_decode($value->cat_arr_id, true);
|
|
|
+ $catId = end($catArr);
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
}
|
|
|
-
|
|
|
- $project[$key]->pinyin = $catiall[$val->category_id]['pinyin'];
|
|
|
- }
|
|
|
- $result = [
|
|
|
- 'rows' => $project,
|
|
|
- 'count' => $count,
|
|
|
- ];
|
|
|
- return Result::success($result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getWebsiteCategoryJob(array $data): array
|
|
|
- {
|
|
|
- $categorys = json_decode($data['id'],true);
|
|
|
- if(!empty($categorys)){
|
|
|
- $category_arr = $this->processArticlePro($data['website_id']);
|
|
|
- $cat_1st_arr = $category_arr['cat_1st_arr'];
|
|
|
- $catiall = $category_arr['catiall'];
|
|
|
- foreach($categorys as $key => $val){
|
|
|
- if(isset($val['id']) && !empty($val['id'])){
|
|
|
- $catid = explode(',', $val['id'])[0] ?? null;
|
|
|
- $type = explode(',', $val['id'])[1] ?? null;
|
|
|
- $textnum = explode(',', $val['id'])[2] ?? null;
|
|
|
- }
|
|
|
-
|
|
|
- // 4:招聘;5:求职;
|
|
|
- if($textnum > 0 && $type == 4 && !empty($catid)){
|
|
|
- // 状态 0:待审核;1:已审核通过;(只有企业会员需要审核);2:已拒绝;
|
|
|
- $job = JobRecruiting::WhereRaw("JSON_CONTAINS(job_recruiting.cat_arr_id, '". intval($catid). "') = 1")
|
|
|
- ->leftJoin('job_company', 'job_recruiting.id', '=', 'job_company.job_id')
|
|
|
- ->where('job_recruiting.status', 1)
|
|
|
- ->where('job_recruiting.website_id', $data['website_id'])
|
|
|
- ->select('job_recruiting.id','job_recruiting.title',
|
|
|
- 'job_company.business_name',
|
|
|
- 'job_recruiting.updated_at','job_recruiting.cat_arr_id')
|
|
|
- ->orderBy('job_recruiting.updated_at', 'desc')
|
|
|
-
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
- }else if($textnum > 0 && $type == 5 && !empty($catid)){
|
|
|
- // 状态 审核状态,1待审核2已审核3已拒绝
|
|
|
- $job = JobHunting::WhereRaw("JSON_CONTAINS(job_hunting.cat_arr_id, '". intval($catid). "') = 1")
|
|
|
- ->leftJoin('job_position', 'job_hunting.job_name_get', '=', 'job_position.zwid')
|
|
|
- ->where('job_hunting.status', 2)
|
|
|
- ->where('job_hunting.website_id', $data['website_id'])
|
|
|
- ->select('job_hunting.id','job_hunting.name','job_hunting.catid'
|
|
|
- ,'job_position.zwname as job_name','job_hunting.updated_at')
|
|
|
- ->orderBy('updated_at', 'desc')
|
|
|
- ->limit($textnum)
|
|
|
- ->get()->all();
|
|
|
-
|
|
|
- }else{
|
|
|
- $job = [];
|
|
|
- }
|
|
|
- // var_dump($catid.'222uuuuuuu'.$key);
|
|
|
- if(!empty($job)){
|
|
|
- foreach($job as $k => $value){
|
|
|
- if (isset($value->catid)) {
|
|
|
- $catId = $value->catid;
|
|
|
- } else if (isset($value->cat_arr_id)) {
|
|
|
- $catArr = json_decode($value->cat_arr_id, true);
|
|
|
- $catId = end($catArr);
|
|
|
- } else {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (isset($catiall[$catId])) {
|
|
|
- $job[$k]->pinyin = $catiall[$catId]['pinyin'];
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- // var_dump($catid.'xxxxx'.$key);
|
|
|
- $result[$key] = $job ?? [];
|
|
|
-
|
|
|
+ if (isset($catiall[$catId])) {
|
|
|
+ $job[$k]->pinyin = $catiall[$catId]['pinyin'];
|
|
|
}
|
|
|
+ }
|
|
|
}
|
|
|
- if(empty($result)){
|
|
|
- return Result::error("暂无相关分类信息", 0);
|
|
|
- }
|
|
|
-
|
|
|
- return Result::success($result);
|
|
|
+ // var_dump($catid.'xxxxx'.$key);
|
|
|
+ $result[$key] = $job ?? [];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (empty($result)) {
|
|
|
+ return Result::error("暂无相关分类信息", 0);
|
|
|
}
|
|
|
|
|
|
+ return Result::success($result);
|
|
|
+ }
|
|
|
}
|