更新用户打款

This commit is contained in:
yaooo 2023-11-03 15:52:42 +08:00
parent 074c65e3db
commit 619b60c275
1 changed files with 30 additions and 1 deletions

View File

@ -506,7 +506,7 @@ class FinanceExpense extends ApiController
$this->uid = JWT_UID;
$auth = isAuthExpense($this->uid);
if($auth == 0){
$this->apiError('没有权限');
$this->apiError('没有权限请联系管理员或者HR');
}
$param = get_params();
$where = [];
@ -526,4 +526,33 @@ class FinanceExpense extends ApiController
$this->apiSuccess($list);
}
//报销设置为已打款
public function topay()
{
$param = get_params();
$this->uid = JWT_UID;
$auth = isAuthExpense($this->uid);
if($auth == 0){
$this->apiError('你没有打款权限请联系管理员或者HR');
}
$param['check_status'] = 5;
$param['pay_admin_id'] = $this->uid;
$param['pay_time'] = time();
$res = Expense::where('id', $param['id'])->strict(false)->field(true)->update($param);
if ($res !== false) {
add_log('topay', $param['id'],$param,'报销');
$detail = Expense::where(['id' => $param['id']])->find();
$msg=[
'create_time'=>$detail['create_time'],
'title'=>'报销',
'action_id'=>$detail['id']
];
$users = $detail['admin_id'];
sendMessage($users, 34, $msg);
$this->apiSuccess('操作成功');
} else {
$this->apiError('操作失败');
}
}
}