uid = get_login_admin('id'); $this->Adminmodel = new Admin(); $this->ProjectMsg = new ProjectMsg(); $this->ContactModel = new ContactModel(); $this->Officialaccount = new Officialaccount(); $this->Pushmessage = new Pushmessage(); $this->Auditmodel = new AuditModel(); } public function conList() { $param = get_params(); // halt($param); // $param = [ // 'project_id' => 290, // ]; $where = [ ['project_id', '=', $param['project_id']], ]; $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit']; $order = empty($param['order']) ? 'a.id desc' : $param['order']; $list = $this->ContactModel->where($where) ->field('a.*,u.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id') ->alias('a') ->join('file f', "a.file = f.id", "left") ->join('Admin u', 'a.maker_id = u.id', "left") ->order($order) ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { })->toArray(); // halt($list); // dump($list); return table_assign(0, '', $list); } public function conList_company() { $param = get_params(); // halt($param); // $param = [ // 'project_id' => 290, // ]; $where = [ ['project_id', '=', $param['project_id']], ]; $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit']; $order = empty($param['order']) ? 'a.id desc' : $param['order']; $list = $this->ContactModel->where($where) ->field('a.*,u.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id') ->alias('a') ->join('file f', "a.file = f.id", "left") ->join('Admin u', 'a.maker_id = u.id', "left") ->order($order) ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { })->toArray(); // halt($list); // dump($list); return table_assign(0, '', $list); } public function conList_proprietor() { $param = get_params(); // halt($param); // $param = [ // 'project_id' => 290, // ]; $where = [ ['project_id', '=', $param['project_id']], ]; $rows = empty($param['limit']) ? get_config('app.page_size') : $param['limit']; $order = empty($param['order']) ? 'a.id desc' : $param['order']; $list = $this->ContactModel->where($where) ->field('a.*,u.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id') ->alias('a') ->join('file f', "a.file = f.id", "left") ->join('Admin u', 'a.maker_id = u.id', "left") ->order($order) ->paginate($rows, false, ['query' => $param]) ->each(function ($item, $key) { })->toArray(); // halt($list); // dump($list); return table_assign(0, '', $list); } /** * 添加-财政局 */ public function add() { $param = get_params(); if (request()->isAjax()) { if (isset($param['table-align'])) { unset($param['table-align']); } if (isset($param['content'])) { $param['md_content'] = ''; } if (isset($param['docContent-html-code'])) { $param['content'] = $param['docContent-html-code']; $param['md_content'] = $param['docContent-markdown-doc']; unset($param['docContent-html-code']); unset($param['docContent-markdown-doc']); } // 创建HTMLPurifier配置对象 $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.DefinitionID', 'html5-definitions'); $config->set('HTML.DefinitionRev', 1); $config->set('HTML.ForbiddenAttributes', ['width', 'height']); //$config->set('HTML.Allowed', 'p,b,a[href],pre[class],code,blockquote,img[src],table,tr,th,td,ul,li,ol,dl,dt,dd'); $config->set('HTML.ForbiddenElements', array('script'), true);//设置拒绝使用的tagname if ($def = $config->maybeGetRawHTMLDefinition()) { $def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', 'poster' => 'URI', 'preload' => 'Enum#auto,metadata,none', 'controls' => 'Bool', ]); $def->addElement('source', 'Block', 'Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', ]); } // 创建HTMLPurifier对象 $purifier = new HTMLPurifier($config); //防止xss,过滤输入并输出结果 //$param['content'] = '测试'; $param['content'] = $purifier->purify($param['content']); $project_id = isset($param['project_id']) ? $param['project_id'] : 0; $param['project_id'] = $project_id; $param['maker_id'] = $this->uid; $param['admin_name'] = get_login_admin('nickname'); $param['status'] = 8; $content = $param["title"]; add_project_log("新增联系函", $project_id, $content); try { $param['create_time'] = time(); $insertId = $this->ContactModel->strict(false)->field(true)->insertGetId($param); } catch(\Exception $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } return to_assign(0,'操作成功'); } else { $project_id = isset($param['project_id']) ? $param['project_id'] : 0; //富文本类型 View::assign('editor', get_system_config('other', 'editor')); //关联项目id View::assign('project_id', $project_id); return view(); } } /** * 添加-公司 */ public function add_company() { $param = get_params(); if (request()->isAjax()) { if (isset($param['table-align'])) { unset($param['table-align']); } if (isset($param['content'])) { $param['md_content'] = ''; } if (isset($param['docContent-html-code'])) { $param['content'] = $param['docContent-html-code']; $param['md_content'] = $param['docContent-markdown-doc']; unset($param['docContent-html-code']); unset($param['docContent-markdown-doc']); } // 创建HTMLPurifier配置对象 $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.DefinitionID', 'html5-definitions'); $config->set('HTML.DefinitionRev', 1); $config->set('HTML.ForbiddenAttributes', ['width', 'height']); //$config->set('HTML.Allowed', 'p,b,a[href],pre[class],code,blockquote,img[src],table,tr,th,td,ul,li,ol,dl,dt,dd'); $config->set('HTML.ForbiddenElements', array('script'), true);//设置拒绝使用的tagname if ($def = $config->maybeGetRawHTMLDefinition()) { $def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', 'poster' => 'URI', 'preload' => 'Enum#auto,metadata,none', 'controls' => 'Bool', ]); $def->addElement('source', 'Block', 'Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', ]); } // 创建HTMLPurifier对象 $purifier = new HTMLPurifier($config); //防止xss,过滤输入并输出结果 //$param['content'] = '测试'; $param['content'] = $purifier->purify($param['content']); $project_id = isset($param['project_id']) ? $param['project_id'] : 0; $param['project_id'] = $project_id; $param['maker_id'] = $this->uid; $param['admin_name'] = get_login_admin('nickname'); try { $param['create_time'] = time(); $insertId = $this->ContactModel->strict(false)->field(true)->insertGetId($param); } catch(\Exception $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } $detail = Db::name("cost_project")->where("id",$project_id)->field("project_name,project_status,entrust_maker,entrust_maker_name")->find(); $auditDataArr = []; //1项目,2报告,3公司一级审核,4公司二级审核,5公司三级审核 if (!empty($param["first"])) { $auditData = [ "project_id" => $project_id, "project_name" => $detail["project_name"], "project_type" => "造价项目", "audit_name" => "联系函一审", "audit_type" => 7, "else_id" => $insertId, "sponsor" => get_login_admin("nickname"), "sponsor_id" => $this->uid, "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"), "approver" => $param["first"], "approver_name" => get_admin($param["first"])["nickname"], "create_time" => time() ]; $auditDataArr[] = $auditData; } else { return to_assign(1, "请选择审批人"); } if (!empty($param["second"])) { $auditData = [ "project_id" => $project_id, "project_name" => $detail["project_name"], "project_type" => "造价项目", "audit_name" => "联系函二审", "audit_type" => 8, "audit_status" => 5, "else_id" => $insertId, "sponsor" => get_login_admin("nickname"), "sponsor_id" => $this->uid, "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"), "approver" => $param["second"], "approver_name" => get_admin($param["second"])["nickname"], "create_time" => time() ]; $auditDataArr[] = $auditData; } if (!empty($param["third"])) { $auditData = [ "project_id" => $project_id, "project_name" => $detail["project_name"], "project_type" => "造价项目", "audit_name" => "联系函三审", "audit_type" => 9, "audit_status" => 5, "else_id" => $insertId, "sponsor" => get_login_admin("nickname"), "sponsor_id" => $this->uid, "sponsor_unit" => Db::name("department")->where("id", get_login_admin('unit_name'))->value("title"), "approver" => $param["third"], "approver_name" => get_admin($param["third"])["nickname"], "create_time" => time() ]; $auditDataArr[] = $auditData; } // halt($auditDataArr); if (!empty($auditDataArr)) { $ProjectAudit = new ProjectAudit(); try { $ProjectAudit->saveAll($auditDataArr); } catch (\Exception $e) { return to_assign(1, '操作失败,原因:' . $e->getMessage()); } } return to_assign(0,'操作成功'); } else { $project_id = isset($param['project_id']) ? $param['project_id'] : 0; //富文本类型 View::assign('editor', get_system_config('other', 'editor')); //关联项目id View::assign('project_id', $project_id); $ids = Db::name('CostProject')->where("id", $project_id)->field("entrust_maker,review_head,operate_head,operate_team")->find(); $idarr = $ids["operate_team"] . ',' . $ids["operate_head"] . ',' . $ids["review_head"]; $idarr = explode(",", $idarr); $people = Db::name("admin")->whereIn('id', $idarr)->field('id,nickname')->select(); View::assign('people', $people); return view(); } } /** * * 编辑-公司 */ public function edit_company() { $param = get_params(); if (request()->isAjax()) { // halt($param); if (isset($param['table-align'])) { unset($param['table-align']); } if (isset($param['content'])) { $param['md_content'] = ''; } if (isset($param['docContent-html-code'])) { $param['content'] = $param['docContent-html-code']; $param['md_content'] = $param['docContent-markdown-doc']; unset($param['docContent-html-code']); unset($param['docContent-markdown-doc']); } // 创建HTMLPurifier配置对象 $config = HTMLPurifier_Config::createDefault(); $config->set('HTML.DefinitionID', 'html5-definitions'); $config->set('HTML.DefinitionRev', 1); $config->set('HTML.ForbiddenAttributes', ['width', 'height']); //$config->set('HTML.Allowed', 'p,b,a[href],pre[class],code,blockquote,img[src],table,tr,th,td,ul,li,ol,dl,dt,dd'); $config->set('HTML.ForbiddenElements', array('script'), true);//设置拒绝使用的tagname if ($def = $config->maybeGetRawHTMLDefinition()) { $def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', 'poster' => 'URI', 'preload' => 'Enum#auto,metadata,none', 'controls' => 'Bool', ]); $def->addElement('source', 'Block', 'Flow', 'Common', [ 'src' => 'URI', 'type' => 'Text', ]); } // 创建HTMLPurifier对象 $purifier = new HTMLPurifier($config); //防止xss,过滤输入并输出结果 //$param['content'] = '测试'; $param['content'] = $purifier->purify($param['content']); $contact_id = isset($param['id']) ? $param['id'] : 0; $param['project_id'] = Db::name('Contact')->where('id', $contact_id)->value('project_id'); $param['maker_id'] = $this->uid; $param['audit_status'] = 0; $content = $param["title"]; add_project_log("编辑联系函", $param['project_id'], $content); // $this->ContactModel->addContact($param); $this->ContactModel->where('id', $contact_id)->save($param); return to_assign(0, '修改成功'); } else { $contact_id = isset($param['id']) ? $param['id'] : 0; $detail = Db::name('Contact')->where('id', $contact_id)->find(); $file_array = Db::name('Contact') ->field("r.*,a.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id") ->alias('r') ->join('File f', 'r.file = f.id') ->join('Admin a', 'r.maker_id = a.id', 'LEFT') ->order('r.create_time desc') ->where(array('r.id' => $contact_id)) ->select()->toArray(); View::assign('file_array', $file_array); //富文本类型 View::assign('editor', get_system_config('other', 'editor')); View::assign('detail', $detail); // dump($detail); //关联项目id // View::assign('project_id', $project_id); return view('edit'); } } /** * 查看信息-财政局 */ public function view() { $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; $detail = $this->ContactModel->detail($id); // dump($param); // dump($detail); if (empty($detail)) { if (empty($detail)) { echo '
该文档不存在
'; exit; } } else { $maker_name = Db::name('admin')->where(['id' => $detail["maker_id"]])->value("nickname"); $detail["maker_name"] = $maker_name; $file_array = Db::name('Contact') ->field("r.*,a.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id") ->alias('r') ->join('File f', 'r.file = f.id') ->join('Admin a', 'r.maker_id = a.id', 'LEFT') ->order('r.create_time desc') ->where(array('r.id' => $id)) ->select()->toArray(); View::assign('file_array', $file_array); View::assign('detail', $detail); View::assign('user', get_login_admin('user_type')); // dump($detail); return view(); } } /** * 查看信息-公司 */ public function view_company() { $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; $detail = $this->ContactModel->detail($id); // dump($param); // dump($detail); if (empty($detail)) { if (empty($detail)) { echo '
该文档不存在
'; exit; } } else { $maker_name = Db::name('admin')->where(['id' => $detail["maker_id"]])->value("nickname"); $detail["maker_name"] = $maker_name; $file_array = Db::name('Contact') ->field("r.*,a.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id") ->alias('r') ->join('File f', 'r.file = f.id') ->join('Admin a', 'r.maker_id = a.id', 'LEFT') ->order('r.create_time desc') ->where(array('r.id' => $id)) ->select()->toArray(); View::assign('file_array', $file_array); View::assign('detail', $detail); View::assign('user', get_login_admin('user_type')); // dump($detail); return view('view'); } } /** * 查看信息-业主 */ public function view_proprietor() { $param = get_params(); $id = isset($param['id']) ? $param['id'] : 0; $detail = $this->ContactModel->detail($id); // dump($param); // dump($detail); if (empty($detail)) { if (empty($detail)) { echo '
该文档不存在
'; exit; } } else { $maker_name = Db::name('admin')->where(['id' => $detail["maker_id"]])->value("nickname"); $detail["maker_name"] = $maker_name; $file_array = Db::name('Contact') ->field("r.*,a.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id") ->alias('r') ->join('File f', 'r.file = f.id') ->join('Admin a', 'r.maker_id = a.id', 'LEFT') ->order('r.create_time desc') ->where(array('r.id' => $id)) ->select()->toArray(); View::assign('file_array', $file_array); View::assign('detail', $detail); View::assign('user', get_login_admin('user_type')); // dump($detail); return view('view'); } } public function add_file() { $param = get_params(); // $param['create_time'] = time(); $param['maker_id'] = $this->uid; $file_array = Db::name('file') ->field("f.id,f.name,f.filesize,f.filepath,f.fileext,f.admin_id,f.create_time,a.nickname as admin_name") ->alias("f") // ->field("r.*,a.nickname as admin_name,f.name,f.filesize,f.filepath,f.fileext,f.admin_id") ->join('Admin a', 'f.admin_id = a.id', 'LEFT') ->order('f.create_time desc') ->where(array('f.id' => $param["file"])) ->select()->toArray(); // ->find(); View::assign("file_array", $file_array); return json($file_array); } //删除 public function delete_file() { if (request()->isDelete()) { if (true) { return to_assign(0, "删除成功"); } } else { return to_assign(1, "错误的请求"); } } /** * 删除-公司 * 跟财评申请删除 */ public function delete_company() { $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; $id = isset($param['id']) ? $param['id'] : 0; $detail = $this->ContactModel->where("id", $id)->find(); $approver = Db::name("cost_project")->where("id", $detail["project_id"])->value("entrust_maker"); $details = Db::name("cost_project")->where("id",$detail["project_id"])->field("project_name,project_status,entrust_maker,entrust_maker_name")->find(); $auditData = [ "project_id" => $detail["project_id"], "project_name" => $details["project_name"], "project_type" => "造价项目", "audit_name" => "删除联系函申请", "audit_type" => 3, "else_id" => $id, "sponsor" => get_login_admin("nickname"), "sponsor_id" => $this->uid, "sponsor_unit" => Db::name("department")->where("id",get_login_admin('unit_name'))->value("title"), "approver" => $details["entrust_maker"], "approver_name" => $details["entrust_maker_name"], "remark" =>$param["remark"], "create_time" => time() ]; ProjectAudit::create($auditData); if (empty($handle['financial'])) { $handle['financial'] = (array)$details["entrust_maker"]; } else { $handle['financial'] = array_merge($handle['company'], (array)$details["entrust_maker"]); } $this->Pushmessage->pushMessage($detail['project_id'], $handle['financial'], $handle['company']); $this->ContactModel->where("id", $id)->update(["status" => 3]); add_project_log("发起删除项目联系函审批", $detail["project_id"], $detail["title"]); return to_assign(0, "操作成功"); } /** * 财评 * 同意-联系函 */ public function agree_contact() { $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; if(!isset($param["type"])){ $id = isset($param['id']) ? $param['id'] : 0; $this->ContactModel->where("id", $id)->update(["status" => 1]); try { Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status"=>2]); } catch (DbException $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } $people = $this->ContactModel->where('id', $id)->value("maker_id"); if (empty($handle['company'])) { $handle['company'] = (array)$people; } else { $handle['company'] = array_merge($handle['company'], (array)$people); } $project_id = $this->ContactModel->where("id", $id)->value("project_id"); $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']); add_project_log('审批通过', $project_id, "联系函新建审批通过"); }else{ $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"]); $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status"); if ($type_status == 0) { Db::name("contact")->where("id", $param["else_id"])->update(["status" => 1, "update_time" => time()]); } elseif ($type_status == 3) { Db::name("contact")->where("id", $param["else_id"])->update(["status" => 4, "update_time" => time()]); } $people = $this->Auditmodel->where('id', $id)->value("sponsor_id"); if (empty($handle['company'])) { $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 un_contact() { $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; if(!isset($param["type"])){ $id = isset($param['id']) ? $param['id'] : 0; $this->ContactModel->where("id", $id)->update(["status" => 2]); try { Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status"=> 3,"audit_remark" => $param["audit_remark"]]); } catch (DbException $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } $people = $this->ContactModel->where('id', $id)->value("maker_id"); if (empty($handle['company'])) { $handle['company'] = (array)$people; } else { $handle['company'] = array_merge($handle['company'], (array)$people); } $project_id = $this->ContactModel->where("id", $id)->value("project_id"); $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']); add_project_log('审批通过', $project_id, "联系新建审批拒绝"); }else{ $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; 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"]); $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status"); if ($type_status == 0) { //新建 Db::name("contact")->where("id", $param["else_id"])->update(["status" => 2, "update_time" => time()]); } elseif ($type_status == 3) { //删除 Db::name("contact")->where("id", $param["else_id"])->update(["status" => 5, "update_time" => time()]); } $people = $this->Auditmodel->where('id', $id)->value("sponsor_id"); if (empty($handle['company'])) { $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'], "联系新建审批拒绝"); } catch (\Exception $e) { return to_assign(1, '操作失败,原因:' . $e->getMessage()); } } return to_assign(0, "操作成功"); } /** * 财评 * 同意-删除 */ public function agree_delete() { $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; if(!isset($param["type"])){ $id = isset($param['id']) ? $param['id'] : 0; $this->ContactModel->where("id", $id)->update(["status" => 4]); try { Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status"=> 2]); } catch (DbException $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } $people = $this->ContactModel->where('id', $id)->value("maker_id"); if (empty($handle['company'])) { $handle['company'] = (array)$people; } else { $handle['company'] = array_merge($handle['company'], (array)$people); } $project_id = $this->ContactModel->where("id", $id)->value("project_id"); $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']); add_project_log('审批通过', $project_id, "联系函删除审批通过"); }else{ $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"]); $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status"); if ($type_status == 0) { Db::name("contact")->where("id", $param["else_id"])->update(["status" => 1, "update_time" => time()]); } elseif ($type_status == 3) { Db::name("contact")->where("id", $param["else_id"])->update(["status" => 4, "update_time" => time()]); } $people = $this->Auditmodel->where('id', $id)->value("sponsor_id"); if (empty($handle['company'])) { $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 un_delete() { $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; if(!isset($param["type"])){ $id = isset($param['id']) ? $param['id'] : 0; $this->ContactModel->where("id", $id)->update(["status" => 5]); try { Db::name("project_audit")->where([["else_id", "=", $id]])->update(["audit_status"=>3,"audit_remark" => $param["audit_remark"]]); } catch (DbException $e) { return to_assign(1, '操作失败,原因:'.$e->getMessage()); } $people = $this->ContactModel->where('id', $id)->value("maker_id"); if (empty($handle['company'])) { $handle['company'] = (array)$people; } else { $handle['company'] = array_merge($handle['company'], (array)$people); } $project_id = $this->ContactModel->where("id", $id)->value("project_id"); $this->Pushmessage->pushMessage($project_id, $handle['financial'], $handle['company']); add_project_log('审批通过', $project_id, "联系函删除审批拒绝"); }else{ $param = get_params(); $handle = $this->Pushmessage->handleParam($param); $param = $handle['param']; 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"]); $type_status = Db::name("contact")->where("id", $param["else_id"])->value("status"); if ($type_status == 0) { //新建 Db::name("contact")->where("id", $param["else_id"])->update(["status" => 2, "update_time" => time()]); } elseif ($type_status == 3) { //删除 Db::name("contact")->where("id", $param["else_id"])->update(["status" => 5, "update_time" => time()]); } $people = $this->Auditmodel->where('id', $id)->value("sponsor_id"); if (empty($handle['company'])) { $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'], "联系函删除审批拒绝"); } catch (\Exception $e) { return to_assign(1, '操作失败,原因:' . $e->getMessage()); } } return to_assign(0, "操作成功"); } }