$params['dataid'], 'num' => $params['num'], 'project' => $params['project'], 'project_num' => $params['project_num'], 'head' => $params['head'], 'apptime' => $params['apptime'], 'annex' => $params['annex'], ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑 * @param array $params * @return bool * @author likeadmin * @date 2024/02/22 10:47 */ public static function edit(array $params): bool { Db::startTrans(); try { TaskAllocation::where('id', $params['id'])->update([ 'dataid' => $params['dataid'], 'num' => $params['num'], 'project' => $params['project'], 'project_num' => $params['project_num'], 'head' => $params['head'], 'apptime' => $params['apptime'], 'annex' => $params['annex'], ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除 * @param array $params * @return bool * @author likeadmin * @date 2024/02/22 10:47 */ public static function delete(array $params): bool { return TaskAllocation::destroy($params['id']); } /** * @notes 获取详情 * @param $params * @return array * @author likeadmin * @date 2024/02/22 10:47 */ public static function detail($params): array { return TaskAllocation::findOrEmpty($params['id'])->toArray(); } }