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

master
lion 3 months ago
commit 5ee295c95e

@ -9,7 +9,7 @@ use Illuminate\Support\Facades\DB;
use Maatwebsite\Excel\Facades\Excel;
use PhpOffice\PhpSpreadsheet\IOFactory;
class UpdateCourseUrls extends Command
class UpdateCalendar extends Command
{
/**
* The name and signature of the console command.
@ -398,7 +398,7 @@ class UpdateCourseUrls extends Command
try {
// 处理Excel数字格式的日期时间
if (is_numeric($dateTimeString)) {
$excelDate = (float) $dateTimeString;
$excelDate = (float)$dateTimeString;
// Excel日期从1900年1月1日开始计算天数
// 需要减去2是因为Excel错误地认为1900年是闰年

@ -42,10 +42,6 @@ class UpdateCompany extends Command
*/
public function handle()
{
// $YuanheRepository = new YuanheRepository();
// $result = $YuanheRepository->companyInfo(['keyword' => '苏州元瞰科技有限公司','enterpriseName'=>'博世工程技术']);
// dd($result);
$user_id = $this->option('user_id');
// 更新公司信息
$this->compnay($user_id);

@ -29,6 +29,7 @@ class CommonExport implements FromCollection
*/
public function collection()
{
$clear = request('clear', 0);
if (empty($this->fields)) {
throw new ErrorException('导出字段不能为空');
}
@ -38,15 +39,16 @@ class CommonExport implements FromCollection
// 获取表头
$header = array_values($this->fields);
$moreFileds = [];
// 表头追加附属数据
if (isset($this->data[0]['data']) && is_array($this->data[0]['data'])) {
$moreHeader = array_column($this->data[0]['data'], 'name');
// 获取头信息
$header = array_merge($header, $moreHeader);
// 获取字段信息
$moreFileds = array_column($this->data[0]['data'], 'field');
if (empty($clear)) {
// 表头追加附属数据
if (isset($this->data[0]['data']) && is_array($this->data[0]['data'])) {
$moreHeader = array_column($this->data[0]['data'], 'name');
// 获取头信息
$header = array_merge($header, $moreHeader);
// 获取字段信息
$moreFileds = array_column($this->data[0]['data'], 'field');
}
}
// 获取字段指向
$fields = array_keys($this->fields);
$newList = [];
@ -63,14 +65,16 @@ class CommonExport implements FromCollection
}
// 如果有自定义数据,全部附件上去
$t2 = [];
if (isset($info['data']) && $info['data'] && !empty($moreFileds)) {
$dataCollect = collect($info['data']);
foreach ($moreFileds as $moreFiled) {
$value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? '';
if (str_contains($moreFiled, 'idcard')) {
$t2[$moreFiled] = ' ' . $value;
} else {
$t2[$moreFiled] = $value;
if (empty($clear)) {
if (isset($info['data']) && $info['data'] && !empty($moreFileds)) {
$dataCollect = collect($info['data']);
foreach ($moreFileds as $moreFiled) {
$value = ($dataCollect->where('field', $moreFiled)->first()['value']) ?? '';
if (str_contains($moreFiled, 'idcard')) {
$t2[$moreFiled] = ' ' . $value;
} else {
$t2[$moreFiled] = $value;
}
}
}
}

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Admin;
use App\Exports\BaseExport;
use App\Exports\CommonExport;
use App\Helpers\ResponseCode;
use App\Jobs\SendCourseSms;
use App\Models\Course;
@ -140,12 +141,8 @@ class CourseController extends BaseController
});
$list = $list->orderBy($all['sort_name'] ?? 'sign_status', $all['sort_type'] ?? 'asc');
if (isset($all['is_export']) && !empty($all['is_export'])) {
$list = $list->get()->toArray();
$export_fields = $all['export_fields'] ?? [];
// 导出文件名字
$tableName = $this->model->getTable();
$filename = (new CustomForm())->getTableComment($tableName);
return Excel::download(new BaseExport($export_fields, $list, $tableName), $filename . date('YmdHis') . '.xlsx');
$list = $list->limit(5000)->get()->toArray();
return Excel::download(new CommonExport($list, $all['export_fields'] ?? ''), $all['file_name'] ?? '' . date('YmdHis') . '.xlsx');
} else {
// 输出
$list = $list->paginate($all['page_size'] ?? 20);

@ -74,10 +74,12 @@ class CourseSignController extends BaseController
public function index()
{
$all = request()->all();
$list = $this->model->with(['course', 'thirdAppointmentLogs', 'user' => function ($query) {
$query->with(['courseSigns' => function ($q) {
$q->where('status', 1)->with('course');
}]);
$list = $this->model->with(['course.typeDetail', 'user' => function ($query) use ($all) {
if (isset($all['clear']) && empty($all['clear'])) {
$query->with(['courseSigns' => function ($q) {
$q->where('status', 1)->with('course');
}]);
}
}])->whereHas('user', function ($query) use ($all) {
if (isset($all['is_vip'])) {
$query->where('is_vip', $all['is_vip']);
@ -129,6 +131,9 @@ class CourseSignController extends BaseController
}
}
})->where(function ($query) use ($all) {
if (isset($all['clear']) && empty($all['clear'])) {
$query->with('thirdAppointmentLogs');
}
if (isset($all['start_date'])) {
$query->whereDate('created_at', '>=', $all['start_date']);
}
@ -444,7 +449,7 @@ class CourseSignController extends BaseController
$list[$key]['status'] = 0;
$list[$key]['status_name'] = '待审核';
}
$list[$key] = array_merge($list[$key], ['course_id' => $course_id]);
$list[$key] = array_merge($list[$key], ['course_id' => $course_id, 'from' => '跟班学员']);
}
return $this->success($list);
}

@ -9,6 +9,7 @@ use App\Helpers\ResponseCode;
use App\Models\AppointmentConfig;
use App\Models\AppointmentType;
use App\Models\Banner;
use App\Models\Company;
use App\Models\Config;
use App\Repositories\YuanheRepository;
use Illuminate\Support\Facades\Validator;
@ -90,51 +91,132 @@ class OtherController extends CommonController
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$YuanheRepository = new YuanheRepository();
// $result = $YuanheRepository->companyInfo(['enterpriseName' => $all['company_name']]);
$result[] = [
"createBy" => null,
"createDt" => null,
"updateBy" => null,
"updateDt" => null,
"enterpriseId" => "1950060660573786112",
"enterpriseName" => "苏州元瞰科技有限公司",
"creditCode" => "91320594MA7F0G9W6A",
"keyNo" => "db5ppy5kbsprbbhjbjlarvmvphjhp3mrkv",
"isAbroad" => "0",
"status" => "注销",
"logo" => "https://image.qcc.com/logo/EntImage.png",
"operName" => "刘杰杰",
"contactMail" => "425039148@qq.com",
"contactPhone" => "15298866552",
"startDate" => "2021-12-21",
"endDate" => null,
"updatedDate" => "2025-08-17",
"registCapi" => "100万元",
"registAmount" => "1000000.0000",
"registCapiType" => "1",
"currencyType" => null,
"termStart" => "2021-12-21",
"termEnd" => null,
"checkDate" => "2025-07-03",
"orgNo" => "MA7F0G9W-6",
"isOnStock" => "0",
"stockNumber" => "",
"stockType" => "",
"stockDate" => null,
"province" => "江苏省",
"city" => "苏州市",
"country" => "苏州工业园区",
"areaCode" => "320576",
"address" => "苏州工业园区亭新街11号B1栋二楼",
"businessScope" => "一般项目:人工智能应用软件开发",
"tagList" => null,
"qccIndustry" => null,
"isYhInvested" => false
];
// $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 = json_decode($result, true);
if (!$result) {
return $this->fail([ResponseCode::ERROR_PARAMETER, '获取失败']);
}
return $this->success($result);
}
/**
* @OA\Get(
* path="/api/mobile/other/company-list",
* tags={"小程序-其他"},
* summary="公司列表",
* @OA\Parameter(name="company_name", in="query", @OA\Schema(type="string"), required=false, description="公司名字"),
* @OA\Parameter(name="company_longitude", in="query", @OA\Schema(type="string"), required=false, description="经度"),
* @OA\Parameter(name="company_latitude", in="query", @OA\Schema(type="string"), required=false, description="纬度"),
* @OA\Parameter(name="page_size", in="query", @OA\Schema(type="string"), required=false, description="每页显示的条数"),
* @OA\Parameter(name="page", in="query", @OA\Schema(type="string"), required=false, description="页码"),
* @OA\Parameter(name="sort_name", in="query", @OA\Schema(type="string"), required=false, description="排序字段名字"),
* @OA\Parameter(name="sort_type", in="query", @OA\Schema(type="string"), required=false, description="排序类型"),
* @OA\Response(
* response=200,
* description="操作成功"
* )
* )
*/
public function companyList()
{
$all = \request()->all();
$messages = [
'company_longitude.required' => '经度必填',
'company_latitude.required' => '纬度必填',
];
$validator = Validator::make($all, [
'company_longitude' => 'required',
'company_latitude' => 'required',
], $messages);
if ($validator->fails()) {
return $this->fail([ResponseCode::ERROR_PARAMETER, implode(',', $validator->errors()->all())]);
}
$longitude = floatval($all['company_longitude']);
$latitude = floatval($all['company_latitude']);
$pageSize = intval($all['page_size'] ?? 10);
$page = intval($all['page'] ?? 1);
$sortName = $all['sort_name'] ?? 'distance';
$sortType = $all['sort_type'] ?? 'asc';
// 构建基础查询
$query = Company::select('id', 'company_name', 'company_longitude', 'company_latitude', 'company_address')
->where(function ($query) use ($all) {
if (isset($all['company_name'])) {
$query->where('company_name', 'like', '%' . $all['company_name'] . '%');
}
})->whereNotNull('company_longitude')
->whereNotNull('company_latitude')
->where('company_longitude', '!=', '')
->where('company_latitude', '!=', '')
->whereRaw('CAST(company_longitude AS DECIMAL(10,8)) BETWEEN -180 AND 180')
->whereRaw('CAST(company_latitude AS DECIMAL(10,8)) BETWEEN -90 AND 90')
->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');
}
]);
}
]);
// 根据排序字段进行排序
if ($sortName !== 'distance') {
$query->orderBy($sortName, $sortType);
}
$result = $query->paginate($pageSize, ['*'], 'page', $page);
// 在PHP中计算距离并优化性能
$latRad = deg2rad($latitude);
$lonRad = deg2rad($longitude);
$cosLat = cos($latRad);
$sinLat = sin($latRad);
foreach ($result->items() as $company) {
$companyLat = floatval($company->company_latitude);
$companyLon = floatval($company->company_longitude);
// 验证经纬度有效性
if ($companyLat < -90 || $companyLat > 90 || $companyLon < -180 || $companyLon > 180) {
$company->distance = null;
continue;
}
// 预计算三角函数值以提高性能
$companyLatRad = deg2rad($companyLat);
$companyLonRad = deg2rad($companyLon);
$acosInput = $cosLat * cos($companyLatRad) * cos($companyLonRad - $lonRad) +
$sinLat * sin($companyLatRad);
// 确保acos输入值在有效范围内
$acosInput = max(-1, min(1, $acosInput));
$distance = 6371 * acos($acosInput);
$company->distance = round($distance, 2); // 保留两位小数
}
// 如果按距离排序在PHP中排序
if ($sortName === 'distance') {
$items = $result->items();
usort($items, function ($a, $b) {
// 处理无效距离的情况
if ($a->distance === null && $b->distance === null)
return 0;
if ($a->distance === null)
return 1;
if ($b->distance === null)
return -1;
return $a->distance <=> $b->distance;
});
$result->setCollection(collect($items));
}
return $this->success($result);
}
}

@ -9,10 +9,56 @@ use Illuminate\Filesystem\Filesystem;
class Course extends SoftDeletesModel
{
protected $appends = ['date_status', 'publicize', 'sign_date_status', 'qrcode', 'teacher_detail'];
protected $appends = [
'date_status', 'publicize', 'sign_date_status', 'qrcode', 'teacher_detail',
'status_text', 'is_fee_text', 'is_arrange_text', 'show_txl_text', 'show_mobile_text', 'auto_schoolmate_text', 'is_virtual_text'
];
protected $casts = ['publicize_ids' => 'json'];
public function getStatusTextAttribute()
{
$array = [0 => '待发布', 1 => '已发布'];
return $array[$this->attributes['status']];
}
public function getIsFeeTextAttribute()
{
$array = [0 => '免费', 1 => '收费'];
return $array[$this->attributes['is_fee']];
}
public function getIsArrangeTextAttribute()
{
$array = [0 => '否', 1 => '是'];
return $array[$this->attributes['is_arrange']];
}
public function getShowTxlTextAttribute()
{
$array = [0 => '否', 1 => '是'];
return $array[$this->attributes['show_txl']];
}
public function getShowMobileTextAttribute()
{
$array = [0 => '否', 1 => '是'];
return $array[$this->attributes['show_mobile']];
}
public function getAutoSchoolmateTextAttribute()
{
$array = [0 => '否', 1 => '是'];
return $array[$this->attributes['auto_schoolmate']];
}
public function getIsVirtualTextAttribute()
{
$array = [0 => '否', 1 => '是'];
return $array[$this->attributes['is_virtual']];
}
public function getQrcodeAttribute($value)
{
return $this->getCourseQrcode($this->attributes['id']);

@ -61,6 +61,26 @@ class YuanheRepository
}
}
/**
* 公司模糊查询
*/
public function search($params)
{
$url = $this->baseUrl . '/master-service/openapi/businessCollege/enterprise/search';
$header = $this->getHeader();
try {
$result = httpCurl($url, 'GET', $params, $header);
$result = json_decode($result, true);
if ($result['code'] == 200) {
return $result['data'];
} else {
return false;
}
} catch (\Exception $e) {
return false;
}
}
/**
* 数据推送
*/

@ -80,13 +80,21 @@ class CourseContentEvaluationTestDataGenerator
// 为每个课程创建一个评价问卷
$evaluation = $this->createEvaluation($courseContents->first(), $course, $faker);
// 4) 为每个问卷生成问题字段(包含该课程的所有内容)
// 4) 为每个问卷生成问题字段
$allAsks = [];
$sort = 1;
// 为每个课程内容生成4个维度的问题1-6题
foreach ($courseContents as $courseContent) {
$asks = $this->createEvaluationAsks($evaluation, $courseContent, $course, 0, $faker);
$asks = $this->createCourseContentEvaluationAsks($evaluation, $courseContent, $course, $sort, $faker);
$allAsks = array_merge($allAsks, $asks);
$sort += 4; // 每个课程内容4个问题
}
// 添加课程级别的通用问题7-10题
$courseLevelAsks = $this->createCourseLevelAsks($evaluation, $course, $sort, $faker);
$allAsks = array_merge($allAsks, $courseLevelAsks);
// 5) 生成用户提交的表单数据
$formCount = $faker->numberBetween(10, min(40, $allUsers->count()));
$submittedUsers = $allUsers->random($formCount);
@ -131,14 +139,13 @@ class CourseContentEvaluationTestDataGenerator
}
/**
* 创建评价问题字段
* 创建课程内容的评价问题字段1-6题
*/
private function createEvaluationAsks(CourseContentEvaluation $evaluation, CourseContent $courseContent, Course $course, int $count, $faker): array
private function createCourseContentEvaluationAsks(CourseContentEvaluation $evaluation, CourseContent $courseContent, Course $course, int $startSort, $faker): array
{
$asks = [];
$fieldTemplates = $this->getEvaluationFieldTemplates();
// 为每个课程内容生成4个评价维度的问题(课程必要性、理论丰富程度、实践指导意义、讲授能力)
// 4个评价维度
$evaluationDimensions = [
'课程必要性',
'理论丰富程度',
@ -146,10 +153,8 @@ class CourseContentEvaluationTestDataGenerator
'讲授能力'
];
$sort = 1;
// 为每个评价维度创建问题,每个维度都包含课程内容标题
foreach ($evaluationDimensions as $dimension) {
// 为每个评价维度创建问题
foreach ($evaluationDimensions as $index => $dimension) {
$ask = new CourseContentEvaluationAsk();
$ask->admin_id = $faker->numberBetween(1, 10);
$ask->department_id = $faker->numberBetween(1, 5);
@ -160,9 +165,15 @@ class CourseContentEvaluationTestDataGenerator
$ask->field = strtolower(str_replace(' ', '_', $dimension)) . '_' . $courseContent->id;
$ask->edit_input = 'radio';
$ask->rule = 'required';
$ask->sort = $sort++;
$ask->sort = $startSort + $index;
$ask->help = "请评价《{$courseContent->theme}》的{$dimension}";
$ask->select_item = ['很不满意', '不满意', '一般', '满意', '很满意'];
$ask->select_item = [
['key' => '很不满意', 'value' => '很不满意'],
['key' => '不满意', 'value' => '不满意'],
['key' => '一般', 'value' => '一般'],
['key' => '满意', 'value' => '满意'],
['key' => '很满意', 'value' => '很满意']
];
$ask->need_fill = true;
$ask->belong_user = false;
$ask->allow_input = false;
@ -171,56 +182,77 @@ class CourseContentEvaluationTestDataGenerator
$asks[] = $ask;
}
// 添加建议类问题
$suggestionTemplates = array_filter($fieldTemplates, function ($template) {
return $template['edit_input'] === 'textarea';
});
foreach ($suggestionTemplates as $template) {
$ask = new CourseContentEvaluationAsk();
$ask->admin_id = $faker->numberBetween(1, 10);
$ask->department_id = $faker->numberBetween(1, 5);
$ask->course_id = $course->id;
$ask->course_content_id = $courseContent->id;
$ask->course_content_evaluation_id = $evaluation->id;
$ask->name = $template['name'];
$ask->field = $template['field'];
$ask->edit_input = $template['edit_input'];
$ask->rule = $template['rule'];
$ask->sort = $sort++;
$ask->help = $template['help'];
$ask->select_item = $template['select_item'];
$ask->need_fill = $template['need_fill'];
$ask->belong_user = $template['belong_user'];
$ask->allow_input = $template['allow_input'];
$ask->save();
return $asks;
}
$asks[] = $ask;
}
/**
* 创建课程级别的通用问题字段7-10题
*/
private function createCourseLevelAsks(CourseContentEvaluation $evaluation, Course $course, int $startSort, $faker): array
{
$asks = [];
// 添加姓名字段
$nameTemplate = array_filter($fieldTemplates, function ($template) {
return $template['field'] === 'student_name';
});
// 课程级别的通用问题模板
$courseLevelQuestions = [
[
'name' => '您对本次培训的课程及老师的资料、专业性等方面有哪些建议?',
'field' => 'course_teacher_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出您对课程和老师的建议',
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '您对培训专题、课程内容、授课师资及形式等方面有哪些建议?',
'field' => 'training_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出您对培训各方面的建议',
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '其他建议',
'field' => 'other_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出其他建议',
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '如果您愿意,请留下您的姓名(选填)',
'field' => 'student_name',
'edit_input' => 'text',
'rule' => '',
'help' => '这将帮助我们更好地整理反馈并与您沟通',
'need_fill' => false,
'belong_user' => true,
'allow_input' => false
]
];
if (!empty($nameTemplate)) {
$template = reset($nameTemplate);
foreach ($courseLevelQuestions as $index => $question) {
$ask = new CourseContentEvaluationAsk();
$ask->admin_id = $faker->numberBetween(1, 10);
$ask->department_id = $faker->numberBetween(1, 5);
$ask->course_id = $course->id;
$ask->course_content_id = $courseContent->id;
$ask->course_content_id = null; // 课程级别问题,不关联具体课程内容
$ask->course_content_evaluation_id = $evaluation->id;
$ask->name = $template['name'];
$ask->field = $template['field'];
$ask->edit_input = $template['edit_input'];
$ask->rule = $template['rule'];
$ask->sort = $sort++;
$ask->help = $template['help'];
$ask->select_item = $template['select_item'];
$ask->need_fill = $template['need_fill'];
$ask->belong_user = $template['belong_user'];
$ask->allow_input = $template['allow_input'];
$ask->name = $question['name'];
$ask->field = $question['field'];
$ask->edit_input = $question['edit_input'];
$ask->rule = $question['rule'];
$ask->sort = $startSort + $index;
$ask->help = $question['help'];
$ask->select_item = null;
$ask->need_fill = $question['need_fill'];
$ask->belong_user = $question['belong_user'];
$ask->allow_input = $question['allow_input'];
$ask->save();
$asks[] = $ask;
@ -287,102 +319,7 @@ class CourseContentEvaluationTestDataGenerator
return $faker->randomElement($descriptions);
}
/**
* 获取评价字段模板
*/
private function getEvaluationFieldTemplates(): array
{
return [
[
'name' => '课程必要性',
'field' => 'course_necessity',
'edit_input' => 'radio',
'rule' => 'required',
'help' => '请评价该课程的必要性',
'select_item' => ['很不满意', '不满意', '一般', '满意', '很满意'],
'need_fill' => true,
'belong_user' => false,
'allow_input' => false
],
[
'name' => '理论丰富程度',
'field' => 'theory_richness',
'edit_input' => 'radio',
'rule' => 'required',
'help' => '请评价课程理论的丰富程度',
'select_item' => ['很不满意', '不满意', '一般', '满意', '很满意'],
'need_fill' => true,
'belong_user' => false,
'allow_input' => false
],
[
'name' => '实践指导意义',
'field' => 'practical_guidance',
'edit_input' => 'radio',
'rule' => 'required',
'help' => '请评价课程的实践指导意义',
'select_item' => ['很不满意', '不满意', '一般', '满意', '很满意'],
'need_fill' => true,
'belong_user' => false,
'allow_input' => false
],
[
'name' => '讲授能力',
'field' => 'teaching_ability',
'edit_input' => 'radio',
'rule' => 'required',
'help' => '请评价老师的讲授能力',
'select_item' => ['很不满意', '不满意', '一般', '满意', '很满意'],
'need_fill' => true,
'belong_user' => false,
'allow_input' => false
],
[
'name' => '您对本次培训的课程及老师的资料、专业性等方面有哪些建议?',
'field' => 'course_teacher_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出您对课程和老师的建议',
'select_item' => null,
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '您对培训专题、课程内容、授课师资及形式等方面有哪些建议?',
'field' => 'training_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出您对培训各方面的建议',
'select_item' => null,
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '其他建议',
'field' => 'other_suggestions',
'edit_input' => 'textarea',
'rule' => '',
'help' => '请提出其他建议',
'select_item' => null,
'need_fill' => false,
'belong_user' => false,
'allow_input' => true
],
[
'name' => '如果您愿意,请留下您的姓名(选填)',
'field' => 'student_name',
'edit_input' => 'text',
'rule' => '',
'help' => '这将帮助我们更好地整理反馈并与您沟通',
'select_item' => null,
'need_fill' => false,
'belong_user' => true,
'allow_input' => false
]
];
}
/**
* 根据字段类型生成对应的值
@ -392,12 +329,27 @@ class CourseContentEvaluationTestDataGenerator
switch ($ask->edit_input) {
case 'radio':
case 'select':
return $faker->randomElement($ask->select_item ?? []);
$selectItems = $ask->select_item ?? [];
if (is_array($selectItems) && !empty($selectItems) && isset($selectItems[0]['key'])) {
// key-value 格式
$selectedItem = $faker->randomElement($selectItems);
return $selectedItem['key'];
} else {
// 兼容旧格式
return $faker->randomElement($selectItems);
}
case 'checkbox':
$options = $ask->select_item ?? [];
$selected = $faker->randomElements($options, $faker->numberBetween(1, min(3, count($options))));
return implode(',', $selected);
if (is_array($options) && !empty($options) && isset($options[0]['key'])) {
// key-value 格式
$selected = $faker->randomElements($options, $faker->numberBetween(1, min(3, count($options))));
return implode(',', array_column($selected, 'key'));
} else {
// 兼容旧格式
$selected = $faker->randomElements($options, $faker->numberBetween(1, min(3, count($options))));
return implode(',', $selected);
}
case 'textarea':
$suggestions = [
@ -439,9 +391,10 @@ class CourseContentEvaluationTestDataGenerator
*/
private function createSampleCoursesAndContents($faker): void
{
// 使用演示问卷中的真实课程数据
$courseData = [
[
'title' => '苏州市科技企业资本运作研修班',
'title' => '首期苏州市科技企业资本运作研修班(攀峰班)',
'contents' => [
'《资本市场深化改革背景下,私募股权基金的专业化发展路径与企业家资本战略选择》——王建平老师',
'《科技创新产业现状与未来趋势(深圳创新实践案例)》——梁永生老师',

@ -246,6 +246,8 @@ Route::group(["namespace" => "Mobile", "prefix" => "mobile"], function () {
Route::get('other/banner', [\App\Http\Controllers\Mobile\OtherController::class, "banner"]);
// 公司查询
Route::get('other/company', [\App\Http\Controllers\Mobile\OtherController::class, "company"]);
// 公司查询
Route::get('other/company-list', [\App\Http\Controllers\Mobile\OtherController::class, "companyList"]);
// 通知
Route::get('course/notices', [\App\Http\Controllers\Mobile\CourseController::class, "notices"]);
// 课程

Binary file not shown.
Loading…
Cancel
Save