|
|
|
@ -132,7 +132,7 @@ class Attendance extends BaseApiService |
|
|
|
if($leave_id_arr){ |
|
|
|
$update = \app\model\attendance\Attendance::whereIn('id',$leave_id_arr)->update([ |
|
|
|
'leave_end_time'=>$date_h, |
|
|
|
'updated_at'=>$date_h, |
|
|
|
'updated_at'=>date('Y-m-d H:i:s'), |
|
|
|
]); |
|
|
|
if(!$update){ |
|
|
|
// Db::rollback(); |
|
|
|
@ -159,13 +159,28 @@ class Attendance extends BaseApiService |
|
|
|
return success($res['data']); |
|
|
|
}catch (\Exception $e){ |
|
|
|
Db::rollback(); |
|
|
|
dd(123123,$e->getMessage()); |
|
|
|
return fail('操作失败'); |
|
|
|
} |
|
|
|
} |
|
|
|
//判断是签退 |
|
|
|
if($status == 'sign_out'){ |
|
|
|
if($info['attendance_date'] != $attendance_date && $info['status'] != 'present'){ |
|
|
|
return fail('为找到今日签到记录'); |
|
|
|
if(!empty($id)){ |
|
|
|
$info = \app\model\attendance\Attendance::where('id',$id)->find(); |
|
|
|
}else{ |
|
|
|
$info = \app\model\attendance\Attendance::where('attendance_date',$attendance_date) |
|
|
|
->where('check_out_time',null) |
|
|
|
->where('status','present') |
|
|
|
->where('staff_id',$staff_id); |
|
|
|
if($campus_id){ |
|
|
|
$info = $info->where('campus_id',$campus_id); |
|
|
|
} |
|
|
|
$info = $info->find(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(!$info){ |
|
|
|
return fail('为找到签到记录'); |
|
|
|
} |
|
|
|
|
|
|
|
//签退的情况 |
|
|
|
|