123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526 |
- <?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],
- ["cp_project_audit.audit_status", "<>", 5]
- ];
- if(!empty($param["keywords"])){
- $keywords_where = ["c.review_unit_name|c.engineering_type|a.project_name", 'like', '%' . $param['keywords'] . '%'];
- $where = array_merge($where, [$keywords_where]);
- }
- $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 == 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],//
- ["cp_project_audit.audit_status", "<>", 5]
- ];
- 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,c.proprietor_status")->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 = [
- ["a.approver", "=", $this->uid],//审批人是登录的
- ["a.audit_type", "<=", 1],//
- ["a.audit_status", "=", 1]
- ];
- // halt($where);
- 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,c.proprietor_status")
- ->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()]);
- add_project_log('业主端审批一拒绝', $param['project_id'], "项目审核拒绝,原因:" . $param["audit_remark"]);
- $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_disagree2()
- {
- 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 ********************
- * ******************** ********************
- * **************************************************************************
- */
- }
|