$orgId, 'user_id' => $userId, 'apply_id' => $id, 'dep_id' => $extra['depId'], 'create_time' => date('Y-m-d H:i:s'), 'status' => 0, 'year' => date('Y') ]; foreach ($formJson as $k=>$v){ if($v['componentName'] == 'ddpostfield'){ foreach ($v['components'] as $key=>$val){ switch ($val['idx']){ case '0': $values = isset($val['values'])?$val['values']:''; if($values == '发改基建' || $values == '发改基人'){ $data['name'] = $values; $data['type'] = $values; }else{ $val = explode('[',$values); $val2 = explode(']',$val[1]); $data['name'] = $values; $data['type'] = $val[0]; $data['sn'] = $val2[0]; } break; case '1': $data['send_date'] = isset($val['values'])?$val['values']:null; break; } } break; } } $ret = Db::name('post_apply')->insert($data); return $ret?true:false; } public function advancedEndPostApply($id,$orgId,$userId,$formJson){ $data = [ 'update_time' => date('Y-m-d H:i:s'), 'status' => 1 ]; $ret = Db::name('post_apply')->where('apply_id',$id)->update($data); return $ret?true:false; } public function advancedDisagreePostApply($id){ $data = [ 'update_time' => date('Y-m-d H:i:s'), 'status' => 2 ]; $ret = Db::name('post_apply')->where('apply_id',$id)->update($data); return $ret?true:false; } public function lists($page,$size,$type,$orgId){ $map[] = ['status','=',1]; $map[] = ['org_id','=',$orgId]; if($type != ''){ $map[] = ['type','=',$type]; } $lists = Db::name('post_apply') ->where($map) ->page($page,$size) ->order('id desc') ->select(); $lists = $lists?$lists:[]; foreach ($lists as $k=>$v){ $lists[$k]['userName'] = Db::name('user_info')->where('user_id',$v['user_id'])->value('name'); $lists[$k]['depName'] = Db::name('dep')->where('id',$v['dep_id'])->value('name'); } $total = Db::name('post_apply')->where($map)->count(); $data = [ 'total' => $total, 'list' => $lists?$lists:[] ]; return $data; } }