master
lion 4 weeks ago
commit b713ac7d16

@ -78,7 +78,7 @@ class CourseSignController extends BaseController
$clear = request('clear', 1);
$list = $this->model->with(['course.typeDetail', 'user' => function ($query) use ($all, $clear) {
if ($clear) {
$query->with(['courseSigns' => function ($q) {
$query->with(['company', 'courseSigns' => function ($q) {
$q->where('status', 1)->with('course');
}]);
}

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Helpers\ResponseCode;
use App\Jobs\CancelAppointMeet;
use App\Models\Admin;
use App\Models\Appointment;
use App\Models\AppointmentConfig;
@ -133,6 +134,8 @@ class OtherController extends CommonController
->where('start_date', '<=', $end_date)
->whereIn('type', $course_type_id)
->get();
// 被投企业数
$list['course_signs_invested'] = CourseSign::yhInvested($start_date, $end_date);
// 报名人数
$list['course_signs_total'] = CourseSign::courseSignsTotal($start_date, $end_date);
// 审核通过人数
@ -300,9 +303,9 @@ class OtherController extends CommonController
public function test()
{
$door = new DoorRepository();
$result = $door->getAllDoorInfo();
dd($result);
$model = Appointment::find(293);
// 取消预约
dispatch((new CancelAppointMeet($model, 'a0f75f36213a48f59ce860e679a77c5b')));
}

@ -163,6 +163,8 @@ class TeacherController extends BaseController
* @OA\Parameter(name="sex", in="query", @OA\Schema(type="string"), description="性别"),
* @OA\Parameter(name="remark", in="query", @OA\Schema(type="string"), description="备注"),
* @OA\Parameter(name="introduce", in="query", @OA\Schema(type="string"), description="介绍"),
* @OA\Parameter(name="salary", in="query", @OA\Schema(type="string"), description="课酬"),
* @OA\Parameter(name="tutor", in="query", @OA\Schema(type="string"), description="导师"),
* @OA\Response(
* response=200,
* description="操作成功"

@ -180,6 +180,7 @@ class UserController extends BaseController
* @OA\Parameter(name="has_openid", in="query", @OA\Schema(type="string"), required=true, description="是否绑定小程序0否1是"),
* @OA\Parameter(name="year", in="query", @OA\Schema(type="string"), required=true, description="年份"),
* @OA\Parameter(name="is_black", in="query", @OA\Schema(type="string"), required=true, description="是否黑名单0否1是"),
* @OA\Parameter(name="is_yh_invested", in="query", @OA\Schema(type="string"), required=true, description="是否元和已投企业0否1是"),
* @OA\Parameter(name="token", in="query", @OA\Schema(type="string"), required=true, description="token"),
* @OA\Response(
* response="200",
@ -195,12 +196,22 @@ class UserController extends BaseController
$end_date = $year . '-12-31';
$list = $this->model->with('appointments', 'companyIndustryDetail',
'companyPositionDetail', 'companyAreaDetail')
'companyPositionDetail', 'companyAreaDetail', 'company')
->with(['courseSigns' => function ($query) {
$query->with('course.typeDetail')->orderBy('fee_status', 'desc');
}])->withCount(['appointments' => function ($query) {
$query->whereIn('status', [0, 1]);
}]);
// 是否被投企业
if (isset($all['is_yh_invested'])) {
$list = $list->whereHas('company', function ($query) use ($all) {
if ($all['is_yh_invested'] == 1) {
$query->where('is_yh_invested', 1);
} else {
$query->where('is_yh_invested', 0);
}
});
}
$list = $list->whereHas('courseSigns', function ($query) use ($all) {
if (isset($all['course_id'])) {
$query->where('course_id', $all['course_id']);

@ -112,5 +112,26 @@ class CourseSign extends SoftDeletesModel
return User::whereIn('id', $courseSignByType->pluck('user_id'))->distinct('mobile')->count();
}
/**
* 指定时间内的被投企业
*/
public static function yhInvested($start_date, $end_date, $status = null, $course_ids = null)
{
$courseSignByType = CourseSign::whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date)
->where(function ($query) use ($status, $course_ids) {
if (isset($status)) {
$query->where('status', $status);
}
if (isset($course_ids)) {
$query->whereIn('course_id', $course_ids);
}
})->whereNotIn('status', [4, 5])
->get();
return Company::whereHas('users', function ($query) use ($courseSignByType) {
$query->whereIn('id', $courseSignByType->pluck('user_id'));
})->count();
}
}

@ -24,6 +24,8 @@ class EmailRecordUser extends SoftDeletesModel
public static function template($template, $var_data)
{
foreach ($var_data as $key => $var) {
$key = trim($key);
$var = trim($var);
$template = str_replace('{' . $key . '}', $var, $template);
}
return $template;

@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('teachers', function (Blueprint $table) {
// 课酬
$table->string('salary')->nullable()->comment('课酬');
// 导师
$table->string('tutor')->nullable()->comment('导师');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('teachers', function (Blueprint $table) {
//
});
}
};
Loading…
Cancel
Save