select( 'id', 'open_vc_id', 'type', 'customer_data', 'created_at', 'workstation_name', 'workstation_id', 'open_vt_id', 'vt_title' ); // 使用 whereIn 方法筛选 lecture_id 在 $lectureIdArr 数组中的记录 // 搜索 if (isset($condition['keywords']) && $condition['keywords']) { $query->where('customer_data', 'like', '%' . $condition['keywords'] . '%'); } // 排序 $query->orderBy($sort, $sortable); // 执行查询并返回结果 return self::JsonPage($query); } public function report($data) { if($data['customer_data']) { $customerData = json_decode($data['customer_data'], true); foreach($customerData as $v){ $insertData[]=[ 'open_vc_id' =>$v['open_vc_id'], 'type' =>$data['type'], 'customer_data' =>json_encode($v), 'created_at' =>date('Y-m-d H:i:s'), 'updated_at' =>date('Y-m-d H:i:s'), 'workstation_id'=>auth('grider')->user()->workstation_id, 'workstation_name'=>auth('grider')->user()->workstation_name, 'open_vt_id' => $v['vt_id'], 'vt_title' => $v['vt_title'], ]; } $res = GroupTherapyRecord::insert($insertData); return $res; } return true; } }