From 074c65e3dbd39bb976ff2102d73dd9fc15d24e5b Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Fri, 3 Nov 2023 15:44:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=8A=A5=E9=94=80=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/common.php | 13 +++++++++++++ app/api/controller/FinanceExpense.php | 27 +++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/app/api/common.php b/app/api/common.php index 25ee91f..dc04ebe 100644 --- a/app/api/common.php +++ b/app/api/common.php @@ -91,3 +91,16 @@ function get_position_column() $position = Db::name('Position')->where(['status' => 1])->column('title', 'id'); return $position; } + +//是否是报销打款管理员,count>1即有权限 +function isAuthExpense($uid) +{ + if($uid == 1){ + return 1; + } + $map = []; + $map[] = ['name', '=', 'finance_admin']; + $map[] = ['', 'exp', Db::raw("FIND_IN_SET('{$uid}',uids)")]; + $count = Db::name('DataAuth')->where($map)->count(); + return $count; +} diff --git a/app/api/controller/FinanceExpense.php b/app/api/controller/FinanceExpense.php index d08b0cf..1594324 100644 --- a/app/api/controller/FinanceExpense.php +++ b/app/api/controller/FinanceExpense.php @@ -499,4 +499,31 @@ class FinanceExpense extends ApiController $this->apiError('删除失败'); } } + + //报销打款 + public function checkedlist() + { + $this->uid = JWT_UID; + $auth = isAuthExpense($this->uid); + if($auth == 0){ + $this->apiError('没有权限'); + } + $param = get_params(); + $where = []; + if (!empty($param['check_status'])) { + $where[] = ['check_status','=',$param['check_status']]; + } + else{ + $where[] = ['check_status','in',[2,5]]; + } + //按时间检索 + if (!empty($param['diff_time'])) { + $diff_time =explode('~', $param['diff_time']); + $where[] = ['expense_time', 'between', [strtotime(urldecode($diff_time[0])),strtotime(urldecode($diff_time[1]))]]; + } + $model = new ExpenseList; + $list = $model->get_list($param,$where); + $this->apiSuccess($list); + } + }