diff --git a/app/Http/Controllers/Mobile/UserController.php b/app/Http/Controllers/Mobile/UserController.php index f5d37a1..724518a 100755 --- a/app/Http/Controllers/Mobile/UserController.php +++ b/app/Http/Controllers/Mobile/UserController.php @@ -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'])) { diff --git a/app/Models/CourseSign.php b/app/Models/CourseSign.php index e932702..eafe558 100755 --- a/app/Models/CourseSign.php +++ b/app/Models/CourseSign.php @@ -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); - + $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); + // 获取制定的课程id + $genbanCourse = Course::whereHas('typeDetail', function ($query) { + $query->whereIn('id', [1, 3, 14]); + })->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();