From f2a13e01e8843302dfb2e80fe18edec3a4ba137f Mon Sep 17 00:00:00 2001 From: YM <479443481@qq.com> Date: 星期一, 10 三月 2025 00:58:19 +0800 Subject: [PATCH] 考勤组的增加已经表单逻辑 --- app/user/controller/Api.php | 38 +++++++++++++++++++++++++++----------- 1 files changed, 27 insertions(+), 11 deletions(-) diff --git a/app/user/controller/Api.php b/app/user/controller/Api.php index 61c6bfe..2017dd6 100644 --- a/app/user/controller/Api.php +++ b/app/user/controller/Api.php @@ -10,7 +10,7 @@ * @Author 鍕捐偂宸ヤ綔瀹� <hdm58@qq.com> +----------------------------------------------------------------------------------------------- */ -declare (strict_types = 1); +declare(strict_types=1); namespace app\user\controller; use app\api\BaseController; @@ -22,22 +22,38 @@ public function del_profiles() { $id = get_params("id"); - if (Db::name('AdminProfiles')->where('id', $id)->update(['delete_time'=>time()]) !== false) { - return to_assign(0, "鍒犻櫎鎴愬姛"); - } else { - return to_assign(1, "鍒犻櫎澶辫触"); - } + if (Db::name('AdminProfiles')->where('id', $id)->update(['delete_time' => time()]) !== false) { + return to_assign(0, "鍒犻櫎鎴愬姛"); + } else { + return to_assign(1, "鍒犻櫎澶辫触"); + } } //鍒犻櫎鐝鑰冨嫟鏃堕棿 public function del_work_plan_time() { $id = get_params("id"); - if (Db::name('AttendanceWorkTime')->where('id', $id)->update(['is_del'=>1]) !== false) { - return to_assign(0, "鍒犻櫎鎴愬姛"); - } else { - return to_assign(1, "鍒犻櫎澶辫触"); - } + if (Db::name('AttendanceWorkTime')->where('id', $id)->update(['is_del' => 1]) !== false) { + return to_assign(0, "鍒犻櫎鎴愬姛"); + } else { + return to_assign(1, "鍒犻櫎澶辫触"); + } } + //鑾峰彇鐝鍒楄〃 + public function get_work_plan() + { + $list = Db::name('AttendanceWorkPlan')->where('is_del', '=', 0)->order('create_time asc')->select()->each(function ($item, $key) { + $item['create_time'] = date('Y-m-d H:i:s', $item['create_time']); + $item['update_time'] = $item['update_time'] > 0 ? date('Y-m-d H:i:s', $item['update_time']) : ""; + return $item; + })->toArray(); + foreach ($list as &$val) { + $mappingTimes = Db::name('AttendanceWorkPlanWorkTimeLink')->where(['work_plan_id' => $val['id']])->column('work_time_id'); + $times = Db::name('AttendanceWorkTime')->where('id', 'in', $mappingTimes)->where('is_del', '=', 0)->select()->toArray(); + $val['times'] = $times; + } + $res['data'] = $list; + return table_assign(0, '', $res); + } } -- Gitblit v1.9.1