正在显示
1 个修改的文件
包含
12 行增加
和
3 行删除
| @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; | @@ -12,6 +12,7 @@ use App\Http\Logic\Bside\User\UserLoginLogic; | ||
| 12 | use App\Models\Ai\AiBlog; | 12 | use App\Models\Ai\AiBlog; |
| 13 | use App\Models\Blog\Blog; | 13 | use App\Models\Blog\Blog; |
| 14 | use App\Models\Domain\DomainInfo; | 14 | use App\Models\Domain\DomainInfo; |
| 15 | +use App\Models\Industry\ProjectIndustryRelated; | ||
| 15 | use App\Models\Inquiry\InquiryRelateDomain; | 16 | use App\Models\Inquiry\InquiryRelateDomain; |
| 16 | use App\Models\Manage\ManageHr; | 17 | use App\Models\Manage\ManageHr; |
| 17 | use App\Models\News\News; | 18 | use App\Models\News\News; |
| @@ -47,12 +48,12 @@ class PrivateController extends BaseController | @@ -47,12 +48,12 @@ class PrivateController extends BaseController | ||
| 47 | public function optimizeProjectList(Request $request) | 48 | public function optimizeProjectList(Request $request) |
| 48 | { | 49 | { |
| 49 | $page_size = $request->input('page_size', 20); | 50 | $page_size = $request->input('page_size', 20); |
| 50 | - $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special', 'f.industry_name', 'gl_project.from_order_id']; | 51 | + $field = ['gl_project.id', 'gl_project.company', 'gl_project.is_upgrade', 'b.start_date', 'd.domain', 'b.special', 'gl_project.from_order_id'];// 'f.industry_name', |
| 51 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') | 52 | $result = Project::select($field)->leftJoin('gl_project_deploy_optimize as b', 'gl_project.id', '=', 'b.project_id') |
| 52 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') | 53 | ->leftJoin('gl_project_online_check as c', 'gl_project.id', '=', 'c.project_id') |
| 53 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') | 54 | ->leftJoin('gl_domain_info as d', 'gl_project.id', '=', 'd.project_id') |
| 54 | - ->leftJoin('gl_project_industry_related as e', 'gl_project.id', '=', 'e.project_id') | ||
| 55 | - ->leftJoin('gl_project_industry as f', 'e.industry_id', '=', 'f.id') | 55 | +// ->leftJoin('gl_project_industry_related as e', 'gl_project.id', '=', 'e.project_id') |
| 56 | +// ->leftJoin('gl_project_industry as f', 'e.industry_id', '=', 'f.id') | ||
| 56 | ->where('gl_project.type', Project::TYPE_TWO) | 57 | ->where('gl_project.type', Project::TYPE_TWO) |
| 57 | ->where('gl_project.project_type',Project::TYPE_ZERO) | 58 | ->where('gl_project.project_type',Project::TYPE_ZERO) |
| 58 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 | 59 | ->where('gl_project.extend_type', 0) // 是否续费是由extend_type字段控制 |
| @@ -62,6 +63,14 @@ class PrivateController extends BaseController | @@ -62,6 +63,14 @@ class PrivateController extends BaseController | ||
| 62 | }) | 63 | }) |
| 63 | ->paginate($page_size) | 64 | ->paginate($page_size) |
| 64 | ->toArray(); | 65 | ->toArray(); |
| 66 | + | ||
| 67 | + // 直接关联查询, 会出现数据错误 | ||
| 68 | + $project_ids = array_column($result['list'], 'id'); | ||
| 69 | + $industry = ProjectIndustryRelated::leftJoin('gl_project_industry', 'gl_project_industry_related.industry_id', '=', 'gl_project_industry.id')->whereIn('project_id', $project_ids)->pluck('industry_name', 'project_id')->toArray(); | ||
| 70 | + foreach ($result['list'] as &$val) { | ||
| 71 | + $val['industry_name'] = FALSE == empty($industry[$val['id']]) ? $industry[$val['id']] : ''; | ||
| 72 | + } | ||
| 73 | + | ||
| 65 | return $this->success($result); | 74 | return $this->success($result); |
| 66 | } | 75 | } |
| 67 | 76 |
-
请 注册 或 登录 后发表评论