master
cody 3 weeks ago
parent a22d50f098
commit 08a0c50cd5

@ -268,8 +268,6 @@ class CourseController extends BaseController
if ($model->status == 1 && $model->start_date) {
CourseAppointmentTotal::addByCourse($model->id);
}
// 记录日志
$this->saveLogs($original, $model);
return $this->success($model);
} catch (\Exception $exception) {
DB::rollBack();

@ -121,7 +121,7 @@ class OtherController extends CommonController
{
// 课程统计
$courseTypes = CourseType::where('is_chart', 1)->get();
$start_date = '2020-01-01';
$start_date = CourseType::START_DATE;
$end_date = date('Y-m-d');
foreach ($courseTypes as $courseType) {
// 课程
@ -157,7 +157,8 @@ class OtherController extends CommonController
];
}
// 本月课程
$monthCourses = Course::with('teacher')->where('start_date', 'like', '%' . date('Y-m') . '%')->get();
$monthCourses = Course::with('teacher')->where('start_date', 'like', '%' . date('Y-m') . '%')
->get();
// 时间轴
$time_axis = TimeEvent::orderBy('sort', 'asc')->orderBy('id', 'desc')->get();
// 动态信息
@ -185,7 +186,7 @@ class OtherController extends CommonController
*/
public function coursesHome()
{
$start_date = request('start_date', '2020-01-01');
$start_date = request('start_date', CourseType::START_DATE);
$end_date = request('end_date', date('Y-m-d'));
$course_type_id = request('course_type_id', '');
if ($course_type_id) {
@ -200,8 +201,7 @@ class OtherController extends CommonController
// ->where('start_date', '<=', $end_date)
// ->where('start_date', '>=', $start_date)
->get();
// 被投企业数
$list['course_signs_invested'] = CourseSign::yhInvested($start_date, $end_date);
// 报名人数
$list['course_signs_total'] = CourseSign::courseSignsTotal($start_date, $end_date);
// 审核通过人数
@ -246,9 +246,7 @@ class OtherController extends CommonController
$area->course_signs_pass_unique = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses->pluck('id'), $area->value, $userIds);
$area->user_ids = $userIds;
}
$area_course_signs_pass_total = collect($areas)->sum('course_signs_pass');
$area_course_signs_pass_unique_total = collect($areas)->sum('course_signs_pass_unique');
return $this->success(compact('list', 'courseTypesSum', 'areas', 'area_course_signs_pass_total', 'area_course_signs_pass_unique_total'));
return $this->success(compact('list', 'courseTypesSum', 'areas'));
}
/**

@ -6,6 +6,8 @@ namespace App\Models;
class CourseType extends SoftDeletesModel
{
const START_DATE = '2020-01-01 00:00:00';
public function courses()
{
return $this->hasMany(Course::class, 'type', 'id');

@ -15,9 +15,11 @@ return new class extends Migration {
Schema::create('articles', function (Blueprint $table) {
$table->id();
$table->string('title')->comment('标题');
$table->text('content')->nullable()->comment('内容');
$table->mediumText('content')->nullable()->comment('内容');
// 类型
$table->tinyInteger('type')->default(0)->comment('类型1校友动态2业界动态');
// 排序
$table->integer('sort')->default(0)->comment('排序');
$table->timestamps();
$table->softDeletes();
});

@ -18,6 +18,8 @@ return new class extends Migration
$table->string('title')->comment('标题');
$table->date('date')->nullable()->comment('日期');
$table->integer('sort')->default(0)->comment('排序');
$table->mediumText('content')->nullable()->comment('内容');
$table->timestamps();
$table->softDeletes();
});

Loading…
Cancel
Save