Update Saqel Platform: 2026-08-28 15:19:58

This commit is contained in:
Hamza-Ayed
2026-08-28 15:19:58 +03:00
parent 06461635bf
commit 070e80ea30
4 changed files with 30 additions and 40 deletions
+10 -21
View File
@@ -21,33 +21,22 @@ class TeacherController
$teacher = Database::selectOne("SELECT id, uuid, full_name, specialization, bio, is_marketplace_public FROM teachers WHERE id = ? LIMIT 1", [$teacherId]);
if (!$teacher) {
// Auto create teacher record if not exists
$tUuid = sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x', mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0x0fff) | 0x4000, mt_rand(0, 0x3fff) | 0x8000, mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff));
$tId = Database::insert(
"INSERT INTO teachers (uuid, full_name, specialization, bio, is_marketplace_public) VALUES (?, 'الأستاذ المعتمد', 'الرياضيات العلمي', 'معلم معتمد في منصة صَقِل', 1)",
[$tUuid]
);
$teacher = [
'id' => $tId,
'uuid' => $tUuid,
'full_name' => 'الأستاذ المعتمد',
'specialization' => 'الرياضيات العلمي',
'bio' => 'معلم معتمد في منصة صَقِل'
];
$response->status(401)->json([
'status' => 'error',
'message' => 'حساب المعلم غير مسجل أو يتطلب تسجيل الدخول',
'is_completed' => false
]);
return;
}
$rawName = (string)($teacher['full_name'] ?? '');
$decryptedName = Security::decrypt($rawName) ?: $rawName;
if (empty($decryptedName)) {
$decryptedName = 'الأستاذ المعتمد';
}
$isCompleted = !empty($teacher['full_name']) && $teacher['full_name'] !== 'معلم جديد' && !empty($teacher['specialization']) && $teacher['specialization'] !== 'بانتظار تحديد التخصص';
$response->json([
'status' => 'success',
'is_completed' => true,
'is_completed' => $isCompleted,
'user' => [
'uuid' => $teacher['uuid'],
'full_name' => $decryptedName,
'full_name' => $teacher['full_name'],
'role' => 'teacher',
'status' => 'active',
],