二维码 课程选择

master
lion 3 months ago
commit 0798076550

@ -68,6 +68,10 @@ class CompanyController extends BaseController
if (!isset($key) || !isset($op) || !isset($value)) {
continue;
}
if ($key == 'company_tag' && $value == '被投企业') {
$query->where('is_yh_invested', 1);
continue;
}
// 等于
if ($op == 'eq') {
$query->where($key, $value);

@ -138,7 +138,7 @@ class CourseContentController extends BaseController
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$detail = $this->model->with('courseContentEvaluation.courseContentEvaluationAsks','teacher','directionDetail')->find($all['id']);
$detail = $this->model->with('courseContentEvaluation.courseContentEvaluationAsks', 'teacher', 'directionDetail')->find($all['id']);
return $this->success($detail);
}
@ -278,9 +278,9 @@ class CourseContentController extends BaseController
if (!in_array('日期', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '日期字段不存在']);
}
if (!in_array('时间', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '时间字段不存在']);
}
// if (!in_array('时间', $keyList)) {
// return $this->fail([ResponseCode::ERROR_BUSINESS, '时间字段不存在']);
// }
if (!in_array('授课老师', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '授课老师字段不存在']);
}
@ -290,9 +290,12 @@ class CourseContentController extends BaseController
if (!in_array('课程主题', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '课程主题字段不存在']);
}
if (!in_array('上课地点', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '上课地点字段不存在']);
if (!in_array('主题方向', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '主题方向字段不存在']);
}
// if (!in_array('上课地点', $keyList)) {
// return $this->fail([ResponseCode::ERROR_BUSINESS, '上课地点字段不存在']);
// }
if (!in_array('联系方式', $keyList)) {
return $this->fail([ResponseCode::ERROR_BUSINESS, '联系方式字段不存在']);
}
@ -317,10 +320,12 @@ class CourseContentController extends BaseController
'teacher_name' => $value['授课老师'] ?? '',
'teacher_introduce' => $value['老师简介'] ?? '',
'teacher_id' => $teacher_id ?? null,
'teacher_remark' => $value['备注'] ?? '',
'address' => $value['上课地点'] ?? '',
'theme' => $value['课程主题'] ?? '',
'sex' => $value['性别'] ?? '',
'mobile' => $value['联系方式'] ?? ''
'mobile' => $value['联系方式'] ?? '',
'direction' => $value['主题方向'] ?? ''
];
}
return $this->success($list);
@ -358,8 +363,7 @@ class CourseContentController extends BaseController
}
DB::beginTransaction();
try {
// CourseContent::where('course_id', $records[0]['course_id'])->delete();
Course::where('id', $records[0]['course_id'])->update(['course_content_status' => 0]);
// Course::where('id', $records[0]['course_id'])->update(['course_content_status' => 0]);
// 分段导入
foreach ($records as $item) {
if (!isset($item['teacher_id']) || empty($item['teacher_id'])) {
@ -375,6 +379,7 @@ class CourseContentController extends BaseController
'name' => $item['teacher_name'],
'introduce' => $item['teacher_introduce'],
'sex' => $item['sex'],
'remark' => $item['teacher_remark'],
];
$teacher = Teacher::updateOrCreate($where, $data);
$item['teacher_id'] = $teacher->id;

@ -136,6 +136,10 @@ class CourseController extends BaseController
}
$query->whereBetween($key, [$from, $to]);
}
if ($op == 'in') {
$array = explode(',', $value);
$query->whereIn($key, $array);
}
}
}
});

@ -64,6 +64,7 @@ class CourseSignController extends BaseController
* @OA\Parameter(name="start_date", in="query", @OA\Schema(type="string"), required=true, description="开始日期"),
* @OA\Parameter(name="end_date", in="query", @OA\Schema(type="string"), required=true, description="结束日期"),
* @OA\Parameter(name="course_type_id", in="query", @OA\Schema(type="string"), required=true, description="课程体系id多个英文逗号"),
* @OA\Parameter(name="clear", 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",
@ -74,8 +75,9 @@ class CourseSignController extends BaseController
public function index()
{
$all = request()->all();
$list = $this->model->with(['course.typeDetail', 'user' => function ($query) use ($all) {
if (isset($all['clear']) && empty($all['clear'])) {
$clear = request('clear', 1);
$list = $this->model->with(['course.typeDetail', 'user' => function ($query) use ($all, $clear) {
if ($clear) {
$query->with(['courseSigns' => function ($q) {
$q->where('status', 1)->with('course');
}]);
@ -130,8 +132,8 @@ class CourseSignController extends BaseController
$query->whereJsonContains("data->{$item->name}", $item->value);
}
}
})->where(function ($query) use ($all) {
if (isset($all['clear']) && empty($all['clear'])) {
})->where(function ($query) use ($all, $clear) {
if ($clear) {
$query->with('thirdAppointmentLogs');
}
if (isset($all['start_date'])) {

@ -118,9 +118,6 @@ class OtherController extends CommonController
*/
public function coursesHome()
{
// 启用查询日志记录
DB::enableQueryLog();
$start_date = request('start_date', '2020-01-01');
$end_date = request('end_date', date('Y-m-d'));
$course_type_id = request('course_type_id', '');
@ -137,23 +134,11 @@ class OtherController extends CommonController
->whereIn('type', $course_type_id)
->get();
// 报名人数
$list['course_signs_total'] = CourseSign::whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date)
->whereNotIn('status', [4, 5])
->where(function ($query) use ($courses) {
$query->whereIn('course_id', $courses->pluck('id'));
})->count();
$list['course_signs_total'] = CourseSign::courseSignsTotal($start_date, $end_date);
// 审核通过人数
$courseSign = CourseSign::where('status', 1)
->whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date)
->whereNotIn('status', [4, 5])
->where(function ($query) use ($courses) {
$query->whereIn('course_id', $courses->pluck('id'));
})->get();
$list['course_signs_pass'] = $courseSign->count();
$list['course_signs_pass'] = CourseSign::courseSignsTotal($start_date, $end_date, 1);
// 审核通过人数去重
$list['course_signs_pass_unique'] = User::whereIn('id', $courseSign->pluck('user_id'))->distinct('mobile')->count();
$list['course_signs_pass_unique'] = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1);
// 开课场次
$calendar = Calendar::whereIn('course_id', $courses->pluck('id'))->whereBetween('date', [$start_date, $end_date])->get();
$list['course_total'] = $calendar->count();
@ -163,8 +148,6 @@ class OtherController extends CommonController
$end = Carbon::parse($course->end_time);
return $end->diffInDays($start) + 1; // 包含起始和结束日期
});
// 返回所有sql语句
$sql = DB::getQueryLog();
// 课程分类明细统计
$courseTypesSum = [];
$courseTypes = CourseType::whereIn('id', $course_type_id)->get();
@ -174,27 +157,15 @@ class OtherController extends CommonController
->where('start_date', '<=', $end_date)
->where('type', $courseType->id)
->get();
$courseSignByType = CourseSign::where('status', 1)
->whereIn('course_id', $courses2->pluck('id'))
->whereNotIn('status', [4, 5])
->whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date)
->get();
// 培养人数
$courseTypeSignsPass = $courseSignByType->count();
// 去重培养人数
$courseTypeSignsPassUnique = User::whereIn('id', $courseSignByType->pluck('user_id'))->distinct('mobile')->count();
foreach ($courses2 as $course) {
$courseTypesSum[] = [
'course_type' => $courseType->name,
'course_type_signs_pass' => $courseTypeSignsPass,
'course_type_signs_pass_unique' => $courseTypeSignsPassUnique,
// 培养人数
'course_type_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, $courses2->pluck('id')->toArray()),
// 去重培养人数
'course_type_signs_pass_unique' => CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1, $courses2->pluck('id')->toArray()),
'course_name' => $course->name,
'course_signs_pass' => CourseSign::where('status', 1)
->where('course_id', $course->id)
->whereDate('created_at', '>=', $start_date)
->whereDate('created_at', '<=', $end_date)
->count()
'course_signs_pass' => CourseSign::courseSignsTotal($start_date, $end_date, 1, [$course->id]),
];
}
@ -211,7 +182,7 @@ class OtherController extends CommonController
$area->course_signs_pass = $courseSignByArea->count();
$area->course_signs_pass_unique = User::whereIn('id', $courseSignByArea->pluck('user_id'))->distinct('mobile')->count();
}
return $this->success(compact('list', 'courseTypesSum', 'areas', 'sql'));
return $this->success(compact('list', 'courseTypesSum', 'areas'));
}
/**

@ -191,6 +191,9 @@ class UserController extends BaseController
{
$all = request()->all();
$year = request('year', date('Y'));
$start_date = $year . '-01-01';
$end_date = $year . '-12-31';
$list = $this->model->with('appointments', 'companyIndustryDetail',
'companyPositionDetail', 'companyAreaDetail')
->with(['courseSigns' => function ($query) {
@ -328,22 +331,14 @@ class UserController extends BaseController
$list = $list->limit(5000)->get()->toArray();
return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), $all['file_name'] ?? '' . date('YmdHis') . '.xlsx');
} else {
$total = $this->model->whereHas('courseSigns')->count();
$year_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
$query->whereHas('course', function ($q) use ($year) {
$q->where('year', $year);
});
})->count();
// 累计总数
$total = CourseSign::courseSignsTotalByUnique('2020-01-01', date('Y-m-d'));
// 报名人数
$year_total = CourseSign::courseSignsTotalByUnique($start_date, $end_date);
// 年度培养学员
$year_training_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
$query->where('status', 1)->whereHas('course', function ($q) use ($year) {
$q->where('year', $year);
});
})->count();
$year_training_total = CourseSign::courseSignsTotalByUnique($start_date, $end_date, 1);
// 累计培养学员
$training_total = $this->model->whereHas('courseSigns', function ($query) use ($year) {
$query->where('status', 1);
})->count();
$training_total = CourseSign::courseSignsTotalByUnique('2020-01-01', date('Y-m-d'), 1);
$list = $list->paginate($all['page_size'] ?? 20);
}
return $this->success(['list' => $list, 'year_total' => $year_total, 'total' => $total, 'year_training_total' => $year_training_total, 'training_total' => $training_total]);

@ -91,9 +91,7 @@ class OtherController extends CommonController
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$YuanheRepository = new YuanheRepository();
// $result = $YuanheRepository->search(['keyword' => $all['company_name']]);
// todo上线解开注释
$result = "[{\"createBy\":null,\"createDt\":null,\"updateBy\":null,\"updateDt\":null,\"creditCode\":\"91320594MA7F0G9W6A\",\"keyNo\":\"db5ppy5kbsprbbhjbjlarvmvphjhp3mrkv\",\"name\":\"苏州元瞰科技有限公司\",\"operName\":\"刘杰杰\",\"startDate\":\"2021-12-21\",\"status\":\"注销\"},{\"createBy\":null,\"createDt\":null,\"updateBy\":null,\"updateDt\":null,\"creditCode\":\"91310118MA1JMYNK9K\",\"keyNo\":\"ak95iy5s3rhmsasj5kepiijjimh95jl3b5\",\"name\":\"上海元橡瞰行科技有限公司\",\"operName\":\"任杰\",\"startDate\":\"2019-03-19\",\"status\":\"存续\"},{\"createBy\":null,\"createDt\":null,\"updateBy\":null,\"updateDt\":null,\"creditCode\":\"91110108MAERYU4T74\",\"keyNo\":\"fs3ijyphhk59kbhjblbsj35priklbla5vh\",\"name\":\"北京元字瞰科技有限公司\",\"operName\":\"宋明龙\",\"startDate\":\"2025-08-22\",\"status\":\"存续\"},{\"createBy\":null,\"createDt\":null,\"updateBy\":null,\"updateDt\":null,\"creditCode\":\"\",\"keyNo\":\"13ivbylse5l5mjkjar9pbhkm9vpsjiksjl\",\"name\":\"上海瞰元信息科技有限公司\",\"operName\":\"刘勇\",\"startDate\":\"2005-06-30\",\"status\":\"吊销\"},{\"createBy\":null,\"createDt\":null,\"updateBy\":null,\"updateDt\":null,\"creditCode\":\"91330100796660273A\",\"keyNo\":\"f3aaeyiss99ev5hjbipkv9eaerkih99bbs\",\"name\":\"杭州瞰元信息科技有限公司\",\"operName\":\"曾铁农\",\"startDate\":\"2006-12-22\",\"status\":\"吊销\"}]";
$result = $YuanheRepository->search(['keyword' => $all['company_name']]);
$result = json_decode($result, true);
if (!$result) {
return $this->fail([ResponseCode::ERROR_PARAMETER, '获取失败']);
@ -156,14 +154,14 @@ class OtherController extends CommonController
->whereHas('users', function ($query) {
$query->where('is_schoolmate', 1);
})->with([
'users' => function ($query) {
$query->select('id', 'name', 'username', 'company_position', 'company_id')->where('is_schoolmate', 1)->with([
'courseSigns' => function ($query) {
$query->select('id', 'status', 'user_id', 'course_id')->with('course')->orderBy('fee_status', 'desc');
}
]);
}
]);
'users' => function ($query) {
$query->select('id', 'name', 'username', 'company_position', 'company_id')->where('is_schoolmate', 1)->with([
'courseSigns' => function ($query) {
$query->select('id', 'status', 'user_id', 'course_id')->with('course')->orderBy('fee_status', 'desc');
}
]);
}
]);
// 根据排序字段进行排序
if ($sortName !== 'distance') {
$query->orderBy($sortName, $sortType);

@ -244,8 +244,7 @@ class UserController extends CommonController
$query->where('start_date', '<=', $nowDate)->where('end_date', '>=', $nowDate);
})->first();
if ($course_signs) {
// todo::上线解开注释
//$course_signs->qrcode = $doorRepository->getEmpQrCodeByCourse($course_signs, $out);
$course_signs->qrcode = $doorRepository->getEmpQrCodeByCourse($course_signs, $out);
$course_signs->qrcode = '';
}
// 是否有资格进入校友库

@ -249,9 +249,7 @@ class Course extends SoftDeletesModel
];
$app = Factory::miniProgram($config);
$tmp = $app->app_code->get('packages/sign/course?course_id=' . $courseId, [
// todo:: 版本切换
// 'env_version' => "release" // 正式版
'env_version' => "trial" // 体验版
'env_version' => "release" // 正式版
]);
$dir = dirname($path);
$fileSys->ensureDirectoryExists($dir, 0755, true);

@ -88,8 +88,8 @@ class CourseContent extends SoftDeletesModel
];
$app = Factory::miniProgram($config);
$tmp = $app->app_code->get('/packages/sign/index?course_content_id=' . $courseContentId, [
// 'env_version' => "release" // 正式版
'env_version' => "trial" // 体验版
'env_version' => "release" // 正式版
//'env_version' => "trial" // 体验版
]);
$dir = dirname($path);
$fileSys->ensureDirectoryExists($dir, 0755, true);

@ -71,5 +71,44 @@ class CourseSign extends SoftDeletesModel
return $this->hasMany(ThirdAppointmentLog::class, 'course_sign_id', 'id');
}
/**
* 指定时间内的报名信息(未去重)
*/
public static function courseSignsTotal($start_date, $end_date, $status = null, $course_ids = null)
{
$total = 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])
->count();
return $total;
}
/**
* 指定时间内的报名信息(去重)
*/
public static function courseSignsTotalByUnique($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 User::whereIn('id', $courseSignByType->pluck('user_id'))->distinct('mobile')->count();
}
}

@ -73,6 +73,7 @@ class User extends Authenticatable implements Auditable
'company_date',
'deleted_at',
'no',
'from'
];
protected $appends = ['is_vip_text', 'is_schoolmate_text', 'appointment_total', 'name'];

Binary file not shown.

After

Width:  |  Height:  |  Size: 957 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Loading…
Cancel
Save