From 865afaccf87c5f3f717ab0e2143af5959e4f1157 Mon Sep 17 00:00:00 2001 From: cody <648753004@qq.com> Date: Mon, 17 Nov 2025 17:46:26 +0800 Subject: [PATCH] update --- .../Controllers/Admin/OtherController.php | 33 ++++++++++++++++- app/Models/Article.php | 7 ++++ ...025_11_17_173017_create_articles_table.php | 35 +++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 app/Models/Article.php create mode 100644 database/migrations/2025_11_17_173017_create_articles_table.php diff --git a/app/Http/Controllers/Admin/OtherController.php b/app/Http/Controllers/Admin/OtherController.php index 8f0be69..8e2f07d 100755 --- a/app/Http/Controllers/Admin/OtherController.php +++ b/app/Http/Controllers/Admin/OtherController.php @@ -7,6 +7,7 @@ use App\Jobs\CancelAppointMeet; use App\Models\Admin; use App\Models\Appointment; use App\Models\AppointmentConfig; +use App\Models\Article; use App\Models\Calendar; use App\Models\CarparkLog; use App\Models\Company; @@ -15,6 +16,7 @@ use App\Models\CourseType; use App\Models\CustomFormField; use App\Models\Department; use App\Models\ParameterDetail; +use App\Models\SupplyDemand; use App\Models\User; use App\Repositories\DoorRepository; use App\Repositories\EntranceRepository; @@ -159,7 +161,36 @@ class OtherController extends CommonController })->where('is_schoolmate', 1)->count() ]; } - return $this->success(compact('courseTypes', 'schoolmate', 'suzhou', 'country')); + // 本月课程 + $monthCourses = Course::with('teacher')->where('start_date', 'like', '%' . date('Y-m') . '%')->get(); + // 投后企业 + $yuanhe['yh_invested_total'] = Company::where('is_yh_invested', 1)->count(); + // 元和员工参与企业 + $companyNameKeyword = ['元禾控股', '元禾原点', '元禾厚望', '元禾重元', '元禾璞华', '元禾谷风', '元禾绿柳', '元禾辰坤', '元禾沙湖', '禾裕集团', '苏州科服', '信诚管理咨询', '集成电路公司', '常州团队', '国企元禾']; + // 获取公司名字包含$companyNameKeyword任意数据的公司,需要模糊匹配 + $yuanhe['yh_join_company_total'] = Company::where(function ($query) use ($companyNameKeyword) { + foreach ($companyNameKeyword as $item) { + $query->orWhere('company_name', 'like', '%' . $item . '%'); + } + })->count(); + // 全市干部参与企业 + $yuanhe['yh_ganbu_total'] = Company::whereHas('users', function ($query) { + $query->where('from', '跟班学员'); + })->count(); + // 三个全覆盖 + // 苏州头部企业 + $cover['head_total'] = 0; + // 高层次人才 + $cover['high_total'] = 0; + // 重点上市公司 + $cover['stock_total'] = 0; + // 时间轴 + $time_axis = []; + // 动态信息 + $article['xiaoyou'] = Article::where('type', 1)->limit(7)->orderBy('created_at', 'desc')->get(); + $article['yejie'] = Article::where('type', 2)->limit(7)->orderBy('created_at', 'desc')->get(); + $article['supply_demands'] = SupplyDemand::limit(7)->orderBy('created_at', 'desc')->get(); + return $this->success(compact('courseTypes', 'schoolmate', 'suzhou', 'country', 'monthCourses', 'yuanhe', 'time_axis')); } /** diff --git a/app/Models/Article.php b/app/Models/Article.php new file mode 100644 index 0000000..e310ceb --- /dev/null +++ b/app/Models/Article.php @@ -0,0 +1,7 @@ +id(); + $table->string('title')->comment('标题'); + $table->text('content')->nullable()->comment('内容'); + // 类型 + $table->tinyInteger('type')->default(0)->comment('类型1校友动态2业界动态'); + $table->timestamps(); + $table->softDeletes(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('articles'); + } +};