1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539 |
- <?php
- namespace app\admin\controller\project;
- use app\admin\BaseController;
- use app\admin\model\CostProject as CostProjectModel;
- use app\admin\model\ProjectAudit as AuditModel;
- use app\admin\model\ProjectMsg;
- use app\admin\model\ProjectReport;
- use app\admin\validate\project\CostProjectValidate;
- use think\db\exception\DbException;
- use think\db\Where;
- use think\exception\ValidateException;
- use think\facade\Db;
- use think\facade\Session;
- use think\facade\View;
- use think\App;
- use app\admin\controller\field\Field;
- use app\wechat\controller\Officialaccount;
- use app\admin\controller\Pushmessage;
- /*
- * 待审核项目
- */
- class Audit extends BaseController
- {
- public function __construct(App $app)
- {
- parent::__construct($app);
- $this->Field = new Field($this->app);
- $this->model = new CostProjectModel();
- $this->Auditmodel = new AuditModel();
- $this->ProjectMsg = new ProjectMsg();
- $this->uid = get_login_admin('id');
- $this->Officialaccount = new Officialaccount();
- $this->Pushmessage = new Pushmessage();
- }
- public function datalist()//财政局审核列表
- {
- //搜索
- if (request()->isAjax()) {
- $param = get_params();//获取内容
- $where = [
- ["cp_project_audit.approver", "=", $this->uid],//审批人的id
- ["cp_project_audit.audit_type", "<", 4]
- ];
- if(!empty($param["keywords"])){
- $where[] = ["c.review_unit_name|c.engineering_type|a.project_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];//分页数据条数
- $order = empty($param['order']) ? 'id desc' : $param['order'];//排序方式
- //将表a与表c通过a.project_id=c.id左关联,查a就能查到c中相关数据
- $list2 = $this->Auditmodel->alias('a')->join("cost_project c", "a.project_id=c.id", 'left')
- /*查询字段*/ ->field("a.*,c.project_status,c.sent_review_amount,c.engineering_type,c.review_unit_name")->where($where)->order($order)
- ->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- if ($item->audit_type ==1){//一开始不显示二审
- if (isset($item->c['entrust_second_approver'])){
- $audit_status =Db::name(Auditmodel)->where("audit_name" ,"项目分配审核一审")->value("audit_status");
- if ($audit_status=1){
- $item->whereNotIn('audit_name', ['项目分配审核二审']);
- }
- }
- }
- if ($item->audit_type == 2) {//报告//else_id=>报告id
- $a = Db::name("project_report")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- } elseif ($item->audit_type == 3) {//联系函//else_id=>项目联系函id
- $a = Db::name("contact")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- }
- });
- return table_assign(0, '', $list2);
- } else {
- return view();
- }
- }
- /**
- *
- * 公司审核列表
- */
- public function datalist_company()
- {
- if (request()->isAjax()) {
- $param = get_params();
- //audit_type 1项目,2报告,3联系函,4公司一级审核,5公司二级审核,6公司三级审核
- //audit_status 审批状态 1.待审核,2已通过,3已拒绝,4作废,5待启用
- $where = [
- ["a.approver", "=", $this->uid],
- ["a.audit_type", ">", 3],
- ["a.audit_status", "<", 5]
- ];
- if(!empty($param["keywords"])){
- $where[] = ["c.entrust_unit_name|c.engineering_type|a.project_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $list2 = $this->Auditmodel->alias('a')->join("cost_project c", "a.project_id=c.id", 'left')
- ->field("a.*,c.project_status,c.sent_review_amount,c.engineering_type,c.review_unit_name")->where($where)->order($order)
- ->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- switch ($item["audit_type"]) {
- case 4:
- case 5:
- case 6:
- case 14:
- case 15:
- $item->else_name = Db::name("project_report")->where("id", $item["else_id"])->value("title");
- break;
- case 9:
- case 8:
- case 7:
- $item->else_name = Db::name("contact")->where("id", $item["else_id"])->value("title");
- break;
- case 10:
- $item->else_name = "请款一级审核";
- break;
- case 11:
- $item->else_name = "请款二级审核";
- break;
- case 12:
- $item->else_name = "请款三级审核";
- break;
- }
- });
- return table_assign(0, '', $list2);
- } else {
- return view();
- }
- }
- public function datalist_proprietor()//业主审核列表
- {
- if (request()->isAjax()) {
- $param = get_params();
- $where = [
- ["cp_project_audit.approver", "=", $this->uid],//审批人是登录的
- ["cp_project_audit.audit_type", "<", 4]//
- ];
- if(!empty($param["keywords"])){
- $where[] = ["c.review_unit_name|c.engineering_type|a.project_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $list2 = $this->Auditmodel->alias('a')->join("cost_project c", "a.project_id=c.id", 'left')
- ->field("a.*,c.project_status,c.sent_review_amount,c.engineering_type,c.review_unit_name")->where($where)->order($order)
- ->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- if ($item->audit_type == 2) {//报告
- $a = Db::name("project_report")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- } elseif ($item->audit_type == 3) {//联系函
- $a = Db::name("contact")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- }
- });
- return table_assign(0, '', $list2);
- } else {
- return view();
- }
- }
- /**
- * 财评首页待审核列表
- */
- public function list()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $where = [
- ["cp_project_audit.approver", "=", $this->uid],
- ["cp_project_audit.audit_type", "<", 4],
- ["cp_project_audit.audit_status", "=", 1],
- ];
- if(!empty($param["keywords"])){
- $where[] = ["c.review_unit_name|c.engineering_type|a.project_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $list2 = $this->Auditmodel->alias('a')->join("cost_project c", "a.project_id=c.id", 'left')
- ->field("a.*,c.project_status,c.sent_review_amount,c.engineering_type,c.review_unit_name")->where($where)->order($order)
- ->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- if ($item->audit_type == 2) {
- $a = Db::name("project_report")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- } elseif ($item->audit_type == 3) {
- $a = Db::name("contact")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- }
- });
- return table_assign(0, '', $list2);
- } else {
- return view();
- }
- }
- /**
- * 业主首页待审核列表
- */
- public function proprietor_list()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $where = [
- ["cp_project_audit.approver", "=", $this->uid],
- ["cp_project_audit.audit_type", "<", 4],
- ["cp_project_audit.audit_status", "=", 1],
- ];
- if(!empty($param["keywords"])){
- $where[] = ["c.review_unit_name|c.engineering_type|a.project_name","like","%".$param["keywords"]."%"];
- }
- $rows = empty($param['limit']) ? get_config('app . page_size') : $param['limit'];
- $order = empty($param['order']) ? 'id desc' : $param['order'];
- $list2 = $this->Auditmodel->alias('a')->join("cost_project c", "a.project_id=c.id", 'left')
- ->field("a.*,c.project_status,c.sent_review_amount,c.engineering_type,c.review_unit_name")->where($where)->order($order)
- ->paginate($rows, false, ['query' => $param])
- ->each(function ($item) {
- if ($item->audit_type == 2) {
- $a = Db::name("project_report")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- } elseif ($item->audit_type == 3) {
- $a = Db::name("contact")->where("id", $item->else_id)->field("title,status")->find();
- $item->else_name = $a["title"];
- $item->else_status = $a["status"];
- }
- });
- return table_assign(0, '', $list2);
- } else {
- return view();
- }
- }
- /**
- * 项目日志
- */
- public function project_log($project_id)
- {
- // $project_id = 24;
- $login_admin = get_login_admin();
- $where = array();
- if ($login_admin['user_type'] == 2) {
- $where = [
- ['project_status', '>=', 3],
- ['unit_name', '=', $login_admin['unit_name']],
- ];
- } else {
- if ($login_admin['permission'] != 1) {
- $where = [
- ['unit_name', '=', $login_admin['unit_name']],
- ];
- }
- }
- // dump($where);
- $project_log = Db::name('ProjectLog')->where($where)->where('project_id', $project_id)->order('create_time', 'desc')->select()->toArray();
- foreach ($project_log as $key => $value) {
- $project_log[$key]['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
- }
- // dump($project_log);
- // View::assign('project_log', $project_log);
- // return View();
- return $project_log;
- }
- /**
- * 查看信息
- */
- public function read()
- {
- $param = get_params();
- $id = isset($param['id']) ? $param['id'] : 0;
- $detail = $this->model->getCostProjectById($id);
- $comment = Db::name("project_comment")->where("project_id", $id)->order('create_time', 'desc')->select();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'project'))
- ->select()->toArray();
- $report = Db::name("project_report")->where([["project_id", "=", $id], ["r.status", "=", 1]])->alias("r")->join("admin a", "r.maker_id = a.id")->field("r.*,a.nickname")->select();
- // halt($comment);
- $project_log = self::project_log($id);
- View::assign('project_log', $project_log);
- // halt($project_log);
- // 根据用户id 查询其能显示的字段
- $field = $this->Field->get_field_rules_new(get_login_admin('id'));
- //剩余时间
- $c = $detail['project_end_time'] - time();
- if ($c > 0) {
- $advent_time = floor($c / 86400) . "天";
- } else {
- $c = -$c;
- $advent_time = floor($c / 86400) . "天";
- }
- if (!empty($detail)) {
- View::assign('advent_time', $advent_time);
- View::assign('project_id', $id);
- View::assign('comment', $comment);
- View::assign('field', $field);
- View::assign('detail', $detail);
- View::assign('file_array', $file_array);
- View::assign('report', $report);
- View::assign('project_five', self::getProjectFive());
- return view();
- } else {
- throw new \think\exception\HttpException(404, '找不到页面');
- }
- }
- /**
- * 公司查看信息
- */
- public function read_company()
- {
- $param = get_params();
- if (request()->isAjax()) {
- $a = time();
- $id = isset($param["project_id"]) ? $param["project_id"] : $a;
- if ($id == $a) {
- $datas = array();
- $datas["data"] = null;
- return table_assign(0, "无项目", $datas);
- }
- $project = Db::name("appropriation_project")->where("uid", $id)->select();
- $datas["data"] = $project;
- $datas["total"] = count($project);
- return table_assign(0, "", $datas);
- } else {
- if ($param["type"] > 9) {
- $a = time();
- $id = isset($param["project_id"]) ? $param["project_id"] : $a;
- $detail = Db::name("appropriation")->where("id", $id)->find();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'appropriation'))
- ->select()->toArray();
- View::assign('id', $id);
- View::assign('detail', $detail);
- View::assign('file_array', $file_array);
- return view('c_read');
- } else {
- $id = isset($param['id']) ? $param['id'] : 0;
- $detail = $this->model->getCostProjectById($id);
- $comment = Db::name("project_comment")->where("project_id", $id)->order('create_time', 'desc')->select();
- $file_array = Db::name('ProjectFile')
- ->field('mf.id,mf.topic_id,mf.admin_id,f.name,f.filesize,f.filepath,f.fileext,f.create_time,f.admin_id,a.nickname as admin_name')
- ->alias('mf')
- ->join('File f', 'mf.file_id = f.id', 'LEFT')
- ->join('Admin a', 'mf.admin_id = a.id', 'LEFT')
- ->order('mf.create_time desc')
- ->where(array('mf.topic_id' => $id, 'mf.module' => 'project'))
- ->select()->toArray();
- $report = Db::name("project_report")->where([["project_id", "=", $id], ["r.status", "=", 1]])->alias("r")->join("admin a", "r.maker_id = a.id")->field("r.*,a.nickname")->select();
- // halt($comment);
- $project_log = self::project_log($id);
- View::assign('project_log', $project_log);
- // halt($project_log);
- // 根据用户id 查询其能显示的字段
- $field = $this->Field->get_field_rules_new(get_login_admin('id'));
- $c = $detail['project_end_time'] - time();
- if ($c > 0) {
- $advent_time = floor($c / 86400) . "天";
- } else {
- $c = -$c;
- $advent_time = floor($c / 86400) . "天";
- }
- if (!empty($detail)) {
- View::assign('advent_time', $advent_time);
- View::assign('detail', $detail);
- View::assign('project_id', $id);
- View::assign('comment', $comment);
- View::assign('file_array', $file_array);
- View::assign('report', $report);
- View::assign('field', $field);
- View::assign('project_five', self::getProjectFive_company());
- return view();
- } else {
- throw new \think\exception\HttpException(404, '找不到页面');
- }
- }
- }
- }
- public function getProjectFive_company()
- {
- $where = [
- ['name', '=', '作业日志-公司'],
- ['name', '=', '工作记录-公司'],
- ['name', '=', '项目报告-公司'],
- ['name', '=', '项目人员-公司'],
- ['name', '=', '项目动态-公司'],
- ['name', '=', '项目附件-公司'],
- ['name', '=', '联系函-公司'],
- ];
- $list = Db::name('AdminRule')->whereOr($where)->field('id,name')->select()->toArray();
- $group_id = Db::name('AdminGroupAccess')->where('uid', get_login_admin('id'))->value('group_id');
- $login_rules = Db::name('AdminGroup')->where('id', $group_id)->value('rules');
- $login_rules = explode(',', $login_rules);
- $rules_id = array();
- foreach ($list as $key => $value) {
- if ($value['name'] == "作业日志-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_comments'] = 1;
- } else {
- $rules_id['project_comments'] = 0;
- }
- } else if ($value['name'] == "工作记录-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_record'] = 1;
- } else {
- $rules_id['project_record'] = 0;
- }
- } else if ($value['name'] == "项目报告-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_report'] = 1;
- } else {
- $rules_id['project_report'] = 0;
- }
- } else if ($value['name'] == "项目人员-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_user'] = 1;
- } else {
- $rules_id['project_user'] = 0;
- }
- } else if ($value['name'] == "项目动态-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_log'] = 1;
- } else {
- $rules_id['project_log'] = 0;
- }
- } else if ($value['name'] == "项目附件-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_file'] = 1;
- } else {
- $rules_id['project_file'] = 0;
- }
- } else if ($value['name'] == "联系函-公司") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_contact'] = 1;
- } else {
- $rules_id['project_contact'] = 0;
- }
- }
- }
- return $rules_id;
- }
- public function getProjectFive()
- {
- $where = [
- ['name', '=', '作业日志-财政局'],
- ['name', '=', '工作记录-财政局'],
- ['name', '=', '项目报告-财政局'],
- ['name', '=', '项目人员-财政局'],
- ['name', '=', '项目动态-财政局'],
- ['name', '=', '项目附件-财政局'],
- ['name', '=', '联系函-财政局'],
- ];
- $list = Db::name('AdminRule')->whereOr($where)->field('id,name')->select()->toArray();
- $group_id = Db::name('AdminGroupAccess')->where('uid', get_login_admin('id'))->value('group_id');
- $login_rules = Db::name('AdminGroup')->where('id', $group_id)->value('rules');
- $login_rules = explode(',', $login_rules);
- $rules_id = array();
- foreach ($list as $key => $value) {
- if ($value['name'] == "作业日志-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_comments'] = 1;
- } else {
- $rules_id['project_comments'] = 0;
- }
- } else if ($value['name'] == "工作记录-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_record'] = 1;
- } else {
- $rules_id['project_record'] = 0;
- }
- } else if ($value['name'] == "项目报告-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_report'] = 1;
- } else {
- $rules_id['project_report'] = 0;
- }
- } else if ($value['name'] == "项目人员-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_user'] = 1;
- } else {
- $rules_id['project_user'] = 0;
- }
- } else if ($value['name'] == "项目动态-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_log'] = 1;
- } else {
- $rules_id['project_log'] = 0;
- }
- } else if ($value['name'] == "项目附件-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_file'] = 1;
- } else {
- $rules_id['project_file'] = 0;
- }
- } else if ($value['name'] == "联系函-财政局") {
- if (in_array($value['id'], $login_rules)) {
- $rules_id['project_contact'] = 1;
- } else {
- $rules_id['project_contact'] = 0;
- }
- }
- }
- return $rules_id;
- }
- /**
- * 立项审核一拒绝
- */
- public function project_overrule_first()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- //修改状态为原状态
- if ($param["project_status"] == 2) {
- $param["project_status"] = 1;//修改为立项
- } elseif ($param["project_status"] == 7) {
- $param["project_status"] = 5;
- } elseif ($param["project_status"] == 6) {
- $param["project_status"] = 5;
- }
- try {
- $where=[
- ["project_id", "=", $param["project_id"]],
- ["audit_status", "=", 0],
- ["audit_type", "=", 5]
- ];
- $second_approver=$this->Auditmodel->where($where)->value("approver");
- //新增发送给审批二拒绝消息
- if(!empty($second_approver)){
- $this->Auditmodel->where("approver","$second_approver")->update(["audit_remark" => "审核一未通过,已作废"]);
- $MsgData = [
- "uid" =>$second_approver,//显示的文本,传来的id
- "project_id" => $param['id'],
- "content" => "项目审核一:".get_login_admin("nickname") . "已拒绝这个项目审批" ,
- "create_time" => time()
- ];
- $MsgGetId = $this->ProjectMsg->insertGetId($MsgData);
- $unread = Db::name("admin")->where("id", $second_approver)->value("unread");
- if (!empty($unread)) {
- $unread = $unread . "," . $MsgGetId;
- } else {
- $unread = $MsgGetId;
- }
- Db::name("admin")->where("id", $second_approver)->update(["unread" => $unread]);
- }
- $param['audit_time'] = time();
- //更新所有审批人已拒绝状态,改为id与$param["id“]就可以只改当前审批人的状态
- $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);//更新项目状态
- unset($param["approver_time"]);
- add_project_log('审批一拒绝', $param['project_id'], "项目分配审核拒绝,原因:" . $param["audit_remark"]);
- //发送拒绝消息
- $maker = $this->model->where('id', $param['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $handle['financial'] = (array)$maker;
- } else {
- $handle['financial'] = array_merge($handle['financial'], (array)$maker);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'],);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 立项审核二拒绝
- */
- public function project_overrule_first2()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- //修改状态为原状态
- if ($param["project_status"] == 2) {
- $param["project_status"] = 1;//修改为立项
- } elseif ($param["project_status"] == 7) {
- $param["project_status"] = 5;
- } elseif ($param["project_status"] == 6) {
- $param["project_status"] = 5;
- }
- try {
- $param['audit_time'] = time();
- //,改为id与$param["id“]就可以只改当前审批人的审批状态
- $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);//更新项目状态
- unset($param["approver_time"]);
- add_project_log('审批二拒绝', $param['project_id'], "项目分配审核拒绝,原因:" . $param["audit_remark"]);
- //发送拒绝消息
- $maker = $this->model->where('id', $param['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $handle['financial'] = (array)$maker;
- } else {
- $handle['financial'] = array_merge($handle['financial'], (array)$maker);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'],);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 拒绝
- */
- public function project_overrule_second()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- //修改状态为原状态
- if ($param["project_status"] == 2) {
- $param["project_status"] = 1;
- } elseif ($param["project_status"] == 7) {
- $param["project_status"] = 5;
- } elseif ($param["project_status"] == 6) {
- $param["project_status"] = 5;
- }
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- add_project_log('审批拒绝', $param['project_id'], "申请归档审核拒绝,原因:" . $param["audit_remark"]);
- $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
- if (empty($handle['financial'])) {
- $handle['company'] = (array)$people;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$people);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 拒绝
- */
- public function project_overrule_third()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- //修改状态为原状态
- if ($param["project_status"] == 2) {
- $param["project_status"] = 1;
- } elseif ($param["project_status"] == 7) {
- $param["project_status"] = 5;
- } elseif ($param["project_status"] == 6) {
- $param["project_status"] = 5;
- }
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param["id"])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- add_project_log('审批拒绝', $param['project_id'], "申请退审审核拒绝,原因:" . $param["audit_remark"]);
- $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
- if (empty($handle['financial'])) {
- $handle['company'] = (array)$people;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$people);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 财政项目立项审批通过
- */
- public function project_edit_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- //改为已通过audit_status=2
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where=[
- ["project_id", "=", $param["project_id"]],
- ["audit_status", "=", 5],//待启用
- ["audit_type", "=", 0],
- ["audit_name","=","项目分配审核二审"]
- ];
- $maker = $this->model->where('id', $param['project_id'])->value("entrust_maker");
- //找第二审批人id
- $second_approver=$this->Auditmodel->where($where)->value("approver");
- if (empty($handle['financial'])) {
- $handle['financial'] = (array)$maker+(array)$second_approver;
- } else {
- $handle['financial'] = array_merge($handle['financial'],(array)$maker+(array)$second_approver);
- }
- if ($second_approver!=null) {
- // 发送消息给第二审批人
- //$this->Pushmessage->pushMessage($param['project_id'], $handle['financial']);
- add_project_log('审批通过', $param['project_id'], "项目分配审核一通过,等待审核二");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);//将其第二审批人转化为待审批
- } else {
- // 如果没有第二审批人配置或者查找不到相关信息,则按照原逻辑发送消息
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- add_project_log('审批一通过', $param['project_id'], "项目分配审核通过");
- if ($param["audit_type"] == 1) {
- //修改状态为下一个状态
- if ($param["project_status"] == 2) {
- //立项
- $param["project_status"] = 3;
- } elseif ($param["project_status"] == 6) {
- //归档
- $param["project_status"] = 8;
- $param["project_dead_time"] = time();
- } elseif ($param["project_status"] == 7) {
- //退审
- $param["project_status"] = 9;
- $param["project_dead_time"] = time();
- }
- //更新状态
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- }
- }
- return to_assign(0,"操作成功");
- }
- }
- public function project_edit_first2()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- if ($param["audit_type"] == 0) {
- //修改状态为下一个状态
- if ($param["project_status"] == 2) {
- //立项
- $param["project_status"] = 3;
- } elseif ($param["project_status"] == 6) {
- //归档
- $param["project_status"] = 8;
- $param["project_dead_time"] = time();
- } elseif ($param["project_status"] == 7) {
- //退审
- $param["project_status"] = 9;
- $param["project_dead_time"] = time();
- }
- }
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $maker = $this->model->where('id', $param['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $handle['financial'] = (array)$maker;
- } else {
- $handle['financial'] = array_merge($handle['financial'], (array)$maker);
- }
- //项目id,需要通知的财政人员/需要通知的公司人员
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- add_project_log('审批通过', $param['project_id'], "项目分配审核二通过");
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 财政项目归档审批
- */
- public function project_edit_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- if ($param["audit_type"] == 1) {
- //修改状态为下一个状态
- if ($param["project_status"] == 2) {
- //立项
- $param["project_status"] = 3;
- } elseif ($param["project_status"] == 6) {
- //归档
- $param["project_status"] = 8;
- $param["project_dead_time"] = time();
- } elseif ($param["project_status"] == 7) {
- //退审
- $param["project_status"] = 9;
- $param["project_dead_time"] = time();
- }
- }
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- add_log('edit', $param['id'], $param);
- $id = $param['id'];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
- if (empty($handle['financial'])) {
- $handle['company'] = (array)$people;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$people);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- add_project_log('审批通过', $param['project_id'], "申请归档审核通过");
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 财政项目退审审批
- */
- public function project_edit_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- if ($param["audit_type"] == 1) {
- //修改状态为下一个状态
- if ($param["project_status"] == 2) {
- //立项
- $param["project_status"] = 3;
- } elseif ($param["project_status"] == 6) {
- //归档
- $param["project_status"] = 8;
- $param["project_dead_time"] = time();
- } elseif ($param["project_status"] == 7) {
- //退审
- $param["project_status"] = 9;
- $param["project_dead_time"] = time();
- }
- }
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- add_log('edit', $param['id'], $param);
- $id = $param["id"];
- unset($param["id"]);
- $param["approver_time"] = time();
- $this->model->where('id', $param['project_id'])->strict(false)->update($param);
- unset($param["approver_time"]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $people = $this->Auditmodel->where('id', $id)->value("sponsor_id");
- if (empty($handle['financial'])) {
- $handle['company'] = (array)$people;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$people);
- }
- $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company'], []);
- add_project_log('审批通过', $param['project_id'], "申请退审审核通过");
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意报告
- */
- public function report_agree_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //找有没有二审
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 5]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {//没有二审,给财评新增报告审核
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],//项目报告id
- ["audit_type", "=", 4]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "财评报告审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 2;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 0]);
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- $else_name = Db::name("project_report")->where("id", $auditData["else_id"])->value("title");
- add_project_log("新增项目报告", $param["project_id"], $else_name, 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {//公司内部有第二审批
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 5]
- ];
- $approver = $this->Auditmodel->where($where)->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //通过了一审,但是还有二审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // 通知发起人审批通过了
- // $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], NULL, $handle['company'], []);
- // 通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($param['project_id'], NULL, (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- public function report_agree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 6]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 4]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "报告审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 2;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- Db::name("project_report")->where("id",$param["else_id"])->update(["status"=>0]);
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- $else_name = Db::name("project_report")->where("id",$auditData["else_id"])->value("title");
- add_project_log("新增项目报告", $param["project_id"], $else_name, 4);add_project_log("新增项目报告", $param["project_id"], $auditData["else_name"], 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 6],
- ];
- $approver = $this->Auditmodel->where($where)->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 0]);
- //通过了二审,但是还有三审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // 通知发起人审批通过了
- // $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], NULL, $handle['company'], []);
- // 通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($param['project_id'], NULL, (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- public function report_agree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 14]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 4]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "报告审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 2;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- Db::name("project_report")->where("id",$param["else_id"])->update(["status"=>0]);
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- add_project_log("新增项目报告", $param["project_id"], $auditData["else_name"], 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 14]
- ];
- $approver = $this->Auditmodel->where($where)->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //通过了三审,但是还有四审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // 通知发起人审批通过了
- // $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], NULL, $handle['company'], []);
- // 通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($param['project_id'], NULL, (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- public function report_agree_fourth()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 15]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 4]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "报告审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 2;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- Db::name("project_report")->where("id",$param["else_id"])->update(["status"=>0]);
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 0]);
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- $else_name = Db::name("project_report")->where("id",$auditData["else_id"])->value("title");
- add_project_log("新增项目报告", $param["project_id"], $else_name, 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 15]
- ];
- $approver = $this->Auditmodel->where($where)->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //通过了四审,但是还有五审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // 通知发起人审批通过了
- // $this->Pushmessage->pushMessage($param['project_id'], $handle['financial'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], NULL, $handle['company'], []);
- // 通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($param['project_id'], NULL, (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- public function report_agree_fifth()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 4]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "报告审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 2;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- Db::name("project_report")->where("id",$param["else_id"])->update(["status"=>0]);
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 0]);
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company'], []);
- $else_name = Db::name("project_report")->where("id",$auditData["else_id"])->value("title");
- add_project_log("新增项目报告", $param["project_id"], $else_name, 4);
- try {
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意联系函
- */
- public function contact_agree_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 8]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 7]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "联系函审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 3;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- add_project_log("新增项目联系函", $param["project_id"], $auditData["else_name"], 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ['audit_status', '=', 5],
- ["audit_type", "=", 8]
- ];
- $approver = $this->Auditmodel->where($where)->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //通过了一审,但是还有二审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // 通知发起人审批通过了
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- // 通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($param['project_id'], [], (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意联系函
- */
- public function contact_agree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 9]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 7]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "联系函审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 3;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail["entrust_maker"], $handle['company'], []);
- add_project_log("新增项目联系函", $param["project_id"], $auditData["else_name"], 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ['audit_status', '=', '5'],
- ["audit_type", "=", 9],
- ];
- $approver = $this->Auditmodel->where($where)->value('approver');
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //通过了二审,但是还有三审,通知公司的发起人审批通过了
- $sponsor_id = $this->Auditmodel->where($where)->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $this->Pushmessage->pushMessage($param['project_id'], [], (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意联系函
- */
- public function contact_agree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_type", "=", 7]
- ];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $auditData = $this->Auditmodel->where($where)->find()->toArray();
- $auditData["audit_name"] = "联系函审核";
- $auditData["audit_status"] = 1;
- $auditData["audit_type"] = 3;
- $auditData["approver"] = $detail["entrust_maker"];
- $auditData["approver_name"] = $detail["entrust_maker_name"];
- $auditData["create_time"] = time();
- $auditData["audit_time"] = null;
- $auditData["remark"] = null;
- $auditData["audit_remark"] = null;
- unset($auditData["id"]);
- try {
- $this->Auditmodel->save($auditData);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //内部审核通过了,通知公司的发起人,通知财政局的审批人
- if (empty($handle['company'])) {
- $handle['company'] = (array)$auditData["sponsor_id"];
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$auditData["sponsor_id"]);
- }
- $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company'], []);
- add_project_log("新增项目联系函", $param["project_id"], $auditData["else_name"], 4);
- Db::name("cost_project")->where("id", $param["project_id"])->update(["report_time" => time()]);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意请款
- */
- public function appropriation_agree_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])
- ->strict(false)->field(true)
- ->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ["audit_status", "=", 5],
- ["audit_type", "in", 11]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => 1]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $financial = [];
- $company = [];
- $project_ids = [];
- foreach ($project as $item => $value) {
- $id = Db::name("cost_project")->where("id", $value['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $financial = (array)$id;
- } else {
- $financial = array_merge($handle['financial'], (array)$id);
- }
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- $this->Pushmessage->pushMessage($project_ids, $financial, $company, []);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ['audit_status', '=', 5],
- ["audit_type", "in", 11],
- ];
- $approver = $this->Auditmodel->where($where)->value('approver');
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $project_ids = [];
- foreach ($project as $item => $value) {
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- // 通知发起人审批通过了
- $this->Pushmessage->pushMessage($project_ids, [], $handle['company'], []);
- //通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($project_ids, [], (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意请款
- */
- public function appropriation_agree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ["audit_status", "=", 5],
- ["audit_type", "in", 12]
- ];
- $next = $this->Auditmodel->where($where)->count();
- if ($next == 0) {
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => 1]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $project_ids = [];
- $financial = [];
- $company = [];
- foreach ($project as $item => $value) {
- $id = Db::name("cost_project")->where("id", $value['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $financial = (array)$id;
- } else {
- $financial = array_merge($handle['financial'], (array)$id);
- }
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- $this->Pushmessage->pushMessage($project_ids, $financial, $company, []);
- } else {
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ['audit_status', '=', 5],
- ["audit_type", "in", 12],
- ];
- $approver = $this->Auditmodel->where('id', $param['id'])->value("approver");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = [];
- foreach ($project as $item => $value) {
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- // 通知发起人审批通过了
- $this->Pushmessage->pushMessage($project_ids, [], $handle['company'], []);
- //通知下一级审批人,有待审核
- $this->Pushmessage->pushMessage($project_ids, [], (array)$approver, []);
- }
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司同意请款
- */
- public function appropriation_agree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 2, "audit_time" => time()]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => 1]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $project_ids = [];
- $financial = [];
- $company = [];
- foreach ($project as $item => $value) {
- $id = Db::name("cost_project")->where("id", $value['project_id'])->value("entrust_maker");
- if (empty($handle['financial'])) {
- $financial = (array)$id;
- } else {
- $financial = array_merge($handle['financial'], (array)$id);
- }
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- $this->Pushmessage->pushMessage($project_ids, $financial, $company, []);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝报告
- */
- public function report_disagree_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 5]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- public function report_disagree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 6]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》",];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- public function report_disagree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 14]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- public function report_disagree_fourth()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 15]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》",];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- public function report_disagree_fifth()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $else_name = Db::name('project_audit')->where('else_id',$param['else_id'])->value('else_name');
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $else_name . "》"];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $else_name . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝联系函
- */
- public function contact_disagree_first()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 8]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》",];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝联系函
- */
- public function contact_disagree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", $param["else_id"]],
- ["audit_status", "=", 5],
- ["audit_type", "=", 9]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_remark" => "审核未全部通过,已作废"]);
- }
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》",];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝联系函
- */
- public function contact_disagree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $id = $param['id'];
- $MsgData = ["content" => get_login_admin("nickname") . "拒绝了您发起的" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》",];
- $detail = Db::name("cost_project")->where("id", $param["project_id"])->field("entrust_maker,entrust_maker_name")->find();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- if (empty($handle['company'])) {
- $handle['company'] = (array)$sponsor_id;
- } else {
- $handle['company'] = array_merge($handle['company'], (array)$sponsor_id);
- }
- // $this->Pushmessage->pushMessage($param['project_id'], (array)$detail['entrust_maker'], $handle['company']);
- $this->Pushmessage->pushMessage($param['project_id'], [], $handle['company'], []);
- $content = get_login_admin("nickname") . "拒绝了" . $this->Auditmodel->where('id', $id)->value("audit_name") . "《" . $param["else_name"] . "》,原因:".$param["audit_remark"];
- add_project_log('审批拒绝', $param['project_id'], $content);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝请款
- */
- public function appropriation_disagree_first()
- {
- $param = get_params();;
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => -2]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ["audit_status", "=", 5],
- ["audit_type", ">", 10],
- ["audit_type", "<", 13]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_status"=>4,"audit_remark" => "审核未全部通过,已作废"]);
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- $project_ids = [];
- foreach ($project as $item => $value) {
- $company = [];
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- // $this->Pushmessage->pushMessage($project_ids, $handle['financial'],$company);
- $this->Pushmessage->pushMessage($param['project_id'], [], $company, []);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝请款
- */
- public function appropriation_disagree_second()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => -2]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- $where = [
- ["project_id", "=", $param["project_id"]],
- ["else_id", "=", 0],
- ["audit_status", "=", 5],
- ["audit_type", ">", 11],
- ["audit_type", "<", 13]
- ];
- $next = $this->Auditmodel->where($where)->column("id");
- if (!empty($next)) {
- $this->Auditmodel->whereIn("id", $next)->update(["audit_status"=>4,"audit_remark" => "审核未全部通过,已作废"]);
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- $project_ids = [];
- $company = [];
- foreach ($project as $item => $value) {
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- // $this->Pushmessage->pushMessage($project_ids, $handle['financial'],$company);
- $this->Pushmessage->pushMessage($param['project_id'], [], $company, []);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 公司拒绝请款
- */
- public function appropriation_disagree_third()
- {
- $param = get_params();
- $handle = $this->Pushmessage->handleParam($param);
- $param = $handle['param'];
- if (request()->isAjax()) {
- try {
- $param['audit_time'] = time();
- $this->Auditmodel->where('id', $param['id'])->strict(false)->field(true)->update(["audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- Db::name("project_report")->where("id", $param["else_id"])->update(["status" => 7]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- try {
- Db::name("appropriation")->where("id", $param["project_id"])->update(["status" => -2]);
- } catch (\Exception $e) {
- return to_assign(1, '操作失败,原因:' . $e->getMessage());
- }
- //$param["project_id"]为关联id,非项目id
- $project = Db::name("appropriation_project")->where("uid", $param["project_id"])->select();
- $sponsor_id = $this->Auditmodel->where('id', $param['id'])->value("sponsor_id");
- $project_ids = [];
- foreach ($project as $item => $value) {
- $company = [];
- if (empty($handle['company'])) {
- $company = (array)$sponsor_id;
- } else {
- $company = array_merge($handle['company'], (array)$sponsor_id);
- }
- $project_ids = array_merge($project_ids, (array)$value['project_id']);
- }
- // $this->Pushmessage->pushMessage($project_ids, $handle['financial'],$company);
- $this->Pushmessage->pushMessage($param['project_id'], [], $company, []);
- return to_assign(0, "操作成功");
- }
- }
- /**
- * 业主项目审核一同意
- */
- public function proprietor_agree()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $id = isset($param['id']) ? $param["id"] : 0;
- $project_id = isset($param["project_id"]) ? $param["project_id"] : 0;
- $this->Auditmodel->update(["id" => $id, "audit_status" => 2, "audit_time" => time()]);
- $where=[
- ["project_id", "=", $param["project_id"]],
- ["audit_status", "=", 5],//待启用
- ["audit_type", "=", 0],
- ["audit_name", "=","业主项目审核二审"]
- ];
- //找第二审批人id
- $second_approver=$this->Auditmodel->where($where)->value("approver");
- if( $second_approver!=null){
- add_project_log('审批通过', $param['project_id'], "业主项目审核一通过,等待审核二");
- $this->Auditmodel->where($where)->update(["audit_status" => 1]);//将其第二审批人转化为待审批
- }
- else{
- add_project_log('审批一通过', $param['project_id'], "项目分配审核通过");
- $this->model->update(["id" => $project_id, "proprietor_status" => 2]);//改为待接收
- }
- $this->model->update(["id" => $project_id, "proprietor_status" => 2]);
- $sponsor_id = $this->Auditmodel->where('id', $id)->value('sponsor_id');
- // $fiscal_nature = Db::name('CostProject')->where('project_id', $project_id)->value('fiscal_nature');
- // if($fiscal_nature == '财政资金'){
- // $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
- // }else if($fiscal_nature == '非财政资金'){
- $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
- // }
- return to_assign("0", "操作成功");
- }
- }
- //业主项目审核二同意
- public function proprietor_agree2()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $id = isset($param['id']) ? $param["id"] : 0;
- $project_id = isset($param["project_id"]) ? $param["project_id"] : 0;
- $this->Auditmodel->update(["id" => $id, "audit_status" => 2, "audit_time" => time()]);//改为已通过
- $this->model->update(["id" => $project_id, "proprietor_status" => 2]);//改为待接收
- $sponsor_id = $this->Auditmodel->where('id', $id)->value('sponsor_id');
- $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
- add_project_log('审批通过', $param['project_id'], "业主项目审核二通过,项目审核通过");
- return to_assign("0", "操作成功");
- }
- }
- /**
- * 业主项目审核一拒绝
- */
- public function proprietor_disagree()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $id = isset($param['id']) ? $param["id"] : 0;
- $project_id = isset($param["project_id"]) ? $param["project_id"] : 0;
- $this->Auditmodel->update(["id" => $id, "audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $where=[
- ["project_id", "=", $param["project_id"]],
- ["audit_status", "=", 5],//待启用
- ["audit_type", "=", 0],
- ["audit_name", "=","业主项目审核二审"]
- ];
- //找第二审批人id
- $second_approver=$this->Auditmodel->where($where)->value("approver");
- if($second_approver!=null){
- add_project_log('业主端审批一拒绝', $param['project_id'], "项目审核拒绝,原因:" . $param["audit_remark"]);
- }
- else{
- $this->model->update(["id" => $project_id, "proprietor_status" => 0]);//改为业主立项中
- }
- $sponsor_id = $this->Auditmodel->where('id', $id)->value('sponsor_id');
- $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
- return to_assign("0", "操作成功");
- }
- }
- //业主项目审核二拒绝
- public function proprietor_disagre2()
- {
- if (request()->isAjax()) {
- $param = get_params();
- $id = isset($param['id']) ? $param["id"] : 0;
- $project_id = isset($param["project_id"]) ? $param["project_id"] : 0;
- $this->Auditmodel->update(["id" => $id, "audit_status" => 3, "audit_remark" => $param["audit_remark"], "audit_time" => time()]);
- $this->model->update(["id" => $project_id, "proprietor_status" => 0]);
- add_project_log('业主端审批二拒绝', $param['project_id'], "项目审核拒绝,原因:" . $param["audit_remark"]);
- $sponsor_id = $this->Auditmodel->where('id', $id)->value('sponsor_id');
- $this->Pushmessage->pushMessage($project_id, [], [], (array)$sponsor_id);
- return to_assign("0", "操作成功");
- }
- }
- /*
- * **************************************************************************
- * **************************************************************************
- * *
- * _oo8oo_ *
- * o8888888o *
- * 88" . "88 *
- * (| -_- |) *
- * 0\ = /0 *
- * ___/'==='\___ *
- * .' \\| |// '. *
- * / \\||| : |||// \ *
- * / _||||| -:- |||||_ \ *
- * | | \\\ - /// | | *
- * | \_| ''\---/'' |_/ | *
- * \ .-\__ '-' __/-. / *
- * ___'. .' /--.--\ '. .'___ *
- * ."" '< '.___\_<|>_/___.' >' "". *
- * | | : `- \`.:`\ _ /`:.`/ -` : | | *
- * \ \ `-. \_ __\ /__ _/ .-` / / *
- * =====`-.____`.___ \_____/ ___.`____.-`===== *
- * `=---=` *
- * **************************************************************************
- * ******************** ********************
- * ******************** ********************
- * ******************** 佛祖保佑 永远无BUG ********************
- * ******************** ********************
- * **************************************************************************
- */
- }
|