|
@@ -164,4 +164,77 @@ class TimbreService
|
|
return (array)$value;
|
|
return (array)$value;
|
|
})->toArray();
|
|
})->toArray();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ public function timbreGroupList($data) {
|
|
|
|
+ $group_name = getProp($data, 'group_name');
|
|
|
|
+ $label = getProp($data, 'label');
|
|
|
|
+
|
|
|
|
+ $query = DB::table('mp_timbre_groups')->select('*');
|
|
|
|
+
|
|
|
|
+ if ($group_name) {
|
|
|
|
+ $query->where('group_name', 'like', "%{$group_name}%");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($label) {
|
|
|
|
+ $query->where('label', 'like', $label);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return $query->orderBy('id')->paginate();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function addTimbreGroup($data) {
|
|
|
|
+ $group_name = getProp($data, 'group_name');
|
|
|
|
+ $male_lead_voice_name = getProp($data, 'male_lead_voice_name');
|
|
|
|
+ $male_lead_voice_type = getProp($data, 'male_lead_voice_type');
|
|
|
|
+ $female_lead_voice_name = getProp($data, 'female_lead_voice_name');
|
|
|
|
+ $female_lead_voice_type = getProp($data, 'female_lead_voice_type');
|
|
|
|
+ $narration_voice_name = getProp($data, 'narration_voice_name');
|
|
|
|
+ $narration_voice_type = getProp($data, 'narration_voice_type');
|
|
|
|
+ if (!$group_name || !$male_lead_voice_type || !$female_lead_voice_type || !$narration_voice_type) Utils::throwError('20003:参数错误');
|
|
|
|
+ $label = getProp($data, 'label');
|
|
|
|
+ $other_roles = getProp($data, 'other_roles');
|
|
|
|
+ if (DB::table('mp_timbre_groups')->where('group_name', $group_name)->value('id')) Utils::throwError('20003:该音色组已存在');
|
|
|
|
+
|
|
|
|
+ return DB::table('mp_timbre_groups')->insert([
|
|
|
|
+ 'group_name' => $group_name,
|
|
|
|
+ 'male_lead_voice_name' => $male_lead_voice_name,
|
|
|
|
+ 'male_lead_voice_type' => $male_lead_voice_type,
|
|
|
|
+ 'female_lead_voice_name' => $female_lead_voice_name,
|
|
|
|
+ 'female_lead_voice_type' => $female_lead_voice_type,
|
|
|
|
+ 'narration_voice_name' => $narration_voice_name,
|
|
|
|
+ 'narration_voice_type' => $narration_voice_type,
|
|
|
|
+ 'label' => $label,
|
|
|
|
+ 'other_roles' => $other_roles,
|
|
|
|
+ 'created_at' => date('Y-m-d H:i:s'),
|
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public function editTimbreGroup($data) {
|
|
|
|
+ $group_id = getProp($data, 'group_id');
|
|
|
|
+ $group_name = getProp($data, 'group_name');
|
|
|
|
+ $male_lead_voice_name = getProp($data, 'male_lead_voice_name');
|
|
|
|
+ $male_lead_voice_type = getProp($data, 'male_lead_voice_type');
|
|
|
|
+ $female_lead_voice_name = getProp($data, 'female_lead_voice_name');
|
|
|
|
+ $female_lead_voice_type = getProp($data, 'female_lead_voice_type');
|
|
|
|
+ $narration_voice_name = getProp($data, 'narration_voice_name');
|
|
|
|
+ $narration_voice_type = getProp($data, 'narration_voice_type');
|
|
|
|
+ if (!$group_id || !$group_name || !$male_lead_voice_type || !$female_lead_voice_type || !$narration_voice_type) Utils::throwError('20003:参数错误');
|
|
|
|
+ $label = getProp($data, 'label');
|
|
|
|
+ $other_roles = getProp($data, 'other_roles');
|
|
|
|
+ if (DB::table('mp_timbre_groups')->where('group_name', $group_name)->value('id') != $group_id) Utils::throwError('20003:该音色组已存在');
|
|
|
|
+
|
|
|
|
+ return DB::table('mp_timbre_groups')->where('id', $group_id)->update([
|
|
|
|
+ 'group_name' => $group_name,
|
|
|
|
+ 'male_lead_voice_name' => $male_lead_voice_name,
|
|
|
|
+ 'male_lead_voice_type' => $male_lead_voice_type,
|
|
|
|
+ 'female_lead_voice_name' => $female_lead_voice_name,
|
|
|
|
+ 'female_lead_voice_type' => $female_lead_voice_type,
|
|
|
|
+ 'narration_voice_name' => $narration_voice_name,
|
|
|
|
+ 'narration_voice_type' => $narration_voice_type,
|
|
|
|
+ 'label' => $label,
|
|
|
|
+ 'other_roles' => $other_roles,
|
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s'),
|
|
|
|
+ ]);
|
|
|
|
+ }
|
|
}
|
|
}
|