value('company_id'); try { TaskSchedulingPlan::create([ 'create_user_id' => $params['create_user_id'], 'company_id' => $company_id, 'template_id' => $params['template_id'], 'scheduling_id' => $params['scheduling_id'], 'start_time' => $params['start_time'], 'end_time' => $params['end_time'], 'sn' =>User::createUserSn(), 'status' => 1 ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑任务排期日历 * @param array $params * @return bool * @author likeadmin * @date 2023/08/08 10:34 */ public static function edit(array $params): bool { Db::startTrans(); $company_id=TaskScheduling::where('id',$params['scheduling_id'])->value('company_id'); try { TaskSchedulingPlan::where('id', $params['id'])->update([ 'company_id' => $company_id, 'create_user_id' => $params['create_user_id'], 'template_id' => $params['template_id'], 'scheduling_id' => $params['scheduling_id'], 'start_time' => $params['start_time'], 'end_time' => $params['end_time'], 'status' => $params['status'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除任务排期日历 * @param array $params * @return bool * @author likeadmin * @date 2023/08/08 10:34 */ public static function delete(array $params): bool { Task::where('scheduling_plan_id',$params['id'])->delete(); return TaskSchedulingPlan::destroy($params['id']); } /** * @notes 获取任务排期日历详情 * @param $params * @return array * @author likeadmin * @date 2023/08/08 10:34 */ public static function detail($params): array { $data=TaskSchedulingPlan::findOrEmpty($params['id'])->toArray(); $data['task_info']=TaskTemplate::where('id',$data['template_id'])->with('dataType')->find(); return $data; } }