Merge branch 'master' of ssh://47.101.48.251:/data/git/wx.sstbc.com

master
lion 2 weeks ago
commit d9def4b6b3

@ -222,7 +222,7 @@ class OtherController extends CommonController
$course_type_id = $params['course_type_id'];
$courses = $params['courses'];
// 被投企业数
// $list['course_signs_invested'] = CourseSign::yhInvested($start_date, $end_date, $courses->pluck('id')->toArray());
$list['course_signs_invested'] = CourseSign::yhInvested($start_date, $end_date, $courses->pluck('id')->toArray());
// 报名人数
$list['course_signs_total'] = CourseSign::courseSignsTotal($start_date, $end_date, null, $courses->pluck('id'));
// 审核通过人数

@ -164,7 +164,7 @@ class UserController extends CommonController
*/
public function updateUser()
{
$all = \request()->except(['id','mobile','openid']);
$all = \request()->except(['id', 'mobile', 'openid']);
$model = User::find($this->getUserId());
if (isset($all['password'])) {
// 判断旧密码是否正确
@ -174,6 +174,8 @@ class UserController extends CommonController
$model->password = Hash::make($all['password']);
}
if (isset($all['username']) && !empty($all['username'])) {
// 去除左右两边和中间的空格
$all['username'] = str_replace(' ', '', trim($all['username']));
$all['name'] = $all['username'];
}
if (isset($all['name']) && !empty($all['name'])) {

@ -157,8 +157,7 @@ class CourseSign extends SoftDeletesModel
public static function yhInvested($start_date = null, $end_date = null, $course_ids = null, $retList = false)
{
// 判断是否使用默认时间
$isDefaultDate = empty($start_date) || $start_date == CourseType::START_DATE || empty($course_ids);
dd(empty($start_date) , $start_date == CourseType::START_DATE , empty($course_ids));
$isDefaultDate = (empty($start_date) || $start_date == CourseType::START_DATE) && empty($course_ids);
// 获取学员ID列表
if ($isDefaultDate) {
// 默认时间:获取所有学员,不限制课程
@ -213,9 +212,14 @@ class CourseSign extends SoftDeletesModel
public static function genban($start_date, $end_date, $course_ids = null, $retList = false)
{
$courseSignsQuery = self::getStudentList($start_date, $end_date, 1, $course_ids);
// 获取需要统计跟班学员的课程
$genbanCourse = Course::whereHas('typeDetail', function ($query) {
$query->whereIn('is_count_genban', 1);
})->get();
$courseSigns = $courseSignsQuery->whereHas('user', function ($query) {
$query->where('from', 'like', '%跟班学员%');
})->get();
})->whereIn('course_id', $genbanCourse->pluck('id'))->get();
if ($retList) {
return User::with('company')->whereIn('id', $courseSigns->pluck('user_id'))->get();

@ -8,6 +8,16 @@ class CourseType extends SoftDeletesModel
{
const START_DATE = '2020-01-01 00:00:00';
protected $appends = ['is_count_genban_text'];
/**
* 是否统计跟班学员数文字
*/
public function getIsCountGenbanTextAttribute()
{
return ($this->attributes['is_count_genban'] ?? 1) == 1 ? '是' : '否';
}
public function courses()
{
return $this->hasMany(Course::class, 'type', 'id');

@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('course_types', function (Blueprint $table) {
$table->tinyInteger('is_count_genban')->default(0)->nullable()->comment('是否统计跟班学员数 0否 1是');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('course_types', function (Blueprint $table) {
$table->dropColumn('is_count_genban');
});
}
};
Loading…
Cancel
Save