1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace app\common\model;
- use app\hander\HelpHander;
- use think\Db;
- use think\Model;
- class AttendanceReissue extends Model
- {
- public function advancedStartReissue($id,$orgId,$userId,$formJson){
- $formJson = json_decode($formJson,true);
- $data = [
- 'org_id' => $orgId,
- 'user_id' => $userId,
- 'apply_id' => $id,
- 'create_time' => date('Y-m-d H:i:s'),
- 'status' => 0,
- ];
- foreach ($formJson as $k=>$v){
- if($v['componentName'] == 'ddremakecardfield'){
- foreach ($v['components'] as $key=>$val){
- switch ($val['idx']){
- case '0':
- $dtime = json_decode($val['values'],true);
- $data['kq_time'] = $dtime['id'];
- break;
- case '1':
- $data['signtime'] = $val['values'];
- break;
- }
- }
- break;
- }
- }
- $data['month'] = date('Ym',strtotime($data['kq_time']));
- $ret = Db::name('attendance_reissue')->insert($data);
- return $ret?true:false;
- }
- public function advancedEndReissue($id,$orgId,$userId,$formJson){
- $info = Db::name('attendance_reissue')->where('apply_id',$id)->find();
- $data = [
- 'update_time' => date('Y-m-d H:i:s'),
- 'status' => 1
- ];
- // 更新考勤记录
- $res = model('AttendanceRecord')->reissue($userId,$orgId,$info['kq_time'],$info['signtime']);
- if(!$res){
- return false;
- }
- $ret = Db::name('attendance_reissue')->where('apply_id',$id)->update($data);
- return $ret?true:false;
- }
- public function advancedDisagreeReissue($applyId){
- $data = [
- 'update_time' => date('Y-m-d H:i:s'),
- 'status' => 2
- ];
- $ret = Db::name('attendance_reissue')->where('apply_id',$applyId)->update($data);
- return $ret?true:false;
- }
- }
|