You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
747 lines
33 KiB
747 lines
33 KiB
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Administrator
|
|
* Date: 2018/3/28
|
|
* Time: 20:55
|
|
*/
|
|
|
|
namespace app\org\controller;
|
|
|
|
use app\admin\controller\Base;
|
|
use app\org\model\Orguptype as UptypeModel;
|
|
use think\Db;
|
|
|
|
class Orgapply extends Base
|
|
{
|
|
/** 上传文件类型列表
|
|
* @param int $status
|
|
* @param int $ftype
|
|
* @return mixed
|
|
*/
|
|
public function uptype_list($status=-1,$ftype=1){
|
|
$apply_id=input('apply_id');
|
|
$whereType=array(
|
|
'apply_id'=>$apply_id,
|
|
'new_flag'=>1,
|
|
);
|
|
$uptype_list=UptypeModel::getList(-1,$apply_id,$ftype,$status,-1,'status,apply_type,ftype_id',-1);
|
|
$page = $uptype_list->render();
|
|
$this->assign('uptype_list',$uptype_list);
|
|
$this->assign('page',$page);
|
|
return $this->fetch();
|
|
}
|
|
/** 上传文件类型添加
|
|
* @param int $status
|
|
* @return mixed
|
|
*/
|
|
public function uptype_add($process=-1,$status=-1){
|
|
if ($process > 0 and $status > 0) {
|
|
//权限检查
|
|
if (check_cult4UserRight(input('apply_id'), session('admin_auth.aid'), $status) == 0) {
|
|
$this->error('无权限',url('admin/Index/index'));
|
|
}
|
|
}
|
|
//创建token
|
|
creatToken();
|
|
|
|
$apply_id=input('apply_id');
|
|
$this->assign('apply_id',$apply_id);
|
|
$this->assign('status',$status);
|
|
$where['status'] = array('egt',0);
|
|
$statuslist=Db::name('org_status')->where($where)->select();
|
|
$this->assign('statuslist',$statuslist);
|
|
|
|
return $this->fetch();
|
|
}
|
|
/** 上传文件类型保存
|
|
* @param int $status
|
|
* @return mixed
|
|
*/
|
|
public function uptype_runadd($process=-1,$status=-1){
|
|
//添加固定内容
|
|
if (!($process == -1 or $status ==-1)) {
|
|
//权限检查
|
|
if (check_cult4UserRight(input('apply_id'), session('admin_auth.aid'), $status) == 0) {
|
|
$this->error('无权限',url('admin/Index/index'));
|
|
}
|
|
}
|
|
|
|
$roletype=input('roletype');
|
|
$roleid=input('roletitle');
|
|
$roletype2=input('roletype2');
|
|
$roleid2=input('roletitle2');
|
|
if($roletype<=0 or $roleid<=0)
|
|
{
|
|
$this->error('请选择资料上传类型及对应的角色!');
|
|
}
|
|
if(empty($roletype2))$roletype2=0;
|
|
if(empty($roleid2))$roleid2=0;
|
|
if(!(($roletype2==0 and $roleid2==0) or ($roletype2>0 and $roleid2>0) or ($roletype2<=0 and $roleid2<=0)))
|
|
{
|
|
$this->error('请选择资料辅助上传类型及对应的角色!');
|
|
}
|
|
//防止重复提交
|
|
if (!checkToken(input('TOKEN'))) {
|
|
//return;
|
|
}
|
|
//状态为-1时对应固定文件
|
|
$apply_id=input('apply_id');
|
|
$whereType=array(
|
|
'apply_id'=>$apply_id,
|
|
'new_flag'=>1,
|
|
);
|
|
$mustupload=1;
|
|
if($process==-1){
|
|
$apply_id = 0;
|
|
$apply_type=input('apply_type');
|
|
$mustupload=input('mustupload');
|
|
}
|
|
|
|
//上传模板部分
|
|
$file_id=0;
|
|
//支持多个字段单文件
|
|
$file = request()->file('file_one');
|
|
$file_one='';
|
|
|
|
if(!empty($file)){
|
|
$validate = config('upload_validate');
|
|
unset($validate['ext']);//不限制后缀
|
|
//单图
|
|
$info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
|
|
if ($info) {
|
|
$file_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
|
|
//写入数据库
|
|
$data['apply_id'] = 0;//模板文件未使用该字段
|
|
$data['user_id'] = session('admin_auth.aid');
|
|
$data['user_type'] = 2;
|
|
$data['status'] = $status;
|
|
$data['upload_time'] = time();
|
|
$data['ftype_id'] = 0;//模板文件为0
|
|
$data['ftype'] = 3;//模板类型
|
|
$data['filesize'] = $info->getSize();
|
|
$data['path'] = $file_url;
|
|
$data['addorder'] = 0;//固定文件需要更新
|
|
$data['new_flag'] = 1;//固定文件需要更新
|
|
|
|
$file_id = Db::name('org_upfiles')->insert($data,false,true);
|
|
|
|
} else {
|
|
session('TOKEN', input('TOKEN'));
|
|
$this->error($file->getError());//否则就是上传错误,显示错误原因
|
|
}
|
|
}
|
|
if ($process == -1 or $status ==-1) {
|
|
$uptype_id=UptypeModel::add($apply_type,input('ftypedescr'),$file_id,input('ftype'),input('status'),input('isopen',0),0,session('admin_auth.aid'),$roletype,$roleid,$roletype2,$roleid2,$mustupload);
|
|
if($uptype_id){
|
|
$this->success('文件类型添加成功',url('org/Orgapply/uptype_list'));
|
|
}else{
|
|
session('TOKEN', input('TOKEN'));
|
|
$this->error('文件类型添加失败');
|
|
}
|
|
}else{
|
|
$uptype_id=UptypeModel::add($apply_type,input('ftypedescr'),$file_id,input('ftype'),$status,input('isopen',0),$apply_id,session('admin_auth.aid'),$roletype,$roleid,$roletype2,$roleid2);
|
|
if($uptype_id){
|
|
$sl_data2['apply_id']=input('apply_id');
|
|
$sl_data2['status']=$status;
|
|
$this->success('文件类型添加成功',url('org/Orgapply/uptype_list'.$process,$sl_data2));
|
|
}else{
|
|
session('TOKEN', input('TOKEN'));
|
|
$this->error('文件类型添加失败');
|
|
}
|
|
}
|
|
}
|
|
/** 上传文件类型编辑
|
|
* @return mixed
|
|
*/
|
|
public function uptype_edit(){
|
|
if(!request()->isAjax()) {
|
|
//创建token
|
|
creatToken();
|
|
$ftype_id = input('ftype_id', 0, 'intval');
|
|
if (!$ftype_id) $this->error('参数错误', url('org/Orgapply/uptype_list'));
|
|
$uptype = Db::name('org_uptype')->where('ftype_id', $ftype_id)->find();
|
|
$this->assign('uptype', $uptype);
|
|
if(!empty($uptype['ftemp_id'])){
|
|
$upfile = Db::name('org_upfiles')->where('file_id', $uptype['ftemp_id'])->find();
|
|
$this->assign('upfile', $upfile);
|
|
}
|
|
$where['status'] = array('egt',0);
|
|
$statuslist=Db::name('org_status')->where($where)->select();
|
|
$this->assign('statuslist',$statuslist);
|
|
|
|
$list1=array();
|
|
if($uptype['upload_role_type']==1){
|
|
$map1['member_group_id']=array(array('gt',0),array('neq',2));//>0 and !=2
|
|
$list1=Db::name("member_group")->field(array('member_group_id'=>'id','member_group_name'=>'name'))->where($map1)->select();
|
|
}elseif($uptype['upload_role_type']==2){
|
|
$map2['id']=array('gt',0);
|
|
$list1=Db::name("auth_group")->field(array('id'=>'id','title'=>'name'))->where($map2)->select();
|
|
}
|
|
$this->assign('list1',$list1);
|
|
$list2=array();
|
|
if($uptype['upload_role_type2']==1){
|
|
$map1['member_group_id']=array(array('gt',0),array('neq',2));//>0 and !=2
|
|
$list2=Db::name("member_group")->field(array('member_group_id'=>'id','member_group_name'=>'name'))->where($map1)->select();
|
|
}elseif($uptype['upload_role_type2']==2){
|
|
$map2['id']=array('gt',0);
|
|
$list2=Db::name("auth_group")->field(array('id'=>'id','title'=>'name'))->where($map2)->select();
|
|
}
|
|
$this->assign('list2',$list2);
|
|
return $this->fetch();
|
|
}else{
|
|
$roletype=input('roletype');
|
|
$roleid=input('roletitle');
|
|
$roletype2=input('roletype2');
|
|
$roleid2=input('roletitle2');
|
|
if($roletype<=0 or $roleid<=0)
|
|
{
|
|
$this->error('请选择资料上传类型及对应的角色!');
|
|
}
|
|
if(empty($roletype2))$roletype2=0;
|
|
if(empty($roleid2))$roleid2=0;
|
|
if(!(($roletype2==0 and $roleid2==0) or ($roletype2>0 and $roleid2>0) or ($roletype2<=0 and $roleid2<=0)))
|
|
{
|
|
$this->error('请选择资料辅助上传类型及对应的角色!');
|
|
}
|
|
//防止重复提交
|
|
if (!checkToken(input('TOKEN'))) {
|
|
return;
|
|
}
|
|
|
|
//固定
|
|
$apply_id = 0;
|
|
$apply_type=input('apply_type');
|
|
$mustupload=input('mustupload');
|
|
|
|
//上传模板部分
|
|
$file_id=0;
|
|
//支持多个字段单文件
|
|
$file = request()->file('file_one');
|
|
$file_one='';
|
|
|
|
if(!empty($file)){
|
|
$validate = config('upload_validate');
|
|
unset($validate['ext']);//不限制后缀
|
|
//单图
|
|
$info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
|
|
|
|
if ($info) {
|
|
$file_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
|
|
//写入数据库
|
|
$data['apply_id'] = 0;//模板文件未使用该字段
|
|
$data['user_id'] = session('admin_auth.aid');
|
|
$data['user_type'] = 2;
|
|
$data['status'] = input('status');
|
|
$data['upload_time'] = time();
|
|
$data['ftype_id'] = 0;//模板文件为0
|
|
$data['ftype'] = 3;//模板类型
|
|
$data['filesize'] = $info->getSize();
|
|
$data['path'] = $file_url;
|
|
$data['addorder'] = 0;//固定文件需要更新
|
|
$data['new_flag'] = 1;//固定文件需要更新
|
|
|
|
$file_id = Db::name('org_upfiles')->insert($data,false,true);
|
|
|
|
} else {
|
|
$this->error($file->getError());//否则就是上传错误,显示错误原因
|
|
}
|
|
}else{
|
|
$file_id = input('ftemp_id');
|
|
$data['file_id'] = $file_id;//模板文件未使用该字段
|
|
$data['status'] = input('status');
|
|
Db::name('org_upfiles')->where('file_id',$file_id)->update($data);
|
|
}
|
|
$sl_data=array(
|
|
'ftype_id'=>input('ftype_id'),
|
|
'ftypedescr'=>input('ftypedescr'),
|
|
'ftemp_id' => $file_id,
|
|
'apply_type' => $apply_type,
|
|
'mustupload' => $mustupload,
|
|
'ftype'=>input('ftype'),
|
|
'status'=>input('status'),
|
|
'isopen'=>input('isopen',0),
|
|
'apply_id'=>$apply_id,
|
|
'user_id'=>session('admin_auth.aid'),
|
|
'create_time'=>time(),
|
|
'upload_role_type'=>$roletype,
|
|
'upload_role_id'=>$roleid,
|
|
'upload_role_type2'=>$roletype2,
|
|
'upload_role_id2'=>$roleid2,
|
|
);
|
|
$uptype_id=Db::name('org_uptype')->where('ftype_id',input('ftype_id'))->update($sl_data);
|
|
if($uptype_id){
|
|
$this->success('文件类型修改成功',url('org/Orgapply/uptype_list'));
|
|
}else{
|
|
$this->error('文件类型修改失败');
|
|
}
|
|
}
|
|
}
|
|
/** 上传文件类型启用停用
|
|
* @param int $status
|
|
* @return mixed
|
|
*/
|
|
public function uptype_state($process =-1, $status =-1){
|
|
$id=input('x');
|
|
if (empty($id)){
|
|
//如果不是固定添加类型
|
|
if (!($process == -1 or $status ==-1)) {
|
|
$this->error('文件ID不存在', url('org/Orgapply/uptype_list' . $process));
|
|
}else{
|
|
$this->error('文件ID不存在', url('org/Orgapply/uptype_list'));
|
|
}
|
|
}
|
|
|
|
//取得apply_id
|
|
$tempfile = UptypeModel::getFileTypeInfo($id);
|
|
if(empty($tempfile)){
|
|
$this->error('无权限',url('admin/Index/index'));
|
|
}
|
|
$isopen=Db::name('org_uptype')->where('ftype_id',$id)->value('isopen');//判断当前状态情况
|
|
if($isopen==1){
|
|
$statedata = array('isopen'=>0);
|
|
Db::name('org_uptype')->where('ftype_id',$id)->setField($statedata);
|
|
$this->success('状态禁止');
|
|
}else{
|
|
$statedata = array('isopen'=>1);
|
|
Db::name('org_uptype')->where('ftype_id',$id)->setField($statedata);
|
|
$this->success('状态开启');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 审核列表
|
|
*/
|
|
public function apply_list($applystatus=-1,$allstatus=-1){
|
|
$search_name=input('search_name');
|
|
$where=array();
|
|
//根据状态值取出对应状态的数据
|
|
if($allstatus == -1){
|
|
$where['a.status'] = array('eq',$applystatus);
|
|
}
|
|
if(!empty($search_name)){
|
|
$where['m.member_list_username'] = array('like','%'.$search_name.'%');
|
|
}
|
|
//取得apply_admin_id为0或者当前用户的数据
|
|
$where['a.apply_admin_id']=array(array('eq',0),array('eq',session('admin_auth.aid')),'or');
|
|
|
|
$apply_list = Db::name('org_apply')->alias("a")->join(config('database.prefix').'member_list m','a.uid =m.member_list_id')
|
|
->join(config('database.prefix').'org_status c','a.status =c.status')->where($where)
|
|
->order('create_time desc,id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
|
|
$page = $apply_list->render();
|
|
$this->assign('apply_list',$apply_list);
|
|
$this->assign('page',$page);
|
|
$this->assign('search_name',$search_name);
|
|
$this->assign('applystatus',$applystatus);
|
|
$this->assign('allstatus',$allstatus);
|
|
$this->assign('loginuser',session('admin_auth.aid'));
|
|
return $this->fetch();
|
|
}
|
|
|
|
/** 受理操作
|
|
* @param $status
|
|
*/
|
|
public function apply_applyed($status){
|
|
if(session('admin_auth.aid')){
|
|
$data=array(
|
|
'apply_admin_id'=>session('admin_auth.aid'),
|
|
'update_time'=>time(),
|
|
'update_user_id'=>session('admin_auth.aid'),
|
|
'update_user_type'=>1,
|
|
);
|
|
$where=array(
|
|
'id'=>input('id'),
|
|
'status'=>$status,
|
|
'apply_admin_id'=>array('EQ', 0),
|
|
);
|
|
|
|
$apply=Db::name('org_apply')->where($where)->update($data);
|
|
if($apply==0){
|
|
$this->error('数据已更新,请重试!');
|
|
} else {
|
|
$this->success('已受理',url('org/Orgapply/apply_check',array('id'=>input('id'),'applystatus'=>$status)));
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$this->error('用户ID不存在');
|
|
}
|
|
}
|
|
|
|
public function apply_check(){
|
|
creatToken();
|
|
$apply_id=input('id');
|
|
$apply_status=input('applystatus');
|
|
$user_id=session('admin_auth.aid');
|
|
$this->assign('user_id',$user_id);
|
|
|
|
$apply = Db::name('org_apply')->where('id',$apply_id)->where('status',$apply_status)->find();
|
|
$this->assign('apply',$apply);
|
|
|
|
//设置当前步骤标题
|
|
if($apply['status']==1){
|
|
$curr_step='缴费金额设置';
|
|
}elseif ($apply['status']==3){
|
|
$curr_step='缴费确认';
|
|
}elseif ($apply['status']==5){
|
|
$curr_step='初审';
|
|
}elseif ($apply['status']==6){
|
|
$curr_step='风控复审';
|
|
}elseif ($apply['status']==7){
|
|
$curr_step='领导审核';
|
|
}elseif ($apply['status']==9){
|
|
$curr_step='企业信息审核';
|
|
}
|
|
$this->assign('curr_step',$curr_step);
|
|
|
|
//查询缴费确认历史
|
|
if(in_array($apply['status'],[3,5,6,7,9])){
|
|
$apply_cw = Db::name('org_cw')->where('apply_id',$apply_id)->order('create_time desc')->select();
|
|
$this->assign('apply_cw',$apply_cw);
|
|
//缴费凭证
|
|
$apply_jfpz = Db::name('org_upfiles')->where(['apply_id'=>$apply_id,'status'=>2])->order('upload_time desc')->find();
|
|
$this->assign('apply_jfpz',$apply_jfpz);
|
|
}
|
|
//查询初审历史
|
|
if(in_array($apply['status'],[5,6,7,9])){
|
|
$apply_cs = Db::name('org_cs')->where('apply_id',$apply_id)->order('create_time desc')->select();
|
|
$this->assign('apply_cs',$apply_cs);
|
|
//上传文件列表
|
|
$where['apply_type']=array(array('eq',0),array('eq',$apply['org_name']), 'or');;
|
|
$where['status']=4;
|
|
$where['isopen']=1;
|
|
$apply_uptypelist = Db::name('org_uptype')->where($where)->select();
|
|
for ($x=0; $x<count($apply_uptypelist); $x++) {
|
|
$filewhere['apply_id']=$apply_id;
|
|
$filewhere['ftype_id']=$apply_uptypelist[$x]['ftype_id'];
|
|
$filewhere['new_flag']=1;
|
|
$file = Db::name('org_upfiles')->where($filewhere)->order('upload_time desc')->find();
|
|
$apply_uptypelist[$x]['file']=$file;
|
|
}
|
|
$this->assign('apply_uptypelist',$apply_uptypelist);
|
|
}
|
|
//查询风控复审历史
|
|
if(in_array($apply['status'],[6,7,9])){
|
|
$apply_fk = Db::name('org_fk')->where('apply_id',$apply_id)->order('create_time desc')->select();
|
|
$this->assign('apply_fk',$apply_fk);
|
|
}
|
|
//查询领导审核历史
|
|
if(in_array($apply['status'],[7,9])){
|
|
$apply_ldsh = Db::name('org_ldsh')->where('apply_id',$apply_id)->order('create_time desc')->select();
|
|
$this->assign('apply_ldsh',$apply_ldsh);
|
|
}
|
|
return $this->fetch();
|
|
}
|
|
|
|
public function apply_runcheck(){
|
|
$id=input('id');
|
|
$apply = Db::name('org_apply')->where('id',$id)->find();
|
|
//审核通过检查是否还有未审核通过的文件
|
|
if(input('submitType')==1) {
|
|
$file_count = Db::name('org_upfiles')->where(['apply_id'=>$id,'flag'=>0,'new_flag'=>1])->count();
|
|
if($file_count){
|
|
session('TOKEN',input('TOKEN'));
|
|
$this->error('还有文件未审核通过');
|
|
}
|
|
}else if($apply['status']!=3){
|
|
$file_count = Db::name('org_upfiles')->where(['apply_id'=>$id,'flag'=>0,'new_flag'=>1])->count();
|
|
if($file_count==0){
|
|
session('TOKEN',input('TOKEN'));
|
|
$this->error('文件已全部审核通过,请将文件审核未不通过再操作!');
|
|
}
|
|
}
|
|
if(empty($apply)){
|
|
session('TOKEN',input('TOKEN'));
|
|
$this->error('申请不存在');
|
|
}
|
|
if($apply['status']!=1 && $apply['status']!=9){
|
|
if(input('advice')=='')
|
|
{
|
|
$this->error('请输入审核意见!');
|
|
}
|
|
}
|
|
|
|
//审核的数据内容
|
|
$data=array(
|
|
'apply_id'=>$id,//申请ID
|
|
'advice'=>input('advice',"未填写"),//审批意见
|
|
'create_id'=>session('admin_auth.aid'),//审批人
|
|
'create_time'=>time(),//审批时间
|
|
);
|
|
//根据当前状态和审核操作,变更对应状态
|
|
if($apply['status']==1){//当前状态为设置金额
|
|
$update_status = 2;//缴费中(已设置金额)
|
|
$org_data['amount']=input('amount');
|
|
}elseif ($apply['status']==3){//缴费确认
|
|
$table_name = 'org_cw';//将审核数据保存到对应表
|
|
if(input('submitType')==1) {
|
|
$update_status = 4;//上传资料中(已确认缴费)
|
|
}else{
|
|
$update_status = 11;//会员修改中(缴费确认未通过)
|
|
}
|
|
}elseif ($apply['status']==5){//初审
|
|
$table_name = 'org_cs';//将审核数据保存到对应表
|
|
if(input('submitType')==1) {
|
|
$update_status = 6;//风控复审中(初审已通过)
|
|
}else{
|
|
$update_status = 12;//会员修改中(初审未通过)
|
|
}
|
|
}elseif ($apply['status']==6){//风控复审
|
|
$table_name = 'org_fk';//将审核数据保存到对应表
|
|
if(input('submitType')==1) {
|
|
$update_status = 7;//领导审核中(风控复审已通过)
|
|
}else{
|
|
$update_status = 13;//会员修改中(风控复审未通过)
|
|
}
|
|
}elseif ($apply['status']==7){//领导审核
|
|
$table_name = 'org_ldsh';//将审核数据保存到对应表
|
|
if(input('submitType')==1) {
|
|
$update_status = 8;//上传企业信息中(领导审核已通过)
|
|
}else{
|
|
$update_status = 14;//会员修改中(领导审核未通过)
|
|
}
|
|
}elseif ($apply['status']==9){//企业信息确认
|
|
$update_status = 10;//申请成功
|
|
}
|
|
|
|
//找到当前最大addorder
|
|
if(!empty($table_name)){
|
|
$check=Db::name($table_name)->where('apply_id',$id)->order('addorder desc') ->find ();
|
|
if(!empty($check)){
|
|
$data['addorder']=$check['addorder']+1;
|
|
}else{
|
|
$data['addorder']=0;
|
|
}
|
|
}
|
|
if($apply['org_name']==1) $org_name='省级文化金融服务中心';
|
|
elseif ($apply['org_name']==2)$org_name='市级文化金融服务中心';
|
|
elseif ($apply['org_name']==3)$org_name='(行业)专板';
|
|
elseif ($apply['org_name']==4)$org_name='(行业)专区';
|
|
elseif ($apply['org_name']==5)$org_name='省级运营中心';
|
|
elseif ($apply['org_name']==6)$org_name='市级运营中心';
|
|
elseif ($apply['org_name']==7)$org_name='推荐机构';
|
|
elseif ($apply['org_name']==8)$org_name='驻场服务机构全国';
|
|
elseif ($apply['org_name']==9)$org_name='驻场服务机构区域';
|
|
$defaultFileLink='</br>请点击: <div class="basicname modeub modeac modepc " onclick="to_edit('.$id.')">上传资料</div>';
|
|
//系统通知内容
|
|
if(input('submitType')==2){
|
|
//审核不通过发送通知给客户
|
|
if($apply['status']==3){
|
|
$notice_title='您(或您关联)的合作机构申请缴费凭证审核不通过,请重新上传!';
|
|
$notic_content='您(或您关联)的合作机构申请不通过,需要您重新修改信息或上传缴费凭证后再提交。<br>审批意见:<br>审批意见:'.input('advice',"").$defaultFileLink;
|
|
}else if($apply['status']==5){
|
|
$notice_title='您(或您关联)的合作机构申请初审审核不通过,请修改资料!';
|
|
$sys=Orgsetup::get('orgcheck_options','-1');
|
|
$notic_content=str_replace('#APPLYCONTENTS#',input('advice',""),$sys['content_tpl']);
|
|
$notic_content=str_replace('#COMNAME#',$apply['comname'],$notic_content);
|
|
$notic_content=str_replace('#APPLYNAME#',$org_name,$notic_content);
|
|
$notic_content=str_replace('#DATE#',date('Y年m月d日', time()),$notic_content);
|
|
}else if($apply['status']==6){
|
|
$notice_title='您(或您关联)的合作机构申请风控审核不通过,请修改资料!';
|
|
$notic_content='您(或您关联)的合作机构申请不通过,需要您重新修改信息或上传资料后再提交。<br>审批意见:'.input('advice',"").$defaultFileLink;
|
|
}else if($apply['status']==7){
|
|
$notice_title='您(或您关联)的合作机构申请领导审核不通过,请修改资料!';
|
|
$notic_content='您(或您关联)的合作机构申请不通过,需要您重新修改信息或上传资料后再提交。<br>审批意见:'.input('advice',"").$defaultFileLink;
|
|
}
|
|
}else if($update_status==2){//缴费中,需要发送缴费通知
|
|
$fee_where['name']=$org_name;
|
|
$fee_where['code']='orgfee_options';
|
|
$sys=Db::name('org_temp')->where($fee_where)->find();//缴费通知模板
|
|
$notic_content=str_replace('#MONEY#',$org_data['amount'],$sys['content_tpl']);
|
|
$notic_content=str_replace('#COMNAME#',$apply['comname'],$notic_content);
|
|
$notic_content=str_replace('#ORGNAME#',$org_name,$notic_content);
|
|
$notic_content=str_replace('#DATE#',date('Y年m月d日', time()),$notic_content);
|
|
$notice_title='您(或您关联)的合作机构申请已审核,请缴费后上传缴费凭证!';
|
|
}else if($update_status==10){//托管成功,发送成功通知给客户
|
|
$org_data=[
|
|
'enterprise_name'=>input('enterprise_name'),
|
|
'enterprise_desc'=>input('enterprise_desc'),
|
|
'enterprise_address'=>input('enterprise_address'),
|
|
'legal_person'=>input('legal_person'),
|
|
'contact'=>input('contact'),
|
|
'business_code'=>input('business_code'),
|
|
'startdate'=>input('startdate'),
|
|
'enddate'=>input('enddate'),
|
|
'status'=>9
|
|
];
|
|
//消息通知内容
|
|
$notice_title='('.$org_data['enterprise_name'].')合作机构申请成功通知';
|
|
$sys=Orgsetup::get('orgsuccess_options','-1');
|
|
$notic_content=str_replace('#CODE#',input('business_code'),$sys['content_tpl']);
|
|
$notic_content=str_replace('#COMNAME#',input('enterprise_name'),$notic_content);
|
|
$notic_content=str_replace('#DATE#',date('Y年m月d日', time()),$notic_content);
|
|
//公告内容
|
|
$sys_gg=Orgsetup::get('orggg_options','-1');
|
|
$gg_title='('.$org_data['enterprise_name'].')合作机构申请成功通知';
|
|
$gg_content=str_replace('#CODE#',input('business_code'),$sys_gg['content_tpl']);
|
|
$gg_content=str_replace('#COMNAME#',input('enterprise_name'),$gg_content);
|
|
$gg_content=str_replace('#DATE#',date('Y年m月d日', time()),$gg_content);
|
|
$gg_data=[
|
|
'n_title'=>$gg_title,
|
|
'n_content'=>$gg_content,
|
|
'n_status'=>1,
|
|
'n_time'=>time(),
|
|
'n_uid'=>1,
|
|
'n_cid'=>1,
|
|
'n_hits'=>0,
|
|
];
|
|
//牌匾内容
|
|
$pb_title='合作机构牌匾';
|
|
$sys_pb=Orgsetup::get('orgplaque_options','-1');
|
|
$pb_content=str_replace('#PBAREANAME#',input('area_name'),$sys_pb['content_tpl']);
|
|
$pb_content=str_replace('#PBCODE#',input('business_code'),$pb_content);
|
|
$pb_content=str_replace('#PBNAME#',input('enterprise_name'),$pb_content);
|
|
$pb_content='<div class="pb_temp" style="background-color: white;"><div style="background: url("/public/img/pb_temp.jpg");height:599px;background-repeat: no-repeat;background-size: 90%;">'.$pb_content.'</div></div><div class="basicname modeub modeac modepc downPDF_btn">下载</div>';
|
|
$pb_data=[
|
|
'notice_title'=>$pb_title,
|
|
'notice'=>$pb_content,
|
|
'apply_id'=>$id,
|
|
'user_id'=>$apply['uid'],
|
|
'create_id'=>session('admin_auth.aid'),
|
|
'create_type'=>1,
|
|
'create_time'=>time()
|
|
];
|
|
//图片
|
|
$files = request()->file('');
|
|
if(!empty($files['enterprise_logo'])){
|
|
$info = $files['enterprise_logo']->rule('md5')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
|
|
if ($info) {
|
|
$org_data['enterprise_logo']=config('upload_path') . '/' . date('Y-m-d') . '/' . $info->getFilename();
|
|
}
|
|
}
|
|
if(!empty($files['person_pic'])){
|
|
$info2 = $files['person_pic']->rule('md5')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
|
|
if ($info2) {
|
|
$org_data['person_pic']=config('upload_path') . '/' . date('Y-m-d') . '/' . $info2->getFilename();
|
|
}
|
|
}
|
|
|
|
//合作机构展示内容
|
|
$org_title=input('enterprise_name');
|
|
if(empty($org_data['enterprise_logo'])){
|
|
$org_data['enterprise_logo']=$apply['enterprise_logo'];
|
|
}
|
|
if(empty($org_data['person_pic'])){
|
|
$org_data['person_pic']=$apply['person_pic'];
|
|
}
|
|
$enterprise_logo= '<img src="'.$org_data['enterprise_logo'].'" style="width:60%">';
|
|
$person_pic= '<img src="'.$org_data['person_pic'].'" style="width:200px">';
|
|
$sys_org=Orgsetup::get('orginfo_options','-1');
|
|
$org_content=str_replace('#ENTERPRISE_NAME#',$org_data['enterprise_name'],$sys_org['content_tpl']);
|
|
$org_content=str_replace('#ENTERPRISE_LOGO#',$enterprise_logo,$org_content);
|
|
$org_content=str_replace('#ENTERPRISE_DESC#',$org_data['enterprise_desc'],$org_content);
|
|
$org_content=str_replace('#ENTERPRISE_ADDRESS#',$org_data['enterprise_address'],$org_content);
|
|
$org_content=str_replace('#LEGAL_PERSON#',$org_data['legal_person'],$org_content);
|
|
$org_content=str_replace('#CONTACT#',$org_data['contact'],$org_content);
|
|
$org_content=str_replace('#PERSON_PIC#',$person_pic,$org_content);
|
|
$org_info=[
|
|
'n_title'=>$org_title,
|
|
'n_content'=>$org_content,
|
|
'n_status'=>1,
|
|
'n_time'=>time(),
|
|
'n_uid'=>1,
|
|
'n_cid'=>1,
|
|
'n_hits'=>0,
|
|
'n_order'=>1
|
|
];
|
|
|
|
//盖章授权书
|
|
$sq_title='授权书';
|
|
$sys_sq=Orgsetup::get('orgsq_options','-1');
|
|
$sq_content=$sys_sq['content_tpl'];
|
|
$sq_content=str_replace('#ORGNAME#',$org_data['enterprise_name'],$sq_content);
|
|
$sq_content=str_replace('#ORGTYPE#',$org_name,$sq_content);
|
|
$sq_content=str_replace('#VAILDDATE#',$org_data['startdate'].' 至 '.$org_data['enddate'],$sq_content);
|
|
$sq_content=str_replace('#DATE#',date('Y年m月d日', time()),$sq_content);
|
|
$sq_content='<div class="downPDF" >'.$sq_content.'</div><div class="basicname modeub modeac modepc downPDF_btn">下载</div>';
|
|
$sq_data=[
|
|
'notice_title'=>$sq_title,
|
|
'notice'=>$sq_content,
|
|
'apply_id'=>$id,
|
|
'user_id'=>$apply['uid'],
|
|
'create_id'=>session('admin_auth.aid'),
|
|
'create_type'=>1,
|
|
'create_time'=>time()
|
|
];
|
|
}elseif($update_status==4){
|
|
$notice_title='('.$org_name.')合作机构申请缴费确认通知';
|
|
$notic_content = '您上传的缴费凭证已通过财务审核!请上传相关资料。';
|
|
}elseif($update_status==8){
|
|
$notice_title='('.$org_name.')合作机构申请上传企业信息通知';
|
|
$notic_content = '您的合作机构申请已通过,请及时上传企业相关信息。';
|
|
}
|
|
Db::startTrans();
|
|
try{
|
|
$org_data['status']=$update_status;
|
|
$org_data['update_user_id']=session('admin_auth.aid');
|
|
$org_data['update_user_type']=2;//后台
|
|
$org_data['update_time']=time();
|
|
$org_data['apply_admin_id']=0;
|
|
$where=array(
|
|
'id'=>$apply['id'],
|
|
'status'=>$apply['status'],
|
|
);
|
|
Db::name('org_apply')->where($where)->update($org_data);
|
|
if(!empty($table_name)){
|
|
Db::name($table_name)->insert($data);
|
|
}
|
|
|
|
if(input('submitType')==2 || in_array($update_status,[2,10,4,8])){
|
|
$n_data=[
|
|
'notice_title'=>$notice_title,
|
|
'notice'=>$notic_content,
|
|
'apply_id'=>$id,
|
|
'user_id'=>$apply['uid'],
|
|
'create_id'=>session('admin_auth.aid'),
|
|
'create_type'=>1,
|
|
'create_time'=>time()
|
|
];
|
|
Db::name('cult4notice')->insert($n_data);
|
|
}
|
|
if($update_status==10){
|
|
if(!empty($gg_data)){
|
|
Db::name('bsgg')->insert($gg_data);
|
|
}
|
|
if(!empty($pb_data)){
|
|
Db::name('cult4notice')->insert($pb_data);
|
|
}
|
|
if(!empty($sq_data)){
|
|
Db::name('cult4notice')->insert($sq_data);
|
|
}
|
|
if(!empty($org_info)){
|
|
Db::name($apply['org_type'])->insert($org_info);
|
|
}
|
|
}
|
|
// 提交事务
|
|
Db::commit();
|
|
}catch (\Exception $exception){
|
|
Db::rollback();//回滚事务
|
|
session('TOKEN',input('TOKEN'));//审核失败,将token添加回session里
|
|
$this->error('审核失败');
|
|
}
|
|
$this->success('审核成功',url('org/Orgapply/apply_list',array('applystatus'=>$apply['status'])));
|
|
}
|
|
|
|
/**
|
|
* 文件核验开启/禁止
|
|
*/
|
|
public function apply_state()
|
|
{
|
|
$id=input('x');
|
|
if (empty($id)){
|
|
$this->error('用户ID不存在');
|
|
}
|
|
|
|
$flag=Db::name('org_upfiles')->where('file_id',$id)->value('flag');//判断当前状态情况
|
|
if($flag==1){
|
|
$flagdata = array('flag'=>0);
|
|
Db::name('org_upfiles')->where('file_id',$id)->setField($flagdata);
|
|
$this->success('审核未通过');
|
|
}else{
|
|
$flagdata = array('flag'=>1);
|
|
Db::name('org_upfiles')->where('file_id',$id)->setField($flagdata);
|
|
$this->success('审核已通过');
|
|
}
|
|
}
|
|
|
|
}
|