|
@@ -5853,51 +5853,57 @@ class NewsService implements NewsServiceInterface
|
|
|
return Result::success($result);
|
|
|
}
|
|
|
/**
|
|
|
- * 企业管理
|
|
|
- * @param array $data
|
|
|
- * @return array
|
|
|
- */
|
|
|
- public function getCompanyList(array $data): array
|
|
|
- {
|
|
|
- $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']) && $data['title']) {
|
|
|
- array_push($where, ['company.title', 'like', '%' . $data['title'] . '%']);
|
|
|
- }
|
|
|
- if (isset($data['website_id']) && $data['website_id']) {
|
|
|
- $where['company.website_id'] = $data['website_id'];
|
|
|
- }
|
|
|
- if (isset($data['ischeck']) && !empty($data['ischeck'])) {
|
|
|
- if ($data['ischeck'] == 1) {
|
|
|
- $query = Company::whereIn('company.status', [0, 2]);
|
|
|
- } else {
|
|
|
- $query = Company::where('company.status', 1);
|
|
|
- }
|
|
|
- }
|
|
|
- $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']);
|
|
|
+ * 企业管理
|
|
|
+ * @param array $data
|
|
|
+ * @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_name']) && !empty($data['website_name'])){
|
|
|
+ array_push($where, ['website.website_name', 'like', '%'. $data['website_name']. '%']);
|
|
|
+ }
|
|
|
+ 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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $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);
|