diff --git a/app/admin/behavior/Cron.php b/app/admin/behavior/Cron.php
new file mode 100644
index 0000000..a0e1884
--- /dev/null
+++ b/app/admin/behavior/Cron.php
@@ -0,0 +1,58 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\behavior;
+
+use think\Log;
+
+class Cron
+{
+ protected $options = array(
+ 'cron_max_time' => 60,
+ );
+ public function run(&$params)
+ {
+ $this->options['cron_max_time']=config('cron_max_time')?:60;
+ $lockfile = RUNTIME_PATH.'cron.lock';
+ if(is_writable($lockfile) && filemtime($lockfile) > $_SERVER['REQUEST_TIME'] - $this->options['cron_max_time']) {
+ return ;
+ } else {
+ touch($lockfile);
+ }
+ @set_time_limit(1000);
+ @ignore_user_abort(true);
+ if(is_file(RUNTIME_PATH.'~crons.php')) {
+ $crons = include RUNTIME_PATH.'~crons.php';
+ }elseif(is_file(ROOT_PATH.'app/crons.php')){
+ $crons = include ROOT_PATH.'app/crons.php';
+ }
+ if(isset($crons) && is_array($crons)) {
+ $update = false;
+ $log = array();
+ foreach ($crons as $key=>$cron){
+ if(empty($cron[2]) || $_SERVER['REQUEST_TIME']>=$cron[2]) {
+ debug('cronStart');
+ include ROOT_PATH.'app/cron/'.$cron[0].'.php';
+ debug('cronEnd');
+ $_useTime = debug('cronStart','cronEnd', 6);
+ $cron[2] = $_SERVER['REQUEST_TIME']+$cron[1];
+ $crons[$key] = $cron;
+ $log[] = "Cron:$key Runat ".date('Y-m-d H:i:s')." Use $_useTime s\n";
+ $update = true;
+ }
+ }
+ if($update) {
+ Log::write(implode('',$log));
+ $content = "";
+ file_put_contents(RUNTIME_PATH.'~crons.php',$content);
+ }
+ }
+ file_exists($lockfile) && unlink($lockfile);
+ return ;
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Activitys.php b/app/admin/controller/Activitys.php
new file mode 100644
index 0000000..a9d176e
--- /dev/null
+++ b/app/admin/controller/Activitys.php
@@ -0,0 +1,624 @@
+groupid=$groupid;
+ }
+ /**
+ * 列表
+ */
+ public function index()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['kind']=$kind;
+ if($search_name){
+ $map['title']= array('like',"%".$search_name."%");
+ }
+ $gid=$this->groupid;
+ if(!in_array($gid,[1,2])&&$gid)$map['groups']=[['like',"%,".$gid.",%"],['like',$gid.",%"],['like',"%".$gid."%"],'OR'];
+ $admin_list=Db::name('activity')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+
+ return $this->fetch();
+ }
+ /**
+ * 添加
+ */
+ public function add()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $auth_group=Db::name('auth_group')->where('status','1')->select();
+ $this->assign('groups',$auth_group);
+
+ $list=Db::name('smstpl')->where('status','1')->select();
+ $this->assign('tpls',$list);
+ $apply=[];
+ array_push($apply,['fname'=>'姓名','ftag'=>'uname','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>1]);
+ array_push($apply,['fname'=>'性别','ftag'=>'usex','ftype'=>'radio','frequire'=>1,'foptions'=>'男||女','fnotice'=>'','del'=>1,'fsort'=>2]);
+ array_push($apply,['fname'=>'年龄','ftag'=>'uage','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>3]);
+ array_push($apply,['fname'=>'工作','ftag'=>'ujob','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>4]);
+ array_push($apply,['fname'=>'电话','ftag'=>'utel','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>5]);
+ array_push($apply,['fname'=>'邮箱','ftag'=>'uemail','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>6]);
+ $this->assign("apply",$apply);
+ $this->assign('role',$this->groupid);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runadd()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $data=[];
+ $data['title']=input('title');
+ $data['kind']=$kind;
+ $data['status']=input('status');
+ $data['login']=input('login');
+ $data['contact']=input('contact');
+ $data['notice']=input('notice');
+ $data['poster']=input('poster');
+ $data['banner']=input('banner');
+ $data['pic']=input('pic');
+ $data['infor']=input('infor');
+ $data['smsid']=input('smsid');
+ $start=input('start_date');
+ if($start)$start=strtotime($start);
+ $data['start_date']=$start;
+ $end=input('end_date');
+ if($end)$end=strtotime($end);
+ $data['end_date']=$end;
+ $data['create_date']=time();
+ $groups=isset($_POST['groups'])?$_POST['groups']:'';
+ $data['groups']=is_array($groups)?implode(',', $groups):'';
+ $apply=input('apply')?htmlspecialchars_decode(input('apply')):'';
+ if($apply){
+ $applylist=json_decode($apply,true);
+ array_multisort(array_column($applylist,'fsort'),SORT_ASC,$applylist);
+ $apply=$applylist;
+ $apply=json_encode($apply);
+ $fileds=array_column($applylist,'ftag');
+ $cfileds=Db::name('activityapply')->getTableFields(['table'=>'wjs_activityapply']);
+
+ $update=true;
+ foreach ($fileds as $k=>$row){
+ if(!in_array($row, $cfileds)){
+ $current=$applylist[$k];
+ $curtext='varchar(255)';
+ if($current['ftype']=='checkbox'||$current['ftype']=='select'||$current['ftype']=='date') $curtext='int(11)';
+ if($current['ftype']=='textarea') $curtext='text';
+ if($current['frequire']==1)$curtext.=" not null ";
+ $sql="alter table wjs_activityapply add column ".$current['ftag']." ".$curtext." comment '".$current['fname'].' '.$current['foptions']."'";
+
+ $query=db()->execute($sql);
+ if(!$query){
+ $update=false;
+ break;
+ }
+ }
+ }
+ if(!$update){
+ $this->error('修改失败',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ }
+ $data['apply']=$apply;
+
+ $admin_id=Db::name('activity')->insert($data);
+ if($admin_id){
+ $this->success('添加成功',url('admin/Activitys/index',['kind'=>$kind]));
+ }else{
+ $this->error('添加失败',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('activity')->find(input('admin_id'));
+ $list['groups']=$list['groups']?explode(',',$list['groups']):[];
+
+ $apply=$list['apply']?json_decode(htmlspecialchars_decode($list['apply']),true):[];
+
+ if(!count($apply)){
+ array_push($apply,['fname'=>'姓名','ftag'=>'uname','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>1]);
+ array_push($apply,['fname'=>'性别','ftag'=>'usex','ftype'=>'radio','frequire'=>1,'foptions'=>'男||女','fnotice'=>'','del'=>1,'fsort'=>2]);
+ array_push($apply,['fname'=>'年龄','ftag'=>'uage','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>3]);
+ array_push($apply,['fname'=>'工作','ftag'=>'ujob','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>4]);
+ array_push($apply,['fname'=>'电话','ftag'=>'utel','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>5]);
+ array_push($apply,['fname'=>'邮箱','ftag'=>'uemail','ftype'=>'input','frequire'=>1,'foptions'=>'','fnotice'=>'','del'=>1,'fsort'=>6]);
+ }
+ $this->assign("apply",$apply);
+
+ $this->assign('list',$list);
+ $auth_group=Db::name('auth_group')->where('status','1')->select();
+ $this->assign('groups',$auth_group);
+ $list=Db::name('smstpl')->where('status','1')->select();
+ $this->assign('tpls',$list);
+ $this->assign('role',$this->groupid);
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedit()
+ {
+
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+
+ $data=[];
+ $data['title']=input('title');
+ $data['kind']=$kind;
+ $data['status']=input('status');
+ $data['login']=input('login');
+ $data['contact']=input('contact');
+ $data['notice']=input('notice');
+ $data['poster']=input('poster');
+ $data['banner']=input('banner');
+ $data['pic']=input('pic');
+ $data['infor']=input('infor');
+ $data['smsid']=input('smsid');
+ $start=input('start_date');
+ if($start)$start=strtotime($start);
+ $data['start_date']=$start;
+ $end=input('end_date');
+ if($end)$end=strtotime($end);
+ $data['end_date']=$end;
+ $data['create_date']=time();
+ $groups=isset($_POST['groups'])?$_POST['groups']:'';
+ $data['groups']=is_array($groups)?implode(',', $groups):'';
+ $apply=input('apply')?htmlspecialchars_decode(input('apply')):'';
+ if($apply){
+ $applylist=json_decode($apply,true);
+ array_multisort(array_column($applylist,'fsort'),SORT_ASC,$applylist);
+ $apply=$applylist;
+ $apply=json_encode($apply);
+ $fileds=array_column($applylist,'ftag');
+ $cfileds=Db::name('activityapply')->getTableFields(['table'=>'wjs_activityapply']);
+
+ $update=true;
+ foreach ($fileds as $k=>$row){
+ if(!in_array($row, $cfileds)){
+ $current=$applylist[$k];
+ $curtext='varchar(255)';
+ if($current['ftype']=='checkbox'||$current['ftype']=='select'||$current['ftype']=='date') $curtext='int(11)';
+ if($current['ftype']=='textarea') $curtext='text';
+ if($current['frequire']==1)$curtext.=" not null ";
+ $sql="alter table wjs_activityapply add column ".$current['ftag']." ".$curtext." comment '".$current['fname'].' '.$current['foptions']."'";
+
+ $query=db()->execute($sql);
+ if(!$query){
+ $update=false;
+ break;
+ }
+ }
+ }
+ if(!$update){
+ $this->error('修改失败',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ }
+ $data['apply']=$apply;
+ $id=input('id');
+ $rst=Db::name('activity')->where(['id'=>$id])->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Activitys/index',['kind'=>$kind]));
+ }else{
+ $this->error('修改失败',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ $rst=Db::name('activity')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Activitys/index',['kind'=>$kind]));
+ }else{
+ $this->error('删除失败',url('admin/Activitys/index',['kind'=>$kind]));
+ }
+ }
+
+ public function export(){
+ $id=input('admin_id');
+ $map=['id'=>$id];
+ $activity=Db::name('activity')->where($map)->find();
+ if(!$activity)$this->error("活动不存在");
+ $applys=Db::name('activityapply')->where(['aid'=>$id])->select();
+ $apply=json_decode($activity['apply'],true);
+
+ $expTitle=$activity['title'];
+ $expCellName=[];
+ foreach ($apply as $jow){
+ if($jow['ftag']&&$jow['fname']&&$jow['ftype']!='file'&&$jow['ftype']!='notice')array_push($expCellName,[$jow['ftag'],$jow['fname'],$jow['foptions'],$jow['ftype']]);
+ }
+ array_push($expCellName,['create_time','报名时间','','date']);
+ $apply=$activity['apply']?json_decode($activity['apply'],true):[];
+ foreach ($applys as &$row){
+ $row['usex']=$row['usex']==1?'男':'女';
+ if(count($apply)){
+ foreach ($apply as $j=>$jow){
+ $key=$jow['ftag'];
+ $val=$row[$key];
+ if($jow['ftype']=='select'||$jow['ftype']=='radio'){
+ $opts=$jow['foptions'];
+ if($opts){
+ $opts=explode("||", $opts);
+ $val=intval($val);
+ $val=isset($opts[$val-1])?$opts[$val-1]:'';
+ if($jow['ftype']=='radio'&&$val=='其他'){
+ $val.=$row['uother'];
+ }
+ }
+ }
+ if($jow['ftype']=='checkbox'){
+ $opts=$jow['foptions'];
+ if($opts){
+ $opts=explode("||", $opts);
+ $shtml='';
+ $vals=explode(",", $val);
+ foreach ($vals as $tmp){
+ $tmp=intval($tmp);
+ $shtml.=isset($opts[$tmp-1])?$opts[$tmp-1].';':'';
+ }
+ $val=$shtml;
+ }
+ }
+ $row[$key]=$val;
+ }
+ }
+ }
+ $expTableData=$applys;
+ $res=exportExcel($expTitle,$expCellName,$expTableData);
+ }
+ /**
+ * 列表
+ */
+ public function tpl()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['kind']=$kind;
+ if($search_name){
+ $map['title']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('smstpl')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /**
+ * 添加
+ */
+ public function addtpl()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runaddtpl()
+ {
+ $data=[];
+ $data['title']=input('title');
+ $data['status']=input('status');
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+ $admin_id=Db::name('smstpl')->insert($data);
+ $url=url('admin/Activitys/tpl');
+ if($admin_id){
+ $this->success('添加成功',$url);
+ }else{
+ $this->error('添加失败',$url);
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edittpl()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('smstpl')->find(input('admin_id'));
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedittpl()
+ {
+ $data=[];
+ $data['title']=input('title');
+ $data['status']=input('status');
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+ $id=input('id');
+ $rst=Db::name('smstpl')->where(['id'=>$id])->update($data);
+ $url=url('admin/Activitys/tpl');
+ if($rst!==false){
+ $this->success('修改成功',$url);
+ }else{
+ $this->error('修改失败',$url);
+ }
+ }
+ /**
+ * 删除
+ */
+ public function deltpl()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ $url=url('admin/Activitys/tpl');
+ if (empty($admin_id)){
+ $this->error('ID不存在',$url);
+ }
+ $rst=Db::name('smstpl')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',$url);
+ }else{
+ $this->error('删除失败',$url);
+ }
+ }
+
+ /**
+ * 列表
+ */
+ public function sms()
+ {
+ $kind=input("kind",'activitys');
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['sms_type']=$kind;
+ if($search_name){
+ $map['sms_txt|sms_tel']= array('like',"%".$search_name."%");
+ }
+
+ $admin_list=Db::name('smslog')->where($map)->order('sms_id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+
+ /**
+ * 删除
+ */
+ public function delsms()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ $url=url('admin/Activitys/sms');
+ if (empty($admin_id)){
+ $this->error('ID不存在',$url);
+ }
+ $rst=Db::name('smslog')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',$url);
+ }else{
+ $this->error('删除失败',$url);
+ }
+ }
+
+ /**
+ * 列表
+ */
+ public function apply()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $aid=input('aid');
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['kind']=$kind;
+ if($search_name){
+ $map['uname|ucard']= array('like',"%".$search_name."%");
+ }
+ if($aid)$map['aid']=$aid;
+ $admin_list=Db::name('activityapply')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ $this->assign('aid',$aid);
+ return $this->fetch();
+ }
+ /**
+ * 修改
+ */
+ public function editapply()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('activityapply')->find(input('admin_id'));
+ $aid=isset($list['aid'])?$list['aid']:'';
+ $showlist=[];
+ if($aid&&$list){
+ $activity=Db::name('activity')->where(['id'=>$aid])->find();
+ $apply=$activity['apply']?json_decode($activity['apply'],true):[];
+ if(count($apply)){
+ foreach ($apply as $j=>$jow){
+ $key=$jow['ftag'];
+ $val=$list[$key];
+ if($jow['ftype']=='date'){
+ $val=date("Y-m-d",$val);
+ }
+ if($jow['ftype']=='select'||$jow['ftype']=='radio'){
+ $opts=$jow['foptions'];
+ if($opts){
+ $opts=explode("||", $opts);
+ $val=intval($val);
+ $val=isset($opts[$val-1])?$opts[$val-1]:'';
+ if($jow['ftype']=='radio'&&$val=='其他'){
+ $val.=$list['uother'];
+ }
+ }
+ }
+ if($jow['ftype']=='checkbox'){
+ $opts=$jow['foptions'];
+ if($opts){
+ $opts=explode("||", $opts);
+ $shtml='';
+ $vals=explode(",", $val);
+ foreach ($vals as $tmp){
+ $tmp=intval($tmp);
+ $shtml.=isset($opts[$tmp-1])?$opts[$tmp-1].';':'';
+ }
+ $val=$shtml;
+ }
+ }
+ if($jow['ftype']=='file'){
+ $files=explode(";", $val);
+ $shtml='';
+ foreach ($files as $k=>$tmp){
+ $file=pathinfo($tmp);
+ if(isset($file['extension'])){
+ if(in_array($file['extension'],['jpg','jpeg','png','gif'])){
+ $shtml.='
';
+ }else{
+ $shtml.='附件'.$k.'';
+ }
+ }
+ }
+ $val=$shtml;
+ }
+ if($jow['ftype']!='notice')array_push($showlist,['key'=>$jow['fname'],'val'=>$val]);
+ }
+ }
+ }
+ $this->assign('showlist',$showlist);
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 删除
+ */
+ public function delapply()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ $url=url('admin/Activitys/apply');
+ if (empty($admin_id)){
+ $this->error('ID不存在',$url);
+ }
+ $rst=Db::name('activityapply')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',$url);
+ }else{
+ $this->error('删除失败',$url);
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function editstate(){
+ if(request()->isAjax()){
+ $exptime=input('exptime');
+ $data=[];
+ $data['express']=input('express');
+ $data['expname']=input('expname');
+ $data['exptime']=$exptime?strtotime($exptime):'';
+ $data['state']=input('state');
+ $data['advice']=input('advice');
+ $data['passtime']=(input('state')==1)?time():'';
+ $id=input('id');
+ $aid=input('aid');
+ $rst=Db::name('activityapply')->where(['id'=>$id])->update($data);
+ $url=url("apply",['aid'=>$aid]);
+ if($rst!==false){
+ $this->success('审核成功',$url);
+ }else{
+ $this->error('审核失败',$url);
+ }
+ }
+ $id=input('id');
+ $aid=input('aid');
+ $find=Db::name('activityapply')->where(array('id'=>$id))->find();
+
+ $this->assign('list',$find);
+ $this->assign('aid',$aid);
+ return $this->fetch();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function state()
+ {
+ $id=input('x');
+ $find=Db::name('activityapply')->where(array('id'=>$id))->find();
+ $msg='未审';
+ if($find){
+
+ $status=$find['state'];
+ if($status==1){
+ $statedata = array('state'=>0);
+ }else{
+ $statedata = array('state'=>1);
+ $msg='已审';
+ }
+ $send=$find['send'];
+ if($send==0){
+ $statedata['send']=1;
+ }
+ $query=Db::name('activityapply')->where(array('id'=>$id))->setField($statedata);
+ if($send==0&&$query){
+ $aid=$find['aid'];
+ $act=Db::name('activity')->where(array('id'=>$aid))->find();
+ if($act){
+ $notice_title='您好,您的活动报名('.$act['title'].')已审核成功 ';
+ $notice='';
+ $sl_data=[
+ 'notice_title'=>$notice_title,
+ 'notice'=>$notice_title,
+ 'user_id'=>$find['uid'],
+ 'apply_id'=>$aid,
+ 'create_id'=>session('admin_auth.aid'),
+ 'create_type'=>1,
+ 'create_time'=>time()
+ ];
+ Db::name('activitynotice')->insert($sl_data);
+ }
+ }
+ }
+ $this->success($msg);
+ }
+}
diff --git a/app/admin/controller/Addons.php b/app/admin/controller/Addons.php
new file mode 100644
index 0000000..3a7d254
--- /dev/null
+++ b/app/admin/controller/Addons.php
@@ -0,0 +1,177 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use app\common\model\Addon as AddonModel;
+use app\common\model\HookAddon as HookAddonModel;
+
+/**
+ * 插件后台管理页面
+ */
+class Addons extends Base
+{
+ /**
+ * 插件列表
+ */
+ public function addons_list()
+ {
+ $addons_model=new AddonModel;
+ $addons=$addons_model->getAll();
+ $this->assign('addons',$addons);
+ return $this->fetch();
+ }
+
+ /**
+ * 安装插件
+ */
+ public function install()
+ {
+ $addon_name = input('name','');
+ if ($addon_name == '') $this->error('插件不存在!');
+
+ $addon_class = get_addon_class($addon_name);
+ if (!class_exists($addon_class)) $this->error('插件不存在!');
+
+ // 实例化插件
+ $addon = new $addon_class;
+ // 插件预安装
+ if(!$addon->install()) $this->error('插件预安装失败!'. $addon->getError());
+
+ // 添加钩子
+ if (isset($addon->hooks) && $addon->hooks) {
+ if (!HookAddonModel::addHooks($addon->hooks, $addon_name)) {
+ $this->error('安装插件钩子时出现错误');
+ }
+ cache('hook_addons', null);
+ }
+ // 执行安装插件sql文件
+ $sql_file = realpath(ADDON_PATH.$addon_name.'/install.sql');
+ if (file_exists($sql_file)) {
+ if (isset($addon->database_prefix) && $addon->database_prefix != '') {
+ db_restore_file($sql_file,$addon->database_prefix);
+ } else {
+ db_restore_file($sql_file);
+ }
+ }
+
+ // 插件配置信息
+ $addon_info = $addon->info;
+ if(!$addon->checkInfo()) $this->error('插件信息不完整');
+ // 并入插件配置值
+ $addon_info['config'] = $addon->getConfig();
+
+ //插件管理操作
+ if(property_exists($addon,'admin_actions')){
+ $addon_info['admin_actions']=$addon->admin_actions;
+ }
+ // 将插件信息写入数据库
+ if (AddonModel::create($addon_info)) {
+ cache('addon_all',null);
+ $this->success('插件安装成功');
+ } else {
+ $this->error('插件安装失败');
+ }
+ }
+
+ /**
+ * 卸载插件
+ */
+ public function uninstall()
+ {
+ $addon_name = input('name','');
+ if ($addon_name == '') $this->error('插件不存在!');
+
+ $class = get_addon_class($addon_name);
+ if (!class_exists($class)) $this->error('插件不存在!');
+
+ // 实例化插件
+ $addon = new $class;
+ // 插件预卸
+ if(!$addon->uninstall()) {
+ $this->error('插件预卸载失败!原因:'. $addon->getError());
+ }
+
+ // 卸载插件自带钩子
+ if (isset($addon->hooks) && $addon->hooks) {
+ if (false === HookAddonModel::deleteHooks($addon_name)) {
+ $this->error('卸载插件钩子时出现错误');
+ }
+ cache('hook_addons', null);
+ }
+
+ // 执行卸载插件sql文件
+ $sql_file = realpath(config('plugin_path').$addon_name.'/uninstall.sql');
+ if (file_exists($sql_file)) {
+ if (isset($addon->database_prefix) && $addon->database_prefix != '') {
+ db_restore_file($sql_file,$addon->database_prefix);
+ } else {
+ db_restore_file($sql_file);
+ }
+ }
+ $addon_model=new AddonModel;
+ // 删除插件信息
+ if ($addon_model->where('name', $addon_name)->delete()) {
+ cache('addon_all', null);
+ $this->success('插件卸载成功');
+ } else {
+ $this->error('插件卸载失败');
+ }
+ }
+ /**
+ * 禁用插件
+ */
+ public function disable()
+ {
+ $id=input('id');
+ if (empty($id)){
+ $this->error('插件不存在',url('admin/Addons/addons_list'));
+ }
+ $rst=Db::name('addon')->where('id',$id)->setField('status',0);
+ if($rst!==false){
+ cache('addon_all',null);
+ cache('hook_addons',null);
+ $this->success('禁用成功',url('admin/Addons/addons_list'));
+ }else{
+ $this->error('禁用失败',url('admin/Addons/addons_list'));
+ }
+ }
+ /**
+ * 启用插件
+ */
+ public function enable()
+ {
+ $id=input('id');
+ if (empty($id)){
+ $this->error('插件不存在',url('admin/Addons/addons_list'));
+ }
+ $rst=Db::name('addon')->where('id',$id)->setField('status',1);
+ if($rst!==false){
+ cache('addon_all',null);
+ cache('hook_addons',null);
+ $this->success('启用成功',url('admin/Addons/addons_list'));
+ }else{
+ $this->error('启用失败',url('admin/Addons/addons_list'));
+ }
+ }
+ /**
+ * 插件排序
+ */
+ public function addons_order()
+ {
+ $list=[];
+ foreach (input('post.') as $id => $sort){
+ $list[]=['id'=>$id,'sort'=>$sort];
+ }
+ $model=new AddonModel;
+ $model->saveAll($list);
+ cache('addon_all',null);
+ $this->success('排序成功',url('admin/Addons/addons_list'));
+ }
+}
diff --git a/app/admin/controller/Admin.php b/app/admin/controller/Admin.php
new file mode 100644
index 0000000..406f816
--- /dev/null
+++ b/app/admin/controller/Admin.php
@@ -0,0 +1,315 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use app\admin\model\Admin as AdminModel;
+use app\admin\model\AuthRule;
+use think\Db;
+use think\Cache;
+
+class Admin extends Base
+{
+ /**
+ * 管理员列表
+ */
+ public function admin_list()
+ {
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($search_name){
+ $map['admin_username']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('admin')->where($map)->order('admin_open desc,admin_id')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('admin_list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /**
+ * 管理员添加
+ */
+ public function admin_add()
+ {
+ $auth_group=Db::name('auth_group')->where('status','1')->select();
+ $this->assign('auth_group',$auth_group);
+ return $this->fetch();
+ }
+ /**
+ * 管理员添加操作
+ */
+ public function admin_runadd()
+ {
+ $admin_id=AdminModel::add(input('admin_username'),'',input('admin_pwd'),input('admin_email',''),input('admin_tel',''),input('admin_open',0),input('admin_realname',''),input('group_id'));
+ if($admin_id){
+ $this->success('管理员添加成功',url('admin/Admin/admin_list'));
+ }else{
+ $this->error('管理员添加失败',url('admin/Admin/admin_list'));
+ }
+ }
+ /**
+ * 管理员修改
+ */
+ public function admin_edit()
+ {
+ $auth_group=Db::name('auth_group')->select();
+ $admin_list=Db::name('admin')->find(input('admin_id'));
+ $auth_group_access=Db::name('auth_group_access')->where(array('uid'=>$admin_list['admin_id']))->value('group_id');
+ $this->assign('admin_list',$admin_list);
+ $this->assign('auth_group',$auth_group);
+ $this->assign('auth_group_access',$auth_group_access);
+ return $this->fetch();
+ }
+ /**
+ * 管理员修改操作
+ */
+ public function admin_runedit()
+ {
+ $data=input('post.');
+ $rst=AdminModel::edit($data);
+ if($rst!==false){
+ $this->success('管理员修改成功',url('admin/Admin/admin_list'));
+ }else{
+ $this->error('管理员修改失败',url('admin/Admin/admin_list'));
+ }
+ }
+ /**
+ * 管理员删除
+ */
+ public function admin_del()
+ {
+ $admin_id=input('admin_id');
+ if (empty($admin_id)){
+ $this->error('用户ID不存在',url('admin/Admin/admin_list'));
+ }
+ Db::name('admin')->delete($admin_id);
+ $rst=Db::name('auth_group_access')->where('uid',$admin_id)->delete();
+ if($rst!==false){
+ $this->success('管理员删除成功',url('admin/Admin/admin_list'));
+ }else{
+ $this->error('管理员删除失败',url('admin/Admin/admin_list'));
+ }
+ }
+ /**
+ * 管理员开启/禁止
+ */
+ public function admin_state()
+ {
+ $id=input('x');
+ if (empty($id)){
+ $this->error('用户ID不存在',url('admin/Admin/admin_list'));
+ }
+ $status=Db::name('admin')->where('admin_id',$id)->value('admin_open');//判断当前状态情况
+ if($status==1){
+ $statedata = array('admin_open'=>0);
+ Db::name('admin')->where('admin_id',$id)->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('admin_open'=>1);
+ Db::name('admin')->where('admin_id',$id)->setField($statedata);
+ $this->success('状态开启');
+ }
+ }
+ /**
+ * 用户组列表
+ */
+ public function admin_group_list()
+ {
+ $auth_group=Db::name('auth_group')->select();
+ $this->assign('auth_group',$auth_group);
+ return $this->fetch();
+ }
+ /**
+ * 用户组添加
+ */
+ public function admin_group_add()
+ {
+ return $this->fetch();
+ }
+ /**
+ * 用户组添加操作
+ */
+ public function admin_group_runadd()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Admin/admin_group_list'));
+ }else{
+ $sldata=array(
+ 'title'=>input('title'),
+ 'status'=>input('status',0),
+ 'addtime'=>time(),
+ );
+ $rst=Db::name('auth_group')->insert($sldata);
+ if($rst!==false){
+ $this->success('用户组添加成功',url('admin/Admin/admin_group_list'));
+ }else{
+ $this->error('用户组添加失败',url('admin/Admin/admin_group_list'));
+ }
+ }
+ }
+ /**
+ * 用户组删除操作
+ */
+ public function admin_group_del()
+ {
+ $rst=Db::name('auth_group')->delete(input('id'));
+ if($rst!==false){
+ $this->success('用户组删除成功',url('admin/Admin/admin_group_list'));
+ }else{
+ $this->error('用户组删除失败',url('admin/Admin/admin_group_list'));
+ }
+ }
+ /**
+ * 用户组编辑
+ */
+ public function admin_group_edit()
+ {
+ $group=Db::name('auth_group')->find(input('id'));
+ $this->assign('group',$group);
+ return $this->fetch();
+ }
+ /**
+ * 用户组编辑操作
+ */
+ public function admin_group_runedit()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Admin/admin_group_list'));
+ }else{
+ $sldata=array(
+ 'id'=>input('id'),
+ 'title'=>input('title'),
+ 'status'=>input('status'),
+ );
+ Db::name('auth_group')->update($sldata);
+ $this->success('用户组修改成功',url('admin/Admin/admin_group_list'));
+ }
+ }
+ /**
+ * 用户组开启/禁用
+ */
+ public function admin_group_state()
+ {
+ $id=input('x');
+ $status=Db::name('auth_group')->where('id',$id)->value('status');//判断当前状态情况
+ if($status==1){
+ $statedata = array('status'=>0);
+ Db::name('auth_group')->where('id',$id)->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name('auth_group')->where('id',$id)->setField($statedata);
+ $this->success('状态开启');
+ }
+ }
+ /**
+ * 权限配置
+ */
+ public function admin_group_access()
+ {
+ $admin_group=Db::name('auth_group')->where(array('id'=>input('id')))->find();
+ $data=AuthRule::get_ruels_tree();
+ $this->assign('admin_group',$admin_group);
+ $this->assign('datab',$data);
+ return $this->fetch();
+ }
+ /**
+ * 权限配置保存
+ */
+ public function admin_group_runaccess()
+ {
+ $new_rules = input('new_rules/a');
+ $imp_rules = implode(',', $new_rules);
+ $sldata=array(
+ 'id'=>input('id'),
+ 'rules'=>$imp_rules,
+ );
+ if(Db::name('auth_group')->update($sldata)!==false){
+ Cache::clear();
+ $this->success('权限配置成功',url('admin/Admin/admin_group_list'));
+ }else{
+ $this->error('权限配置失败',url('admin/Admin/admin_group_list'));
+ }
+ }
+ /*
+ * 管理员信息
+ */
+ public function profile()
+ {
+ $admin=array();
+ if(session('admin_auth.aid')){
+ $admin=Db::name('admin')->alias("a")->join(config('database.prefix').'auth_group_access b','a.admin_id =b.uid')
+ ->join(config('database.prefix').'auth_group c','b.group_id = c.id')
+ ->where(array('a.admin_id'=>session('admin_auth.aid')))->find();
+ }
+ $this->assign('admin', $admin);
+ return $this->fetch();
+ }
+ /**
+ * 管理员修改
+ */
+ public function avatar_edit()
+ {
+ $admin_list=Db::name('admin')->find(session('admin_auth.aid'));
+ $this->assign('admin_list',$admin_list);
+ return $this->fetch();
+ }
+ /**
+ * 管理员修改操作
+ */
+ public function avatar_runedit()
+ {
+ $data=input('post.');
+ $data['admin_id']=session('admin_auth.aid');
+ $rst=AdminModel::avatar_edit($data);
+ if($rst!==false){
+ $this->success('个人信息修改成功',url('admin/Admin/profile'));
+ }else{
+ $this->error('个人信息修改失败',url('admin/Admin/profile'));
+ }
+ }
+ /*
+ * 管理员头像
+ */
+ public function avatar()
+ {
+ $imgurl=input('imgurl');
+ //去'/'
+ $imgurl=str_replace('/','',$imgurl);
+ $url='/data/upload/avatar/'.$imgurl;
+ $state=false;
+ if(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->uploadOne('.'.$url,"image/");
+ if ($info) {
+ $state=true;
+ $imgurl= config('storage.domain').$info['key'];
+ @unlink('.'.$url);
+ }
+ }
+ if($state !=true){
+ //本地
+ //写入数据库
+ $data['uptime']=time();
+ $data['filesize']=filesize('.'.$url);
+ $data['path']=$url;
+ Db::name('plug_files')->insert($data);
+ }
+ $admin=Db::name('admin')->where(array('admin_id'=>session('admin_auth.aid')))->find();
+ $admin['admin_avatar']=$imgurl;
+ $rst=Db::name('admin')->where(array('admin_id'=>session('admin_auth.aid')))->update($admin);
+ if($rst!==false){
+ session('admin_avatar',$imgurl);
+ $this->success ('头像更新成功',url('admin/Admin/profile'));
+ }else{
+ $this->error ('头像更新失败',url('admin/Admin/profile'));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Agencys.php b/app/admin/controller/Agencys.php
new file mode 100644
index 0000000..7a4cbf0
--- /dev/null
+++ b/app/admin/controller/Agencys.php
@@ -0,0 +1,230 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use app\admin\model\Agency;
+
+class Agencys extends Base
+{
+ /**
+ * 列表
+ */
+ public function index()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['kind']=$kind;
+ if($search_name){
+ $map['title']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('agency')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /**
+ * 添加
+ */
+ public function add()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runadd()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $data=[];
+ $data['title']=input('title');
+ $data['kind']=$kind;
+ $data['status']=1;
+ //$data['members']=input('members');
+ $data['contact']=input('contact');
+ $data['href']=input('href');
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+
+ $admin_id=Db::name('agency')->insert($data);
+ if($admin_id){
+ $this->success('添加成功',url('admin/Agencys/index',['kind'=>$kind]));
+ }else{
+ $this->error('添加失败',url('admin/Agencys/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('agency')->find(input('admin_id'));
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $data=input('post.');
+
+ $data=[];
+ $data['id']=input('id');
+ $data['title']=input('title');
+ $data['kind']=$kind;
+ $data['status']=input('status',0);
+ //$data['members']=input('members');
+ $data['contact']=input('contact');
+ $data['href']=input('href');
+ $data['infor']=input('infor');
+
+ $rst=Db::name('agency')->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Agencys/index',['kind'=>$kind]));
+ }else{
+ $this->error('修改失败',url('admin/Agencys/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('admin/Agencys/index',['kind'=>$kind]));
+ }
+ $rst=Db::name('agency')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Agencys/index',['kind'=>$kind]));
+ }else{
+ $this->error('删除失败',url('admin/Agencys/index',['kind'=>$kind]));
+ }
+ }
+
+ /**
+ * 列表
+ */
+ public function user()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['kind']=$kind;
+ if($search_name){
+ $map['username']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('agency_user')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /**
+ * 添加
+ */
+ public function adduser()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runadduser()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $data=[];
+ $data['username']=input('username');
+ $data['avatar']=input('avatar');
+ $data['kind']=$kind;
+ $data['status']=1;
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+ $admin_id=Db::name('agency_user')->insert($data);
+ if($admin_id){
+ $this->success('添加成功',url('admin/Agencys/user',['kind'=>$kind]));
+ }else{
+ $this->error('添加失败',url('admin/Agencys/user',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edituser()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('agency_user')->find(input('id'));
+ $this->assign('list',$list);
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedituser()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $data=input('post.');
+
+ $data=[];
+ $data['id']=input('id');
+ $data['username']=input('username');
+ $data['avatar']=input('avatar');
+ $data['kind']=$kind;
+ $data['status']=input('status',0);
+ $data['infor']=input('infor');
+
+ $rst=Db::name('agency_user')->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Agencys/user',['kind'=>$kind]));
+ }else{
+ $this->error('修改失败',url('admin/Agencys/user',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function deluser()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('admin/Agencys/user',['kind'=>$kind]));
+ }
+ $rst=Db::name('agency_user')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Agencys/user',['kind'=>$kind]));
+ }else{
+ $this->error('删除失败',url('admin/Agencys/user',['kind'=>$kind]));
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ajax.php b/app/admin/controller/Ajax.php
new file mode 100644
index 0000000..439eaab
--- /dev/null
+++ b/app/admin/controller/Ajax.php
@@ -0,0 +1,50 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Ajax
+{
+ /*
+ * 返回行政区域json字符串
+ */
+ public function getRegion()
+ {
+ $map['pid']=input('pid');
+ $map['type']=input('type');
+ $list=Db::name("region")->where($map)->select();
+ return json($list);
+ }
+ /*
+ * 返回模块下控制器json字符串
+ */
+ public function getController()
+ {
+ $module=input('request_module','admin');
+ $list=\ReadClass::readDir(APP_PATH . $module. DS .'controller');
+ return json($list);
+ }
+ /*
+ * 返回角色列表json字符串
+ */
+ public function getRole()
+ {
+ $map['type']=input('pid');
+ if($map['type']==1){
+ $map1['member_group_id']=array(array('gt',0),array('neq',2));//>0 and !=2
+ $list=Db::name("member_group")->field(array('member_group_id'=>'id','member_group_name'=>'name'))->where($map1)->select();
+ }elseif($map['type']==2){
+ $map2['id']=array('gt',0);
+ $list=Db::name("auth_group")->field(array('id'=>'id','title'=>'name'))->where($map2)->select();
+ }
+
+ return json($list);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ask.php b/app/admin/controller/Ask.php
new file mode 100644
index 0000000..969e7bb
--- /dev/null
+++ b/app/admin/controller/Ask.php
@@ -0,0 +1,135 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Request;
+use app\admin\model\Asklog;
+
+class Ask extends Base{
+ protected $table='asklog';
+ /**
+ * 首页数据展示
+ * @return mixed|string
+ */
+ public function index(Request $request){
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+ $kind=$request->param('kind');
+ $page=$request->param('page');
+ $this->assign('kind',$kind);
+
+ $db=Db::name($this->table)->alias("a")->field("a.*,m.member_list_username as name")->join(config('database.prefix').'member_list m','a.uid =m.member_list_id')->where('kind',$kind);
+ if($search_name){
+ $db->where('name|code','like','%'.$search_name.'%');
+ }
+ $gp_list=$db->order('create_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('showlist',$gp_list);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ public function content(Request $request){
+
+ $kind=input('kind');
+ $page=input('page');
+ $this->assign('page',$page);
+ $this->assign('kind',$kind);
+ $id = input('id', 0, 'intval');
+
+ if (!$id) $this->error('参数错误', url('Ask/index',array('kind'=>$kind)));
+ $gp_list = Db::name($this->table)->alias("a")->field("a.*,m.member_list_username as name")->join(config('database.prefix').'member_list m','a.uid =m.member_list_id')->where('id', $id)->find();
+
+ $content =unserialize($gp_list['content']);
+ $this->assign('content', $content);
+
+ $this->assign('list', $gp_list);
+ return $this->fetch();
+ }
+ public function edit(Request $request)
+ {
+ $kind=input('kind');
+ $page=input('page');
+ $this->assign('page',$page);
+ $this->assign('kind',$kind);
+ if(!request()->isAjax()) {
+ $id = input('id', 0, 'intval');
+ $this->assign('id', $id);
+ $tpl='edit';
+ return $this->fetch($tpl);
+ }else{
+ $jump=url('Ask/index',array('kind'=>$kind,'page'=>$page));
+
+ $sl_data=[];
+ $id = input('id', 0, 'intval');
+ $replay=input('replay');
+ $gp_list = Db::name($this->table)->where('id', $id)->find();
+ $content =unserialize($gp_list['content']);
+ array_push($content,['ques'=>'','ans'=>$replay,'type'=>1,'time'=>time()]);
+
+ $sl_data['id']=$id;
+ $sl_data['flag']=2;
+ $sl_data['update_time']=time();
+ $sl_data['content']=serialize($content);
+ $item=new Asklog();
+ $rst=$item->allowField(true)->update($sl_data);
+ if($rst!==false){
+ $this->success('回复成功',$jump);
+ }else{
+ $this->error('回复失败',$jump);
+ }
+ }
+ }
+
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function del(){
+ $p=input('p');
+ $kind=input('kind');
+ $this->assign('kind',$kind);
+ $rst=Db::name($this->table)->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('Ask/index',array('p' => $p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('Ask/index',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function alldel(){
+ $p = input('p');
+ $kind=input('kind');
+ $this->assign('kind',$kind);
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('Ask/index',array('p'=>$p,'kind'=>$kind)));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name($this->table)->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('Ask/index',array('p'=>$p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('Ask/index',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/controller/Auth.php b/app/admin/controller/Auth.php
new file mode 100644
index 0000000..d41113d
--- /dev/null
+++ b/app/admin/controller/Auth.php
@@ -0,0 +1,204 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+/**
+ * 权限认证类
+ * 功能特性:
+ * 1,是对规则进行认证,不是对节点进行认证。用户可以把节点当作规则名称实现对节点进行认证。
+ * $auth=new Auth(); $auth->check('规则名称','用户id')
+ * 2,可以同时对多条规则进行认证,并设置多条规则的关系(or或者and)
+ * $auth=new Auth(); $auth->check('规则1,规则2','用户id','and')
+ * 第三个参数为and时表示,用户需要同时具有规则1和规则2的权限。 当第三个参数为or时,表示用户值需要具备其中一个条件即可。默认为or
+ * 3,一个用户可以属于多个用户组(think_auth_group_access表 定义了用户所属用户组)。我们需要设置每个用户组拥有哪些规则(think_auth_group 定义了用户组权限)
+ *
+ * 4,支持规则表达式。
+ * 在think_auth_rule 表中定义一条规则时,如果type为1, condition字段就可以定义规则表达式。 如定义{score}>5 and {score}<100 表示用户的分数在5-100之间时这条规则才会通过。
+ */
+
+
+class Auth
+{
+ //默认配置
+ protected $_config = array(
+ 'auth_on' => true, // 认证开关
+ 'auth_type' => 1, // 认证方式,1为实时认证;2为登录认证。
+ 'auth_group' => 'auth_group', // 用户组数据表名
+ 'auth_group_access' => 'auth_group_access', // 用户-用户组关系表
+ 'auth_rule' => 'menu', // 权限规则表
+ 'auth_user' => 'auth_user' // 用户信息表
+ );
+ public function __construct()
+ {
+ if (config('auth_config')) {
+ //可设置配置项 auth_config, 此配置项为数组。
+ $this->_config = array_merge($this->_config, config('auth_config'));
+ }
+ }
+ /**
+ * 检查权限
+ * @param string|array $name 需要验证的规则列表,支持逗号分隔的权限规则或索引数组
+ * @param int $uid 认证用户的id
+ * @param int $type 执行check的模式
+ * @param string $mode 执行check的模式,'url'模式或'id'
+ * @param string $relation 如果为 'or' 表示满足任一条规则即通过验证;如果为 'and'则表示需满足所有规则才能通过验证
+ * @return boolean 通过验证返回true;失败返回false
+ */
+ public function check($name, $uid, $type=1, $mode='url', $relation='or')
+ {
+ if (!$this->_config['auth_on'])
+ return true;
+ $authList = $this->getAuthList($uid,$type,$mode); //获取用户需要验证的所有有效规则列表
+ if (is_string($name)) {
+ $name = strtolower($name);
+ if (strpos($name, ',') !== false) {
+ $name = explode(',', $name);
+ } else {
+ $name = array($name);
+ }
+ }
+ $list = array(); //保存验证通过的规则名
+ if ($mode=='url') {
+ $REQUEST = unserialize( strtolower(serialize($_REQUEST)) );
+ }
+ foreach ( $authList as $auth ) {
+ $query = preg_replace('/^.+\?/U','',$auth);
+ if ($mode=='url' && $query!=$auth ) {
+ parse_str($query,$param); //解析规则中的param
+ $intersect = array_intersect_assoc($REQUEST,$param);
+
+ $auth = preg_replace('/\?.*$/U','',$auth);
+ if ( in_array($auth,$name) && $intersect==$param ) { //如果节点相符且url参数满足
+ $list[] = $auth ;
+ }
+ }else if (in_array($auth , $name)){
+ $list[] = $auth ;
+ }
+ }
+
+ if ($relation == 'or' && !empty($list)) {
+ return true;
+ }
+ $diff = array_diff($name, $list);
+ if ($relation == 'and' && empty($diff)) {
+ return true;
+ }
+ return false;
+ }
+ /**
+ * 根据用户id获取用户组,返回值为数组
+ * @param int $uid 用户id
+ * @return array 用户所属的用户组 array(
+ * array('uid'=>'用户id','group_id'=>'用户组id','title'=>'用户组名称','rules'=>'用户组拥有的规则id,多个,号隔开'),
+ * ...)
+ */
+ public function getGroups($uid)
+ {
+ static $groups = array();
+ if (isset($groups[$uid]))
+ return $groups[$uid];
+ $user_groups = db()->name($this->_config['auth_group_access'] . ' a')
+ ->where("a.uid='$uid' and g.status='1'")
+ ->join(config('database.prefix')."{$this->_config['auth_group']} g"," a.group_id = g.id")
+ ->field('uid,group_id,title,rules')->select();
+ $groups[$uid]=$user_groups?:array();
+ return $groups[$uid];
+ }
+ /**
+ * 根据用户id获取用户组ids
+ * @param int $uid 用户id
+ * @return array 用户所属的用户组id array(1,2,3)
+ */
+ public function getGroupIds($uid)
+ {
+ static $groups = array();
+ if (isset($groups[$uid]))
+ return $groups[$uid];
+ $user_groups = db()->name($this->_config['auth_group_access'] . ' a')
+ ->where("a.uid='$uid' and g.status='1'")
+ ->join(config('database.prefix')."{$this->_config['auth_group']} g"," a.group_id = g.id")
+ ->column('group_id');
+ $groups[$uid]=$user_groups?:array();
+ return $groups[$uid];
+ }
+ /**
+ * 获得权限列表
+ * @param integer $uid 用户id
+ * @param integer $type
+ * @param string $mode 'url'或'id'
+ * @return array
+ */
+ public function getAuthList($uid,$type,$mode='url')
+ {
+ static $_authList = array(); //保存用户验证通过的权限列表
+ $mode=$mode?:'url';
+ $t = implode(',',(array)$type);
+ if (isset($_authList[$uid.'_'.$t.'_'.$mode])) {
+ return $_authList[$uid.'_'.$t.'_'.$mode];
+ }
+ //登录验证时,返回保存在session的列表
+ if( $this->_config['auth_type']==2 && isset($_SESSION['_AUTH_LIST_'.$uid.'_'.$t.'_'.$mode])){
+ return $_SESSION['_AUTH_LIST_'.$uid.'_'.$t.'_'.$mode];
+ }
+ //读取用户所属用户组
+ $groups = $this->getGroups($uid);
+ $ids = array();//保存用户所属用户组设置的所有权限规则id
+ foreach ($groups as $g) {
+ $ids = array_merge($ids, explode(',', trim($g['rules'], ',')));
+ }
+ $ids = array_unique($ids);
+ if (empty($ids)) {
+ $_authList[$uid.$t] = array();
+ return array();
+ }
+ //rules的ids
+ $map = array(
+ 'id' => array('in', $ids),
+ 'type' => $type,
+ 'notcheck'=>0,
+ );
+ //读取用户组所有权限规则
+ $rules = db()->name($this->_config['auth_rule'])->where($map)->whereOr('notcheck',1)->field('id,condition,name,notcheck')->select();
+ //循环规则,判断结果。
+ $authList = array();
+ foreach ($rules as $rule) {
+ if($rule['notcheck'] || empty($rule['condition'])){
+ $authList[] = ($mode=='url')?strtolower($rule['name']):$rule['id'];
+ }else{
+ $user = $this->getUserInfo($uid);//获取用户信息,一维数组
+ $command = preg_replace('/\{(\w*?)\}/', '$user[\'\\1\']', $rule['condition']);
+ @(eval('$condition=(' . $command . ');'));
+ if ($condition) {
+ $authList[] = ($mode=='url')?strtolower($rule['name']):$rule['id'];
+ }
+ }
+ }
+
+ $_authList[$uid.'_'.$t.'_'.$mode] = $authList;
+ if($this->_config['auth_type']==2){
+ //规则列表结果保存到session
+ session('_AUTH_LIST_'.$uid.'_'.$t.'_'.$mode,$authList);
+ }
+ return array_unique($authList);
+ }
+ /**
+ * 获得用户资料,根据自己的情况读取数据库
+ */
+ protected function getUserInfo($uid)
+ {
+ static $userinfo=array();
+ if(!isset($userinfo[$uid])){
+ $userinfo[$uid] = db()->where(array('admin_id'=>$uid))
+ ->name($this->_config['auth_user'])->find();
+ }
+ return $userinfo[$uid];
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Base.php b/app/admin/controller/Base.php
new file mode 100644
index 0000000..7dc83b1
--- /dev/null
+++ b/app/admin/controller/Base.php
@@ -0,0 +1,212 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use app\common\controller\Common;
+use app\admin\model\AuthRule;
+use OSS\OssClient;
+use OSS\Core\OssException;
+use think\Request;
+use think\Db;
+use think\Image;
+
+class Base extends Common
+{
+ public function _initialize()
+ {
+ parent::_initialize();
+ if(!$this->check_admin_login()) $this->redirect('admin/Login/login');//未登录
+ $auth=new AuthRule;
+ $id_curr=$auth->get_url_id();
+ //echo "
".$id_curr."
";
+ if(!$auth->check_auth($id_curr)){
+ $this->error('没有权限',url('admin/Index/index'));
+ }
+
+ //获取有权限的菜单tree
+ $menus=$auth->get_admin_menus();
+ $this->assign('menus',$menus);
+ //当前方法倒推到顶级菜单ids数组
+ $menus_curr=$auth->get_admin_parents($id_curr);
+ $this->assign('menus_curr',$menus_curr);
+ //取当前操作菜单父节点下菜单 当前菜单id(仅显示状态)
+ $menus_child=$auth->get_admin_parent_menus($id_curr);
+ $this->assign('menus_child',$menus_child);
+ $this->assign('id_curr',$id_curr);
+ $this->assign('admin_avatar',session('admin_auth.admin_avatar'));
+ }
+ public function uploadAliYun($filename='',$filepath=''){
+ $bucket = \aliyunoss\Common::getBucketName();
+ $ossClient = \aliyunoss\Common::getOssClient();
+
+ try {
+ $result = $ossClient->uploadFile($bucket,$filename,$filepath);
+ $path=$result['info']['url'];
+ return ['action'=>true,'path'=>$path,'filename'=>$filename];
+ }catch (OssException $e){
+ return ['action'=>false,'path'=>'','filename'=>'','msg'=>$e->getErrorMessage()];
+ }
+ }
+ protected function gmt_iso8601($time) {
+ $dtStr = date("c", $time);
+ $mydatetime = new \DateTime($dtStr);
+ $expiration = $mydatetime->format(\DateTime::ISO8601);
+ $pos = strpos($expiration, '+');
+ $expiration = substr($expiration, 0, $pos);
+ return $expiration."Z";
+ }
+
+ function aliinfo(Request $request){
+ $id=\aliyunoss\Common::accessKeyId; // 请填写您的AccessKeyId。
+ $key=\aliyunoss\Common::accessKeySecret; // 请填写您的AccessKeySecret。
+ // $host的格式为 bucketname.endpoint,请替换为您的真实信息。
+ $host =\aliyunoss\Common::bucketHost;
+ $endpoint=\aliyunoss\Common::endpoint;
+ // $callbackUrl为上传回调服务器的URL,请将下面的IP和Port配置为您自己的真实URL信息。
+ $callbackUrl = 'http://www.szcaee.cn/extend/aliyunoss/callback.php';
+ $dir =$request->param('dir'); // 用户上传文件时指定的前缀。
+ $dir.='/';
+ $callback_param = array('callbackUrl'=>$callbackUrl,
+ 'callbackBody'=>'filename=${object}&size=${size}&mimeType=${mimeType}&height=${imageInfo.height}&width=${imageInfo.width}&endpoint='.$host,
+ 'callbackBodyType'=>"application/x-www-form-urlencoded");
+ $callback_string = json_encode($callback_param);
+
+ $base64_callback_body = base64_encode($callback_string);
+ $now = time();
+ $expire = 30; //设置该policy超时时间是10s. 即这个policy过了这个有效时间,将不能访问。
+ $end = $now + $expire;
+ $expiration = $this->gmt_iso8601($end);
+
+
+ //最大文件大小.用户可以自己设置
+ $condition = array(0=>'content-length-range', 1=>0, 2=>1048576000);
+ $conditions[] = $condition;
+
+ // 表示用户上传的数据,必须是以$dir开始,不然上传会失败,这一步不是必须项,只是为了安全起见,防止用户通过policy上传到别人的目录。
+ $start = array(0=>'starts-with', 1=>'$key', 2=>$dir);
+ $conditions[] = $start;
+
+
+ $arr = array('expiration'=>$expiration,'conditions'=>$conditions);
+ $policy = json_encode($arr);
+ $base64_policy = base64_encode($policy);
+ $string_to_sign = $base64_policy;
+ $signature = base64_encode(hash_hmac('sha1', $string_to_sign, $key, true));
+
+ $response = array();
+ $response['accessid'] = $id;
+ $response['host'] = $host;
+ $response['policy'] = $base64_policy;
+ $response['signature'] = $signature;
+ $response['expire'] = $end;
+ $response['callback'] = $base64_callback_body;
+ $response['dir'] = $dir; // 这个参数是设置用户上传文件时指定的前缀。
+ echo json_encode($response);exit;
+ }
+ /**
+ * 上传方法
+ */
+ public function upload(Request $request){
+ // 获取表单上传文件
+ $key=$request->param('key');
+ if(!$key)return $this->error('參數錯誤');
+ $file = request()->file($key);
+ // 移动到框架应用根目录/uploads/ 目录下
+ $uploadpath=config('upload_path');
+ $path=ROOT_PATH . config('upload_path');
+ $validate = config('upload_validate');
+ $info = $file->validate($validate)->move($path);
+ if($info){
+ $data=array();
+ $data['ext']=$info->getExtension();
+ $data['path']=$uploadpath.DS.$info->getSaveName();
+ $data['filename']=$info->getFilename();
+ return $this->success('上傳成功','',$data);
+ }else{
+ return $this->error($file->getError());
+ }
+ }
+ /**
+ * 处理上传图片
+ * @param string $file
+ * @param string $files
+ * @return NULL[]|string[]
+ */
+ protected function dealFile($file='',$files=''){
+ $validate = config('upload_validate');
+ $img_one='';
+ $picall_url='';
+ $upload_path=config('upload_path'). DS . date('Y-m-d');
+ //单图
+ if (!empty($file)) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH .$upload_path);
+
+ if ($info) {
+ $img_url = $upload_path.'/'. $info->getFilename();
+ $ext=strtolower(pathinfo($img_url,PATHINFO_EXTENSION));
+
+ $imgfile='.'.$img_url;
+ //等比例宿放
+ if(file_exists($imgfile)&&in_array($ext,['jpg','gif','png','jpeg'])){
+ $image=Image::open($imgfile);
+ $width=$image->width();
+ $height=$image->height();
+ if($width>1000){
+ $nhei=(1000/$width)*$height;
+ $image->thumb(1000,$nhei);
+ $image->save($imgfile);
+ }
+ }
+
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+
+ return ['error'=>$file[0]->getError()];
+ }
+ }
+ //多图
+ if (!empty($files)) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH .$upload_path);
+ if ($info) {
+ $img_url = $upload_path.DS. $info->getFilename();
+
+ $ext=strtolower(pathinfo($img_url,PATHINFO_EXTENSION));
+
+ $imgfile='.'.$img_url;
+ //等比例宿放
+ if(file_exists($imgfile)&&in_array($ext,['jpg','gif','png','jpeg'])){
+ $image=Image::open($imgfile);
+ $width=$image->width();
+ $height=$image->height();
+ if($width>1000){
+ $nhei=(1000/$width)*$height;
+ $image->thumb(1000,$nhei);
+ $image->save($imgfile);
+ }
+ }
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ return ['error'=>$file[0]->getError()];
+ }
+ }
+ }
+ return ['img_one'=>$img_one,'picall_url'=>$picall_url];
+ }
+}
diff --git a/app/admin/controller/Bbs.php b/app/admin/controller/Bbs.php
new file mode 100644
index 0000000..1b5a1c7
--- /dev/null
+++ b/app/admin/controller/Bbs.php
@@ -0,0 +1,462 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Request;
+use app\admin\model\Asklog;
+
+class Bbs extends Base{
+ protected $table='bbslist';
+ protected $tablelog='bbslog';
+ protected $tablecate='bbstype';
+
+ protected function getWeekMyActionAndEnd($time = '', $first = 1){
+ //当前日期
+ if (!$time) $time = time();
+ $sdefaultDate = date("Y-m-d", $time);
+ //$first =1 表示每周星期一为开始日期 0表示每周日为开始日期
+ //获取当前周的第几天 周日是 0 周一到周六是 1 - 6
+ $w = date('w', strtotime($sdefaultDate));
+ //获取本周开始日期,如果$w是0,则表示周日,减去 6 天
+ $week_start = date('Y-m-d', strtotime("$sdefaultDate -" . ($w ? $w - $first : 6) . ' days'));
+ //本周结束日期
+ $week_end = date('Y-m-d', strtotime("$week_start +6 days"));
+ return array("week_start" => $week_start, "week_end" => $week_end);
+ }
+ /**
+ * 首页数据展示
+ * @return mixed|string
+ */
+ public function index(Request $request){
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+
+ $page=$request->param('page');
+
+
+ $db=Db::name($this->table)->alias("a")->field("a.*,m.member_list_username as uname,m.member_list_nickname as nickname")->join(config('database.prefix').'member_list m','a.mid =m.member_list_id','left');
+ if($search_name){
+ $db->where('name','like','%'.$search_name.'%');
+ }
+ $gp_list=$db->order('create_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $total=$gp_list->total();
+ $this->assign('total',$total);
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('showlist',$gp_list);
+
+
+ $count=Db::name($this->table)->sum('comment');
+ $this->assign("comment",$count);
+ $count=Db::name($this->table)->sum('viewnum');
+ $this->assign("viewnum",$count);
+
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y%m")'=>date("Ym")])->sum('comment');
+ $this->assign("mcomment",$count);
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y%m")'=>date("Ym")])->sum('viewnum');
+ $this->assign("mviewnum",$count);
+
+ $dates=$this->getWeekMyActionAndEnd();
+ $start=$dates['week_start'];
+ $end=$dates['week_end'];
+
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y-%m-%d")'=>['between',[$start,$end]]])->sum('comment');
+ $this->assign("wcomment",$count);
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y-%m-%d")'=>['between',[$start,$end]]])->sum('viewnum');
+ $this->assign("wviewnum",$count);
+
+
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y-%m-%d")'=>date("%Y-%m-%d")])->sum('comment');
+ $this->assign("dcomment",$count);
+ $count=Db::name($this->table)->where(['from_unixtime(update_time,"%Y-%m-%d")'=>date("%Y-%m-%d")])->sum('viewnum');
+ $this->assign("dviewnum",$count);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_show_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 首页数据展示
+ * @return mixed|string
+ */
+ public function log(Request $request){
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+
+ $page=$request->param('page');
+
+ $db=Db::name($this->tablelog)->alias("a")->field("a.*,m.member_list_username as uname,l.name")->join(config('database.prefix').'member_list m','a.mid =m.member_list_id','left')->join(config('database.prefix').'bbslist l','a.list_id =l.id','left');
+ if($search_name){
+ $db->where('a.content','like','%'.$search_name.'%');
+ }
+ $gp_list=$db->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('showlist',$gp_list);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_log_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ public function category(Request $request){
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+
+ $db=Db::name($this->tablecate);
+ if($search_name){
+ $db->where('name','like','%'.$search_name.'%');
+ }
+
+ $data=$db->order('id desc,create_time desc')->select();
+
+ $tree=new \Tree();
+ $tree->init($data,['child'=>'sub','parentid'=>'parentid']);
+ $rst=$tree->get_arraylist($data);
+
+ $this->assign('showlist',$rst);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_cate_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ public function add(){
+
+ $page=input('page');
+ $this->assign('page',$page);
+
+ if(request()->isPost()){
+ $jump=url('index');
+ $data=[];
+ $data['name']=input('name');
+ $data['content']=input('content');
+ $data['parent_id']=input('parent_id');
+ $data['child_id']=input('child_id');
+ $data['mid']=input('mid');
+ $data['top']=input('top');
+ $data['marrow']=input('marrow');
+ $data['link']=input('link');
+ $data['open']=input('open');
+ $data['status']=input('status');
+ $data['update_time']=time();
+ $data['create_time']=time();
+ $rst=Db::name($this->table)->insert($data);
+ if($rst!==false){
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ $cates=Db::name($this->tablecate)->where('status',1)->select();
+ $tree=new \Tree();
+ $tree->init($cates,['child'=>'sub','parentid'=>'parentid']);
+ $rst=$tree->get_arraylist($cates);
+ $this->assign("cates",$rst);
+ $mems=Db::name("member_list")->field('member_list_id,member_list_username,member_list_nickname')->where(['member_list_groupid'=>['in',[7,10]],'user_status'=>1,'member_list_open'=>1])->select();
+ $this->assign("mems",$mems);
+ return $this->fetch();
+ }
+ public function edit(){
+
+ $page=input('page');
+ $this->assign('page',$page);
+ $id=input('id');
+
+ if(request()->isPost()){
+ $jump=url('index');
+ $data=[];
+ $data['name']=input('name');
+ $data['content']=input('content');
+ $data['parent_id']=input('parent_id');
+ $data['child_id']=input('child_id');
+ $data['mid']=input('mid');
+ $data['top']=input('top');
+ $data['marrow']=input('marrow');
+ $data['open']=input('open');
+ $data['link']=input('link');
+ $data['status']=input('status');
+ $data['update_time']=time();
+ $rst=Db::name($this->table)->where('id',$id)->update($data);
+ if($rst!==false){
+ $this->success('编辑成功',$jump);
+ }else{
+ $this->error('编辑失败',$jump);
+ }
+ }
+ $cates=Db::name($this->tablecate)->where('status',1)->select();
+ $tree=new \Tree();
+ $tree->init($cates,['child'=>'sub','parentid'=>'parentid']);
+ $rst=$tree->get_arraylist($cates);
+ $this->assign("cates",$rst);
+
+ $list=Db::name($this->table)->where('id',$id)->find();
+ $this->assign("list",$list);
+
+ $mems=Db::name("member_list")->field('member_list_id,member_list_username,member_list_nickname')->where(['member_list_groupid'=>['in',[7,10]],'user_status'=>1,'member_list_open'=>1])->select();
+ $this->assign("mems",$mems);
+ return $this->fetch();
+ }
+ public function addcate(){
+ $page=input('page');
+ $this->assign('page',$page);
+
+ $pid=input('pid');
+ $this->assign('pid',$pid);
+ if(request()->isPost()){
+ $jump=url('category');
+ $data=[];
+ $data['name']=input('name');
+ $data['infor']=input('infor');
+ $data['parentid']=input('parentid');
+ $data['status']=input('status');
+ $data['update_time']=time();
+ $data['create_time']=time();
+ $data['open']=input('open');
+ $rst=Db::name($this->tablecate)->insert($data);
+ if($rst!==false){
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+
+ $cates=Db::name($this->tablecate)->where('parentid',0)->select();
+ $this->assign("cates",$cates);
+ return $this->fetch();
+ }
+ public function editcate(){
+ $page=input('page');
+ $this->assign('page',$page);
+
+ $id=input('id');
+ $this->assign('id',$id);
+ if(request()->isPost()){
+ $jump=url('category');
+ $data=[];
+ $data['name']=input('name');
+ $data['infor']=input('infor');
+ $data['parentid']=input('parentid');
+ $data['status']=input('status');
+ $data['open']=input('open');
+ $data['update_time']=time();
+ $rst=Db::name($this->tablecate)->where('id',$id)->update($data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+
+ $cates=Db::name($this->tablecate)->where('parentid',0)->select();
+ $this->assign("cates",$cates);
+ $cate=Db::name($this->tablecate)->where('id',$id)->find();
+ $this->assign("list",$cate);
+ return $this->fetch();
+ }
+ public function editlog(){
+ $page=input('page');
+ $this->assign('page',$page);
+
+ $id=input('id');
+ $this->assign('id',$id);
+ if(request()->isPost()){
+ $jump=url('log');
+ $data=[];
+ $data['content']=input('content');
+ $data['status']=input('status');
+ $data['top']=input('top');
+ $data['open']=input('open');
+ $data['update_time']=time();
+ $rst=Db::name($this->tablelog)->where('id',$id)->update($data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+
+ $mems=Db::name("member_list")->field('member_list_id,member_list_username,member_list_nickname')->where(['member_list_groupid'=>7,'user_status'=>1,'member_list_open'=>1])->select();
+ $this->assign("mems",$mems);
+ $cates=Db::name($this->tablecate)->where('status',1)->select();
+ $tree=new \Tree();
+ $tree->init($cates,['child'=>'sub','parentid'=>'parentid']);
+ $rst=$tree->get_arraylist($cates);
+ $this->assign("cates",$rst);
+
+ $list=Db::name($this->tablelog)->alias("a")->field("a.*,l.name")->join(config('database.prefix').'bbslist l','a.list_id =l.id','left')->where('a.id',$id)->find();
+ $this->assign("list",$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function del(){
+ $p=input('p');
+ $id=input('id');
+ $rst=Db::name($this->table)->where(['id'=>$id])->delete();
+ if($rst!==false){
+ Db::name($this->tablelog)->where(['list_id'=>$id])->delete();
+ $this->success('删除成功',url('index',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('index',array('p'=>$p)));
+ }
+ }
+ public function delcate(){
+ $p=input('p');
+
+ $rst=Db::name($this->tablecate)->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('category',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('category',array('p'=>$p)));
+ }
+ }
+ public function dellog(){
+ $p=input('p');
+
+ $rst=Db::name($this->tablelog)->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('log',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('log',array('p'=>$p)));
+ }
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function alldel(){
+ $p = input('p');
+
+
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('Ask/index',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name($this->table)->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('Ask/index',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('Ask/index',array('p'=>$p)));
+ }
+ }
+ public function marrow(){
+ $id=input('x');
+ $find=Db::name($this->table)->where(array('id'=>$id))->find();
+ $msg='否';
+ $state=0;
+ if($find){
+
+ $status=$find['marrow'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='是';
+ }
+ $statedata = array('marrow'=>$state);
+ $query=Db::name($this->table)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+ public function state(){
+ $id=input('x');
+ $find=Db::name($this->table)->where(array('id'=>$id))->find();
+ $msg='关闭';
+ $state=0;
+ if($find){
+
+ $status=$find['status'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='开启';
+ }
+ $statedata = array('status'=>$state);
+ $query=Db::name($this->table)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+ public function open(){
+ $id=input('x');
+ $find=Db::name($this->table)->where(array('id'=>$id))->find();
+ $msg='禁止';
+ $state=0;
+ if($find){
+ $status=$find['open'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='开启';
+ }
+ $statedata = array('open'=>$state);
+ $query=Db::name($this->table)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+ public function top(){
+ $id=input('x');
+ $find=Db::name($this->table)->where(array('id'=>$id))->find();
+ $msg='否';
+ $state=0;
+ if($find){
+ $status=$find['top'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='是';
+ }
+ $statedata=array('top'=>$state);
+ $query=Db::name($this->table)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+
+ public function statelog(){
+ $id=input('x');
+ $find=Db::name($this->tablelog)->where(array('id'=>$id))->find();
+ $msg='关闭';
+ $state=0;
+ if($find){
+
+ $status=$find['status'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='开启';
+ }
+ $statedata = array('status'=>$state);
+ $query=Db::name($this->tablelog)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+ public function toplog(){
+ $id=input('x');
+ $find=Db::name($this->tablelog)->where(array('id'=>$id))->find();
+ $msg='否';
+ $state=0;
+ if($find){
+ $status=$find['top'];
+ $state=$status==1?0:1;
+ if($status==0){
+ $msg='是';
+ }
+ $statedata=array('top'=>$state);
+ $query=Db::name($this->tablelog)->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg,'',$state);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bigdata.php b/app/admin/controller/Bigdata.php
new file mode 100644
index 0000000..b5ac70b
--- /dev/null
+++ b/app/admin/controller/Bigdata.php
@@ -0,0 +1,681 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Request;
+use app\admin\model\Bigdata as Bigdatadb;
+use think\Image;
+
+class Bigdata extends Base{
+ public function __construct(){
+ parent::__construct();
+ }
+ //获取表格图片
+ protected function getImg($sheet){
+ /*取图片*/
+ $imgData = array();
+ $subpath=config('upload_path').'/bigdata/'.date('Y-m-d').'/';
+ $imageFilePath =ROOT_PATH.$subpath;//图片保存目录
+ if (!file_exists( $imageFilePath )) {
+ mkdir("$imageFilePath", 0777, true);
+ }
+ //遍历表格图片
+ try{
+ foreach ($sheet->getDrawingCollection() as $img) {
+ list($startColumn,$startRow)= \PHPExcel_Cell::coordinateFromString($img->getCoordinates());//获取图片所在行和列
+ $imageFileName =md5(uniqid());
+
+ $quality=80;
+ switch($img->getMimeType()) {
+ case 'image/jpg':
+ $imageFileName.='.jpg';
+ $imgtype='jpg';
+ imagejpeg($img->getImageResource(),$imageFilePath.$imageFileName,40);
+ break;
+ case 'image/gif':
+ $imageFileName.='.gif';
+ $imgtype='gif';
+ imagegif($img->getImageResource(),$imageFilePath.$imageFileName);
+ break;
+ case 'image/png':
+ $imageFileName.='.png';
+ $imgtype='png';
+ imagepng($img->getImageResource(),$imageFilePath.$imageFileName,4);
+ break;
+ default:
+ $imageFileName.='.jpg';
+ $imgtype='jpg';
+ imagejpeg($img->getImageResource(),$imageFilePath.$imageFileName,40);
+ }
+
+ $startColumn = $this->ABC2decimal($startColumn);//由于图片所在位置的列号为字母,转化为数字
+ $imgData[$startRow][$startColumn][] =$subpath.$imageFileName;//把图片插入到数组中
+ }
+ } catch(\Exception $e) {
+
+ }
+ return $imgData;
+ }
+ protected function ABC2decimal($abc){
+ $ten = 0;
+ $len = strlen($abc);
+ for($i=1;$i<=$len;$i++){
+ $char = substr($abc,0-$i,1);//反向获取单个字符
+
+ $int = ord($char);
+ $ten += ($int-65)*pow(26,$i-1);
+ }
+ return $ten;
+ }
+ public function importxls(){
+ $kind=input('post.ckind','','intval');
+ $file = request()->file('xlsfile');
+ if(empty($kind)){
+ $this->error("请选择产品类型");
+ }
+ if(!count($file)){
+ $this->error("请上传xls");
+ }
+ $uploadpath=config('upload_path');
+ $path=ROOT_PATH . config('upload_path').'/'.'excel';
+
+ $info = $file->move($path);
+ $inputFileName='';
+ if($info){
+ $inputFileName=$path.'/'.$info->getSaveName();
+ }else{
+ $this->error($file->getError());
+ }
+
+ include ROOT_PATH.'extend'.DS.'PHPExcel'.DS.'PHPExcel.php';
+ $imgs=array();
+ // 读取excel文件
+ try {
+ $inputFileType = \PHPExcel_IOFactory::identify($inputFileName);
+ if($inputFileType=='Excel2007'){
+ $objReader = new \PHPExcel_Reader_Excel2007();
+ }else{
+ $objReader = \PHPExcel_IOFactory::createReader($inputFileType);
+ }
+ $objPHPExcel = $objReader->load($inputFileName);
+
+ // 确定要读取的sheet,什么是sheet,看excel的右下角,真的不懂去百度吧
+ $sheet = $objPHPExcel->getSheet(0);
+ $imgs=$this->getImg($sheet);
+ $highestRow = $sheet->getHighestRow();
+ $highestColumn = $sheet->getHighestColumn();
+ $cindex=3;
+ $cates=array(1=>'图片','音频','视频','电子文档','三维全景','其他');
+
+ // 获取一行的数据
+ for ($index =$cindex; $index <= $highestRow; $index++){
+ // Read a row of data into an array
+ $rowData = $sheet->rangeToArray('A'. $index .':'. $highestColumn . $index, NULL, TRUE, FALSE);
+ //这里得到的rowData都是一行的数据,得到数据后自行处理,我们这里只打出来看看效果
+ if(isset($rowData[0])){
+ switch ($kind){
+ case 2:
+ $row=$rowData[0];
+ if(count($row)){
+ if($row[1]){
+ $data=[];
+ $data['c_name']=$row[1];
+ $data['c_logo']='';
+ $data['c_kind']=2;
+ $data['c_infostime']=time();
+ $data['c_time']=time();
+ $query=Db::name('bigdata')->insert($data);
+ }
+ }
+ break;
+ case 1:
+ $row=$rowData[0];
+ if(count($row)){
+ if($row[1]){
+ $data=[];
+ $data['c_kind']=1;
+ $data['c_name']=$row[1];
+ $icode=$row[2];
+ $find=Db::name('bigdata')->where(['c_icode'=>$icode])->count();
+
+ if(!$find){
+ $data['c_icode']=$icode;
+ $data['c_logo']=isset($imgs[$index][3][0])?$imgs[$index][3][0]:'';
+ $data['c_price']=$row[6];
+ $data['c_seller']=$row[11];
+ $data['c_scode']=isset($row[12])?$row[12]:'';
+ $data['c_url']=$row[4];
+ $gptime=trim($row[5],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ }
+ $data['c_gptime']=$gptime;
+ $data['c_pay']=$row[7]=='授权'?1:2;
+ $data['c_type']=$row[13]=='文化资源数据'?1:2;
+ $ccate=$row[9];
+ $data['c_cate']=in_array($ccate,$cates)?array_search($ccate,$cates):'';
+
+ $cdate=date("ymd");
+ $last=Db::name('bigdata')->count();
+ $prev='';
+ //一级代码:标的类型
+ $prev=$data['c_type']==1?'A':'B';
+ //二级代码:展示类别
+ $prev.=$data['c_cate'];
+ //四级代码:日期
+ $prev.=$cdate;
+ //五级代码:X13X14为标的数据包序号,从01起依次编码,如标的为单个数据文件,默认序号为00
+ $code=$prev.'00';
+ $code.=sprintf('%03s',($last+1));
+ $data['c_code']=$code;
+ $data['c_time']=time();
+ $query=Db::name('bigdata')->insert($data);
+ }
+ }
+ }
+ break;
+ }
+ }
+ }
+ } catch(\Exception $e) {
+ $this->error("加载文件发生错误:".pathinfo($inputFileName,PATHINFO_BASENAME).":".$e->getMessage());
+ }
+
+ $this->success('提交成功',url('bigdata/showlist'));
+ }
+ /**
+ * 首页数据展示
+ * @return mixed|string
+ */
+ public function showlist(Request $request)
+ {
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+ $kind=$request->param('kind');
+ $ckind=$request->param('ckind');
+ $this->assign('ckind',$ckind);
+ $page=$request->param('page');
+ $this->assign('c_kind',$kind);
+
+ $db=Db::name('bigdata');
+ $where=array();
+ if($search_name){
+ $where['c_name|c_code|c_seller|c_icode'] = array('like', "%{$search_name}%", 'or');
+ }
+ $total=$db->where($where)->count();
+ $gp_list=$db->where($where)->order('c_order desc,c_id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('fwhzc_list',$gp_list);
+ $this->assign('total',$total);
+ $where['c_status']=0;
+ $ftotal=Db::name('bigdata')->where($where)->count();
+ $this->assign('ftotal',$ftotal);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_show_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+
+ public function showexport(){
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+ date_default_timezone_set('PRC');
+ $kind=input('kind');
+ if(in_array($kind,[17])){
+ $where=['n_status'=>1];
+ if($kind)$where['n_kind']=$kind;
+ $list=Db::name('news')->where($where)->order('n_id desc')->select();
+ }else{
+ $where=['c_status'=>1];
+ if($kind)$where['c_kind']=$kind;
+ $list=Db::name('bigdata')->where($where)->order('c_id desc')->select();
+ }
+ if(count($list)){
+ $title="";
+ switch ($kind){
+ case 1:
+ $title="招拍挂平台";
+ break;
+ }
+ $expTitle=$title."_".date("Y-m-d");
+ $expCellNames=[];
+ $expCellNames[1]=[['c_code','挂牌代码'],['c_name','企业名称'],['c_gptime','挂牌有效期']];
+
+ $expCellName=isset($expCellNames[$kind])?$expCellNames[$kind]:'';
+ if($expCellName){
+ $expTableData=[];
+ foreach ($list as $row){
+ array_push($expTableData,$row);
+ }
+ exportExcel($expTitle, $expCellName, $expTableData);
+ }
+ }
+
+ }
+
+ /**
+ * 非文化四版挂牌状态修改
+ */
+ public function show_state()
+ {
+ $id=input('x');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $status=Db::name('bigdata')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('bigdata')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('bigdata')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+ public function show_edit(Request $request)
+ {
+ $kind=input('kind');
+ $page=input('page');
+ $this->assign('page',$page);
+ $this->assign('c_kind',$kind);
+ $types=[];
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+
+ if (!$c_id) $this->error('参数错误', url('admin/Bigdata/showlist',array('kind'=>$kind)));
+ $gp_list = Db::name('bigdata')->where('c_id', $c_id)->find();
+ try {
+ $childs=json_decode($gp_list['c_childs'],true);
+ if(is_string($childs)||empty($childs)){
+ $childs=json_decode(urldecode($gp_list['c_childs']),true);
+ }
+ $gp_list['c_childs']=$childs;
+ } catch (\Exception $e) {
+ $gp_list['c_childs']=array();
+ }
+
+ //多图字符串转换成数组
+ $tpl='show_edit1';
+
+ $this->assign('list', $gp_list);
+ $this->assign('kind',$kind);
+ $this->assign('types',$types);
+ return $this->fetch($tpl);
+ }else{
+
+ $jump=url('admin/Bigdata/showlist',array('kind'=>$kind,'page'=>$page));
+ $img_one='';
+ $file = request()->file('pic_one');
+
+ $ret=$this->dealFile($file);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one']){
+ $img_one=$ret['img_one'];
+ $quality=40;
+ $imgname=pathinfo($img_one,PATHINFO_FILENAME);
+ $imgtype=pathinfo($img_one,PATHINFO_EXTENSION);
+ $imgpath=pathinfo($img_one,PATHINFO_DIRNAME);
+ $imgname=str_replace($imgtype,'', $imgname);
+ $img=Image::open('.'.$img_one);
+ $newimg='.'.$imgpath.DIRECTORY_SEPARATOR.$imgname.'_new'.$imgtype;
+ $img->save($newimg,$imgtype,$quality);
+ $img_one=$newimg;
+ }
+ }
+ $sl_data=array();
+ $post=request()->post();
+ $c_id = input('c_id', 0, 'intval');
+ $code=input('c_code','');
+ if($code){
+ $check=$this->_checkCode($code,$c_id);
+ if($check){
+ $this->error('托管代码不能重复');
+ }
+ }
+
+ $cstype=isset($_POST["c_stype"])?$_POST["c_stype"]:array();
+ $ctype=input('c_type','');
+ $ccate=input('c_cate','');
+ $cdate=date("ymd");
+ $last=$prev='';
+ if(empty($code)){
+ $last=Db::name('bigdata')->where(array('c_id'=>array('neq',$c_id)))->count();
+ //一级代码:用户代码
+ $prev=$ctype==1?'A':'B';
+ //二级代码:展示类别
+ $prev.=$ccate;
+ //四级代码:日期
+ $prev.=$cdate;
+ //五级代码:X13X14为标的数据包序号,从01起依次编码,如标的为单个数据文件,默认序号为00
+ $code.=$prev.'00';
+ $code.=sprintf('%03s',($last+1));
+ }else{
+ $prev=substr($code, 0,8);
+ $last=substr($code,-3);
+ $last=intval($last)-1;
+ }
+ $cchilds=array();
+ $childs=htmlspecialchars_decode(input('c_childs'));
+ $childs=json_decode($childs,true);
+
+ if(count($childs)){
+ $index=1;
+ foreach ($childs as $key=>$child){
+ $child=json_decode($child,true);
+ if(count($child)){
+ $it=array();
+ $clen=count($child);
+ foreach ($child as $k=>$c){
+ $ch=explode("=", $c);
+ if($ch[0]=='ccode'&&empty($ch[1])){
+ $ch[1]=$prev.sprintf('%02s',$index).''.sprintf('%03s',($last+1));
+ }
+ if($ch[0]=='ccode'){
+ $index++;
+ }
+ $it[$k]=$ch[0].'='.$ch[1];
+ }
+ $childs[$key]=json_encode($it,JSON_UNESCAPED_UNICODE);
+ }
+ }
+
+ $row=array_filter($childs);
+ $row=array_values($row);
+ array_walk($row,"walkparse");
+ $cchilds=$row;
+ }
+ $sl_data['c_childs']=json_encode($cchilds,JSON_UNESCAPED_UNICODE);
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $sl_data['c_infostime']=isset($post['c_infostime'])?strtotime($post['c_infostime']):time();
+ $sl_data['c_infoetime']=isset($post['c_infoetime'])?strtotime($post['c_infoetime']):time();
+ if(isset($post['c_gptime']))$sl_data['c_gptime']=strtotime($post['c_gptime']);
+ $sl_data['c_status']=input('c_status',0);
+ if(isset($post['c_pass']))$sl_data['c_pass']=input('c_pass',0);
+ if(isset($post['c_cate']))$sl_data['c_cate']=input('c_cate','');
+ if(isset($post['c_name']))$sl_data['c_name']=input('c_name');
+ if(isset($post['c_seller']))$sl_data['c_seller']=input('c_seller');
+ if(isset($post['c_scode']))$sl_data['c_scode']=input('c_scode');
+ if(isset($post['c_icode']))$sl_data['c_icode']=input('c_icode');
+ if(isset($post['c_sauth']))$sl_data['c_sauth']=input('c_sauth');
+ if(isset($post['c_code']))$sl_data['c_code']=input('c_code');
+ if(isset($post['c_ower']))$sl_data['c_ower']=input('c_ower');
+ if(isset($post['c_type']))$sl_data['c_type']=input('c_type');
+ if(isset($post['c_num']))$sl_data['c_num']=input('c_num');
+ if(isset($post['c_url']))$sl_data['c_url']=input('c_url');
+ if(isset($post['c_hot']))$sl_data['c_hot']=input('c_hot');
+ $sl_data['c_tag']=input('c_tag',0);
+ $sl_data['c_cate']=input('c_cate');
+ if($sl_data['c_cate']==6){
+ $sl_data['c_cother']=input('c_cother','');
+ }
+ if(isset($post['c_pay']))$sl_data['c_pay']=input('c_pay');
+ if(isset($post['c_ptype']))$sl_data['c_ptype']=input('c_ptype');
+ if(isset($post['c_pscope']))$sl_data['c_pscope']=input('c_pscope');
+ if(isset($post['c_price']))$sl_data['c_price']=input('c_price');
+ if(isset($post['c_proxy']))$sl_data['c_proxy']=input('c_proxy');
+ if(isset($post['c_year']))$sl_data['c_year']=input('c_year');
+ if(isset($post['c_source']))$sl_data['c_source']=input('c_source');
+ if(isset($post['c_charge']))$sl_data['c_charge']=input('c_charge');
+
+ $cright=isset($_POST["c_right"])?$_POST["c_right"]:[];
+ if(count($cright))$sl_data['c_right']=implode(',', $cright);
+
+ $cscene=isset($_POST["c_scene"])?$_POST["c_scene"]:[];
+ if(count($cscene))$sl_data['c_scene']=implode(',', $cscene);
+ if(isset($post['c_sother']))$sl_data['c_sother']=input('c_sother');
+
+ if(count($cstype))$sl_data['c_stype']=is_array($cstype)?implode(',', $cstype):'';
+
+ $sl_data['c_content']=htmlspecialchars_decode(input('c_content'));
+
+
+ $sl_data['c_code']=$code;
+ $sl_data['c_kind']=input('c_kind','');
+ $sl_data['c_infostime']=isset($post['c_infostime'])?strtotime($post['c_infostime']):time();
+ $sl_data['c_infoetime']=isset($post['c_infoetime'])?strtotime($post['c_infoetime']):time();
+ if(isset($sl_data['c_gptime']))$post['c_gptime']=strtotime($post['c_gptime']);
+ $sl_data['c_status']=input('c_status',0);
+ if(isset($sl_data['c_state']))$sl_data['c_state']=input('c_state',1);
+
+ $sl_data['c_uid']=session('admin_auth.aid');
+ $item=new Bigdatadb();
+ $sl_data['c_id']=$c_id;
+ $rst=$item->allowField(true)->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ protected function _checkCode($code='',$id='',$kind=''){
+ $find=Db::name('bigdata')->where(['c_code'=>$code]);
+ if($id){
+ $find->where('c_id','neq',$id);
+ }
+ if($kind){
+ $find->where(['c_kind'=>$kind]);
+ }
+ $res=$find->count();
+ return $res;
+ }
+ /**
+ * 非文化资产挂牌增加
+ */
+ public function show_add(Request $request)
+ {
+ $types=[];
+ if(!request()->isAjax()) {
+ $tpl='show_add1';
+ $this->assign('types',$types);
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ return $this->fetch($tpl);
+ }else{
+ $jump=url('admin/Bigdata/showlist');
+ $img_one='';
+ $img_one2='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+
+ $ret=$this->dealFile($file);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ }
+
+
+ $post=request()->post();
+ $item=new Bigdatadb();
+ $sl_data=array();
+ $curl=input('c_url');
+ $ckind=input('c_kind');
+ $cstype=isset($_POST["c_stype"])?$_POST["c_stype"]:array();
+ $ctype=input('c_type','');
+ $ccate=input('c_cate','');
+ $cdate=date("ymd");
+ $code=input('c_code','');
+
+ if($code){
+ $check=$this->_checkCode($code);
+ if($check){
+ $this->error('标的ISLI标志码不能重复');
+ }
+ }
+ $last=Db::name('bigdata')->count();
+ $prev='';
+ //一级代码:标的类型
+ $prev=$ctype==1?'A':'B';
+ //二级代码:展示类别
+ $prev.=$ccate;
+ //四级代码:日期
+ $prev.=$cdate;
+ //五级代码:X13X14为标的数据包序号,从01起依次编码,如标的为单个数据文件,默认序号为00
+ $code.=$prev.'00';
+ $code.=sprintf('%03s',($last+1));
+
+ $cchilds=array();
+ $childs=htmlspecialchars_decode(input('c_childs'));
+ $childs=json_decode($childs,true);
+ if(count($childs)){
+ $index=1;
+ foreach ($childs as $key=>$child){
+ $child=json_decode($child,true);
+ if(count($child)){
+ $it=array();
+ $clen=count($child);
+ foreach ($child as $k=>$c){
+ $ch=explode("=", $c);
+ if($ch[0]=='ccode'&&empty($ch[1])){
+ $ch[1]=$prev.sprintf('%02s',$index).''.sprintf('%03s',($last+1));
+ }
+ if($ch[0]=='ccode'){
+ $index++;
+ }
+ $it[$k]=$ch[0].'='.$ch[1];
+ }
+
+ $childs[$key]=json_encode($it,JSON_UNESCAPED_UNICODE);
+ }
+ }
+ $row=array_filter($childs);
+ $row=array_values($row);
+ array_walk($row,"walkparse");
+ $cchilds=$row;
+ }
+ $sl_data['c_code']=$code;
+ $sl_data['c_kind']=$ckind;
+
+ $sl_data['c_infostime']=isset($post['c_infostime'])?strtotime($post['c_infostime']):time();
+ $sl_data['c_infoetime']=isset($post['c_infoetime'])?strtotime($post['c_infoetime']):time();
+ if(isset($post['c_gptime']))$sl_data['c_gptime']=strtotime($post['c_gptime']);
+ $sl_data['c_status']=input('c_status',0);
+ if(isset($sl_data['c_cate']))$sl_data['c_cate']=input('c_cate','');
+ if(isset($sl_data['c_state']))$sl_data['c_state']=input('c_state',1);
+ $sl_data['c_content']=htmlspecialchars_decode(input('c_content'));
+
+ $sl_data['c_childs']=json_encode($cchilds,JSON_UNESCAPED_UNICODE);
+
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $sl_data['c_time']=time();
+ $sl_data['c_name']=input('c_name','');
+ $sl_data['c_tag']=input('c_tag',0);
+ $sl_data['c_seller']=input('c_seller','');
+ $sl_data['c_icode']=input('c_icode','');
+ $sl_data['c_scode']=input('c_scode','');
+ $sl_data['c_sauth']=input('c_sauth','');
+ $sl_data['c_ower']=input('c_ower','');
+ $sl_data['c_hot']=input('c_hot');
+ $sl_data['c_type']=$ctype;
+ $sl_data['c_num']=input('c_num','');
+ $sl_data['c_url']=$curl;
+ $sl_data['c_cate']=$ccate;
+
+ if($sl_data['c_cate']==6){
+ $sl_data['c_cother']=input('c_cother','');
+ }
+ $cscene=isset($_POST["c_scene"])?$_POST["c_scene"]:array();
+ if(count($cscene))$sl_data['c_scene']=is_array($cscene)?implode(',', $cscene):'';
+
+ if(count($cstype))$sl_data['c_stype']=is_array($cstype)?implode(',', $cstype):'';
+
+ $sl_data['c_sother']=input('c_sother','');
+ $sl_data['c_pay']=input('c_pay','');
+ $sl_data['c_ptype']=input('c_ptype');
+ $sl_data['c_pscope']=input('c_pscope');
+ $sl_data['c_price']=input('c_price','');
+ $sl_data['c_proxy']=input('c_proxy','');
+ $sl_data['c_year']=input('c_year','');
+ $sl_data['c_source']=input('c_source','');
+ $sl_data['c_charge']=input('c_charge','');
+ $cright=isset($_POST["c_right"])?$_POST["c_right"]:array();
+ if(count($cright))$sl_data['c_right']=is_array($cright)?implode(',', $cright):'';
+ $sl_data['c_uid']=session('admin_auth.aid');
+
+ $rst=$item->allowField(true)->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',$jump);
+ }else{
+ $this->error('增加失败',$jump);
+ }
+ }
+ }
+
+ /**
+ * 非文化资产挂牌排序
+ */
+ public function show_order()
+ {
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Bigdata/showlist',array('kind'=>$kind)));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('bigdata')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Bigdata/showlist',array('kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function show_del()
+ {
+ $p=input('p');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $rst=Db::name('bigdata')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Bigdata/showlist',array('p' => $p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('admin/Bigdata/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function show_alldel()
+ {
+ $p = input('p');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Bigdata/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('bigdata')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Bigdata/showlist',array('p'=>$p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('admin/Bigdata/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+ }
diff --git a/app/admin/controller/Bjjg.php b/app/admin/controller/Bjjg.php
new file mode 100644
index 0000000..d24d33a
--- /dev/null
+++ b/app/admin/controller/Bjjg.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bjjg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bjjg';
+ $this->controller_name='Bjjg';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function bjjg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bjjg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bjjg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bjjg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bjjg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bjjg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bjjg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bsgg.php b/app/admin/controller/Bsgg.php
new file mode 100644
index 0000000..38ab316
--- /dev/null
+++ b/app/admin/controller/Bsgg.php
@@ -0,0 +1,68 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bsgg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bsgg';
+ $this->controller_name='Bsgg';
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function bsgg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bsgg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bsgg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bsgg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bsgg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bsgg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bsgg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bsjs.php b/app/admin/controller/Bsjs.php
new file mode 100644
index 0000000..0067541
--- /dev/null
+++ b/app/admin/controller/Bsjs.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bsjs extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bsjs';
+ $this->controller_name='Bsjs';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function bsjs_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bsjs_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bsjs_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bsjs_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bsjs_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bsjs_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bsjs_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bsry.php b/app/admin/controller/Bsry.php
new file mode 100644
index 0000000..5a534e3
--- /dev/null
+++ b/app/admin/controller/Bsry.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bsry extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bsry';
+ $this->controller_name='Bsry';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 本所荣誉列表
+ */
+ public function bsry_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bsry_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bsry_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bsry_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bsry_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bsry_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bsry_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bsyw.php b/app/admin/controller/Bsyw.php
new file mode 100644
index 0000000..97b3193
--- /dev/null
+++ b/app/admin/controller/Bsyw.php
@@ -0,0 +1,68 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bsyw extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bsyw';
+ $this->controller_name='Bsyw';
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function bsyw_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bsyw_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bsyw_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bsyw_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bsyw_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bsyw_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bsyw_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bszc.php b/app/admin/controller/Bszc.php
new file mode 100644
index 0000000..699c57e
--- /dev/null
+++ b/app/admin/controller/Bszc.php
@@ -0,0 +1,68 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bszc extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bszc';
+ $this->controller_name='Bszc';
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function bszc_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bszc_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bszc_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bszc_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bszc_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bszc_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bszc_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Bszc2.php b/app/admin/controller/Bszc2.php
new file mode 100644
index 0000000..c419e0b
--- /dev/null
+++ b/app/admin/controller/Bszc2.php
@@ -0,0 +1,68 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Bszc2 extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bszc2';
+ $this->controller_name='Bszc2';
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function bszc2_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bszc2_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bszc2_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bszc2_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bszc2_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bszc2_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bszc2_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Culture.php b/app/admin/controller/Culture.php
new file mode 100644
index 0000000..3bbcd4c
--- /dev/null
+++ b/app/admin/controller/Culture.php
@@ -0,0 +1,145 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Culture extends Base
+{
+ /**
+ * 栏目列表
+ */
+ public function culture_list()
+ {
+ $cu_cid=input('cid',0,'intval');
+ $cultures=Db::name('culture')->where('cu_cid',$cu_cid)->order('cu_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $cultures->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('cu_cid',$cu_cid);
+ $this->assign('cultures',$cultures);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_culture_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function culture_add()
+ {
+ $cu_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $this->assign('cu_cid',$cu_cid);
+ return $this->fetch();
+ }else{
+ $sl_data=array(
+ 'cu_dw'=>htmlspecialchars_decode(input('cu_dw')),
+ 'cu_status'=>input('cu_status',0),
+ 'cu_uid'=>session('admin_auth.aid'),
+ 'cu_time'=>time(),
+ 'cu_dy'=>htmlspecialchars_decode(input('cu_dy')),
+ 'cu_fw'=>htmlspecialchars_decode(input('cu_fw')),
+ 'cu_cid'=>$cu_cid
+ );
+ $rst=Db::name('culture')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Culture/culture_list',['cid'=>$cu_cid]));
+ }else{
+ $this->error('添加失败',url('admin/Culture/culture_list',['cid'=>$cu_cid]));
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function culture_edit()
+ {
+ $cu_cid=input('cid',0,'intval');
+ if (!request()->isAjax()) {
+ $d_id = input('cu_id');
+ if (empty($d_id)) {
+ $this->error('参数错误', url('admin/Culture/culture_list',['cid'=>$cu_cid]));
+ }
+ $culture_list = Db::name('culture')->find($d_id);
+ $this->assign('culture_list', $culture_list);
+ $this->assign('cu_cid',$cu_cid);
+ return $this->fetch();
+ }else{
+ $sl_data=array(
+ 'cu_id'=>input('cu_id'),
+ 'cu_dw'=>htmlspecialchars_decode(input('cu_dw')),
+ 'cu_status'=>input('cu_status',0),
+ 'cu_dy'=>htmlspecialchars_decode(input('cu_dy')),
+ 'cu_fw'=>htmlspecialchars_decode(input('cu_fw'))
+ );
+ $rst=Db::name('culture')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Culture/culture_list',['cid'=>$cu_cid]));
+ }else{
+ $this->error('修改失败',url('admin/Culture/culture_list',['cid'=>$cu_cid]));
+ }
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function culture_del()
+ {
+ $cu_cid=input('cid',0,'intval');
+ $p=input('p');
+ $rst=Db::name('culture')->delete(input('cu_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Culture/culture_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Culture/culture_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function culture_alldel()
+ {
+ $p = input('p');
+ $ids = input('cu_id/a');
+ $cu_cid=input('cid',0,'intval');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/Culture/culture_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ if(is_array($ids)){
+ $where = 'cu_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'cu_id='.$ids;
+ }
+ $rst=Db::name('culture')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Culture/culture_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Culture/culture_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function culture_state()
+ {
+ $id=input('x');
+ $status=Db::name('culture')->where(array('cu_id'=>$id))->value('cu_status');
+ if($status==1){
+ $statedata = array('cu_status'=>0);
+ Db::name('culture')->where(array('cu_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('cu_status'=>1);
+ Db::name('culture')->where(array('cu_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Download.php b/app/admin/controller/Download.php
new file mode 100644
index 0000000..68352b5
--- /dev/null
+++ b/app/admin/controller/Download.php
@@ -0,0 +1,209 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Download extends Base
+{
+ /**
+ * 资料下载列表
+ */
+ public function download_list()
+ {
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ $downloads=Db::name('download')->where('d_catlogid',$d_catid)->where('d_cid',$d_cid)->order('d_order,d_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $downloads->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('d_catid',$d_catid);
+ $this->assign('d_cid',$d_cid);
+ $this->assign('downloads',$downloads);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_download_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function download_add()
+ {
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $this->assign('d_catid',$d_catid);
+ $this->assign('d_cid',$d_cid);
+ return $this->fetch();
+ }else{
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ foreach ($files as $file) {
+ $info = $file->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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Download/download_list',['cid'=>$d_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $sl_data=array(
+ 'd_name'=>input('d_name'),
+ 'd_status'=>input('d_status',0),
+ 'd_uid'=>session('admin_auth.aid'),
+ 'd_time'=>time(),
+ 'd_order'=>input('d_order',50,'intval'),
+ 'd_url'=>$fileall_url,
+ 'd_cid'=>$d_cid,
+ 'd_catlogid'=>$d_catid
+ );
+ $rst=Db::name('download')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }else{
+ $this->error('添加失败',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function download_edit()
+ {
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ if (!request()->isAjax()) {
+ $d_id = input('d_id');
+ if (empty($d_id)) {
+ $this->error('参数错误', url('admin/Download/download_list',['cid'=>$d_cid]));
+ }
+ $download_list = Db::name('download')->find($d_id);
+ $this->assign('download_list', $download_list);
+ $this->assign('d_catid',$d_catid);
+ $this->assign('d_cid',$d_cid);
+ return $this->fetch();
+ }else{
+ //文件
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ foreach ($files as $file) {
+ $info = $file->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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Download/download_list',['cid'=>$d_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $sl_data=array(
+ 'd_id'=>input('d_id'),
+ 'd_name'=>input('d_name'),
+ 'd_status'=>input('d_status',0),
+ 'd_order'=>input('d_order',50,'intval'),
+ );
+ if(!empty($fileall_url)){
+ $sl_data['d_url']=$fileall_url;
+ }
+ $rst=Db::name('download')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }else{
+ $this->error('修改失败',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }
+ }
+ }
+ /**
+ * 排序
+ */
+ public function download_order()
+ {
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }else{
+ foreach (input('post.') as $d_id => $d_order){
+ Db::name('download')->update(['d_id'=>$d_id,'d_order'=>$d_order]);
+ }
+ $this->success('排序更新成功',url('admin/Download/download_list',['cid'=>$d_cid,'catid'=>$d_catid]));
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function download_del()
+ {
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ $p=input('p');
+ $rst=Db::name('download')->delete(input('d_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Download/download_list',array('p'=>$p,'cid'=>$d_cid,'catid'=>$d_catid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Download/download_list',array('p'=>$p,'cid'=>$d_cid,'catid'=>$d_catid)));
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function download_alldel()
+ {
+ $p = input('p');
+ $ids = input('d_id/a');
+ $d_catid=input('catid',0,'intval');
+ $d_cid=input('cid',0,'intval');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/Download/download_list',array('p'=>$p,'cid'=>$d_cid,'catid'=>$d_catid)));
+ }
+ if(is_array($ids)){
+ $where = 'd_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'd_id='.$ids;
+ }
+ $rst=Db::name('download')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Download/download_list',array('p'=>$p,'cid'=>$d_cid,'catid'=>$d_catid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Download/download_list',array('p'=>$p,'cid'=>$d_cid,'catid'=>$d_catid)));
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function download_state()
+ {
+ $id=input('x');
+ $status=Db::name('download')->where(array('d_id'=>$id))->value('d_status');
+ if($status==1){
+ $statedata = array('d_status'=>0);
+ Db::name('download')->where(array('d_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('d_status'=>1);
+ Db::name('download')->where(array('d_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Dsffwjg.php b/app/admin/controller/Dsffwjg.php
new file mode 100644
index 0000000..1e899b0
--- /dev/null
+++ b/app/admin/controller/Dsffwjg.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Dsffwjg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='dsffwjg';
+ $this->controller_name='Dsffwjg';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function dsffwjg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function dsffwjg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function dsffwjg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function dsffwjg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function dsffwjg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function dsffwjg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function dsffwjg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Error.php b/app/admin/controller/Error.php
new file mode 100644
index 0000000..71e7669
--- /dev/null
+++ b/app/admin/controller/Error.php
@@ -0,0 +1,17 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Error extends Base
+{
+ public function index()
+ {
+ $this->error('此操作无效');
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Feedback.php b/app/admin/controller/Feedback.php
new file mode 100644
index 0000000..f5cdc34
--- /dev/null
+++ b/app/admin/controller/Feedback.php
@@ -0,0 +1,253 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Validate;
+use think\Request;
+use think\captcha\Captcha;
+
+class Feedback extends Base
+{
+ public function fdlist() {
+
+ $where=[];
+ $db=Db::name('feedback');
+ $account=input('account');
+ $org=input('org');
+ $tel=input('tel');
+ $platform=input('platform');
+ $startdate=input('startdate');
+ $enddate=input('enddate');
+ $target=input('target');
+ $this->assign('account',$account);
+ $this->assign('org',$org);
+ $this->assign('tel',$tel);
+ $this->assign('platform',$platform);
+ $this->assign('startdate',$startdate);
+ $this->assign('enddate',$enddate);
+ $this->assign('target',$target);
+ if($account){
+ $db->where('account','like',['%'.$account.'%',$account.'%']);
+ }
+ if($tel){
+ $db->where('tel','like',['%'.$tel.'%',$tel.'%']);
+ }
+ if($org){
+ $db->where('org','like',['%'.$org.'%',$org.'%']);
+ }
+ if($target){
+ $db->where('target','like',['%'.$target.'%',$target.'%']);
+ }
+ if($platform){
+ $db->where('platform','like',['%'.$platform.'%',$platform.'%']);
+ }
+ if($startdate&&empty($enddate)){
+ $db->where('create_time','>=',strtotime($startdate));
+ }else if($enddate&&empty($startdate)){
+ $db->where('create_time','<=',strtotime($enddate." 11:59:59"));
+ }else if($enddate&&$startdate){
+ $db->where('create_time',['>=',strtotime($startdate)],['<=',strtotime($enddate." 11:59:59")],'and');
+ }
+
+ $docs =$db->order("id desc")->select();
+ //echo $db->getLastSql();exit;
+ foreach ($docs as &$doc){
+
+ $doc['color']='text-primary';
+ if($doc['state']==1){
+ $cur=time();
+ $create=$doc['create_time'];
+ $time=$cur-$create;
+ if($time>3600*3&&$time<3600*6){
+ $doc['color']='text-warning';
+ }else if($time>=3600*6){
+ $doc['color']='text-danger';
+ }
+ }
+
+ if($doc['state']==1)$doc['state']='未处理客诉';
+ if($doc['state']==2)$doc['state']='处理中客诉';
+ if($doc['state']==3)$doc['state']=' 已处理客诉';
+
+ if($doc['score']==1)$doc['score']='非常满意';
+ if($doc['score']==3)$doc['score']='基本满意';
+ if($doc['score']==2)$doc['score']='满意';
+ }
+ $this->assign('fdlist', $docs);
+ return $this->view->fetch();
+ }
+ public function edit(){
+ $id = input('id','');
+ $remark = input('remark','');
+ $state=input('state','','intval');
+ $doc = Db::name('feedback')->where('id', $id)->find();
+ $remarks=$doc['remarks'];
+ try {
+ $remarks=json_decode($remarks,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($remarks))$remarks=[];
+ $remarks[$state]=$remark;
+ /* if($state==3){
+ $tels=array('complaint');
+ if(count($tels)){
+ foreach ($tels as $tel){
+ $token=md5('szwjs_'.$id);
+ $href=url('home/feedback/review',['token'=>$token,'id'=>$id],false,true);
+ send_sms($tel,'深圳文化产权交易所有限公司:这次处理的满意度:非常满意、基本满意、不满意!谢谢!回复网址');
+ }
+ }
+ } */
+ $query = Db::name('feedback')->where('id', $id)->update(['state'=>$state,'remarks'=>json_encode($remarks)]);
+ if($query){
+ $this->success('提交成功',url('fdlist'));
+ }else{
+ $this->error('提交失败');
+ }
+ }
+ public function detail() {
+ $id = input('get.id','');
+ if(empty($id)) {
+ return $this->view->fetch();
+ }
+ $doc = Db::name('feedback')->where('id', $id)->find();
+
+ if($doc['attach']){
+ $doc['attach']=htmlspecialchars_decode($doc['attach'],true);
+ try {
+ $doc['attach']=json_decode($doc['attach'],true);
+ } catch (Exception $e) {
+ $doc['attach']=[];
+ }
+ }
+
+ $remarks=$doc['remarks'];
+ try {
+ $remarks=json_decode($remarks,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($remarks))$remarks=[];
+ $doc['remarks']=$remarks;
+
+ $this->assign('detail',$doc);
+ return $this->view->fetch();
+ }
+ public function culist() {
+ $cid=input('cid','1','intval');
+ $where=[];
+ $db=Db::name('cultureapply');
+
+ $docs =$db->where(['cid'=>$cid])->order("id desc")->select();
+ //echo $db->getLastSql();exit;
+ foreach ($docs as &$doc){
+ $doc['create_time']=date("Y-m-d",$doc['create_time']);
+ if($doc['cid']==1){
+ if($doc['company']==1)$doc['company']='中央政府部门所属机构';
+ if($doc['company']==2)$doc['company']='国有独资企业';
+ if($doc['company']==3)$doc['company']='国有控股企业';
+ if($doc['company']==4)$doc['company']='股份有限公司';
+ if($doc['company']==5)$doc['company']='有限责任公司';
+ if($doc['company']==6)$doc['company']='其他';
+ }else{
+ if($doc['company']==1)$doc['company']='股份有限公司';
+ if($doc['company']==2)$doc['company']='有限责任公司';
+ if($doc['company']==3)$doc['company']='其他企业';
+ }
+ }
+ $this->assign('fdlist', $docs);
+ return $this->view->fetch();
+ }
+
+ public function cudetail() {
+ $id = input('get.id','');
+ if(empty($id)) {
+ return $this->view->fetch();
+ }
+ $doc = Db::name('cultureapply')->where('id', $id)->find();
+
+ $doc['create_time']=date("Y-m-d",$doc['create_time']);
+ if($doc['cid']==1){
+ if($doc['company']==1)$doc['company']='中央政府部门所属机构';
+ if($doc['company']==2)$doc['company']='国有独资企业';
+ if($doc['company']==3)$doc['company']='国有控股企业';
+ if($doc['company']==4)$doc['company']='股份有限公司';
+ if($doc['company']==5)$doc['company']='有限责任公司';
+ if($doc['company']==6)$doc['company']='其他';
+ }else{
+ if($doc['company']==1)$doc['company']='股份有限公司';
+ if($doc['company']==2)$doc['company']='有限责任公司';
+ if($doc['company']==3)$doc['company']='其他企业';
+ }
+
+ $legal=$doc['legal'];
+ try {
+ $legal=json_decode($legal,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($legal))$legal=[];
+ $doc['legal']=$legal;
+ $this->assign('legal',$legal);
+
+ $org=$doc['org'];
+ try {
+ $org=json_decode($org,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($org))$org=[];
+ $doc['org']=$org;
+ $this->assign('org',$org);
+ $cont=$doc['cont'];
+ try {
+ $cont=json_decode($cont,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($cont))$cont=[];
+ $doc['cont']=$cont;
+ $this->assign('cont',$cont);
+
+ $parter=$doc['parter'];
+ try {
+ $parter=json_decode($parter,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($parter))$parter=[];
+ $this->assign('parter',$parter);
+
+ $base=$doc['base'];
+ try {
+ $base=json_decode($base,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($base))$base=[];
+ $this->assign('base',$base);
+
+ $pro=$doc['pro'];
+ try {
+ $pro=json_decode($pro,true);
+ } catch (Exception $e) {
+
+ }
+ if(!is_array($pro))$pro=[];
+ $this->assign('pro',$pro);
+
+ $doc['financefile']=$doc['financefile']?explode(';', $doc['financefile']):[];
+ $doc['relatedfile']=$doc['relatedfile']?explode(';', $doc['relatedfile']):[];
+
+ $this->assign('detail',$doc);
+ return $this->view->fetch();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ggnew.php b/app/admin/controller/Ggnew.php
new file mode 100644
index 0000000..c73c859
--- /dev/null
+++ b/app/admin/controller/Ggnew.php
@@ -0,0 +1,72 @@
+table_name='zgwhjf_ggnew';
+ $this->controller_name='Ggnew';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zgwhjf_ggnew_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zgwhjf_ggnew_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zgwhjf_ggnew_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zgwhjf_ggnew_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zgwhjf_ggnew_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zgwhjf_ggnew_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zgwhjf_ggnew_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Gpgl.php b/app/admin/controller/Gpgl.php
new file mode 100644
index 0000000..396c5b8
--- /dev/null
+++ b/app/admin/controller/Gpgl.php
@@ -0,0 +1,3073 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Request;
+use app\admin\model\Finance;
+use think\Image;
+
+class Gpgl extends Base{
+ protected $artbook=[];
+ public function __construct(){
+ parent::__construct();
+ $configs=config('artbook');
+ $keys=array_keys($configs);
+ $titles=array_column($configs,'title');
+
+ $this->artbook=array_combine($keys,$titles);
+ }
+ public function importxls(){
+ $kind=input('post.kind',4,'intval');
+ $file = request()->file('xlsfile');
+ if(empty($kind)){
+ $this->error("请选择分类");
+ }
+ if(!count($file)){
+ $this->error("请上传xls");
+ }
+ $uploadpath=config('upload_path');
+ $path=ROOT_PATH . config('upload_path').'/'.'excel';
+ $info = $file->move($path);
+ $inputFileName='';
+ if($info){
+ $inputFileName=$path.'/'.$info->getSaveName();
+ }else{
+ $this->error($file->getError());
+ }
+
+ include ROOT_PATH.'extend'.DS.'PHPExcel'.DS.'PHPExcel.php';
+ // 读取excel文件
+ try {
+ $inputFileType = \PHPExcel_IOFactory::identify($inputFileName);
+ $objReader = \PHPExcel_IOFactory::createReader($inputFileType);
+ $objPHPExcel = $objReader->load($inputFileName);
+ } catch(\Exception $e) {
+ die("加载文件发生错误:".pathinfo($inputFileName,PATHINFO_BASENAME).":".$e->getMessage());
+ }
+
+ // 确定要读取的sheet,什么是sheet,看excel的右下角,真的不懂去百度吧
+ $sheet = $objPHPExcel->getSheet(0);
+ $highestRow = $sheet->getHighestRow();
+ $highestColumn = $sheet->getHighestColumn();
+ $cindex=3;
+ if($kind==9)$cindex=4;
+ // 获取一行的数据
+ for ($index =$cindex; $index <= $highestRow; $index++){
+ // Read a row of data into an array
+ $rowData = $sheet->rangeToArray('A'. $index .':'. $highestColumn . $index, NULL, TRUE, FALSE);
+ //这里得到的rowData都是一行的数据,得到数据后自行处理,我们这里只打出来看看效果
+ if(isset($rowData[0])){
+ switch ($kind){
+ case 9:
+ $cates=[1=>"书法","国画","油画","水彩","版画","篆刻","陶瓷","紫砂","珠宝","玉器","翡翠","织秀","雕刻","雕塑","金属工艺","漆艺","家具","文房","钱币","杂项","非遗"];
+ $keys=array_keys($cates);
+ $vals=array_values($cates);
+ $cates=array_combine($vals,$keys);
+
+ $row=$rowData[0];
+ if(count($row)){
+ if($row[1]&&$row[3]){
+ $data=[];
+ $data['c_name']=trim($row[1]);
+ $data['c_code']=$row[3];
+ $cate=trim($row[2]);
+ $data['c_type']=isset($cates[$cate])?$cates[$cate]:'';
+ $size=trim($row[6]);
+ $size=nl2br($size);
+ $size=strip_tags($size);
+
+ $data['c_size']=$size;
+ $data['c_year']=trim($row[4]);
+ $data['c_material']=trim($row[7]);
+ $data['c_content']=trim($row[8]);
+
+ $data['c_gptime']=time();
+ $data['c_time']=time();
+ $data['c_kind']=$kind;
+ $data['c_infostime']=time();
+ $data['c_infoetime']=time();
+
+ $gptime=trim($row[9],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $evaluation=[[],[],[],[],[],[],[]];
+ $item=['appraiser'=>'','handman'=>'','witness'=>'','location'=>'','date'=>'','comment'=>''];
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[10],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[0]=[$item];
+
+ $gptime=trim($row[12],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['expert'=>'','date'=>'','comment'=>''];
+ $item['expert']=urldecode(trim($row[11],'/'));
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[13],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[1]=[$item];
+
+ $gptime=trim($row[15],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['appraiser'=>'','date'=>'','comment'=>''];
+ $item['appraiser']=urldecode(trim($row[14],'/'));
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[16],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[2]=[$item];
+
+ $gptime=trim($row[24],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['kind'=>'1','title'=>'','sprice'=>'','gprice'=>'','bprice'=>'','handman'=>'','witness'=>'','date'=>''];
+ $ikind='1';
+ if(trim($row[17])=='艺品拍'){
+ $ikind='2';
+ }
+ $item['kind']=$ikind;
+ $item['title']=trim($row[18],'/');
+ $item['sprice']=trim($row[19],'/');
+ $item['gprice']=trim($row[20],'/');
+ $item['bprice']=trim($row[21],'/');
+ $item['handman']=urldecode(trim($row[22],'/'));
+ $item['witness']=urldecode(trim($row[23],'/'));
+ $item['date']=$gptime;
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+
+ $evaluation[3]=[$item];
+
+ $gptime=trim($row[28],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['handman'=>'','witness'=>'','source'=>'','date'=>'','comment'=>''];
+ $item['handman']=urldecode(trim($row[25],'/'));
+ $item['witness']=urldecode(trim($row[26],'/'));
+ $item['source']=urldecode(trim($row[27],'/'));
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[29],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[4]=[$item];
+
+ $gptime=trim($row[34],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['code'=>'','title'=>'','size'=>'','witness'=>'','date'=>'','comment'=>''];
+ $item['code']=trim($row[30],'/');
+ $item['title']=trim($row[31],'/');
+ $item['size']=trim($row[32],'/');
+ $item['witness']=trim($row[33],'/');
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[35],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[5]=[$item];
+
+
+ $gptime=trim($row[36],'/');
+ if($gptime){
+ $gptime=\PHPExcel_Shared_Date::ExcelToPHP($gptime);
+ $gptime=date("Y-m-d",$gptime);
+ }
+ $item=['date'=>'','comment'=>''];
+ $item['date']=$gptime;
+ $item['comment']=urldecode(trim($row[37],'/'));
+ $item=json_encode($item,JSON_UNESCAPED_UNICODE);
+ $item=str_replace('":"','=',$item);
+ $item=str_replace(array('{','}'),array('[',']'),$item);
+ $evaluation[6]=[$item];
+ $evaluation=json_encode($evaluation,JSON_UNESCAPED_UNICODE);
+
+ $data['c_evaluation']=$evaluation;
+
+ $query=Db::name('finance')->insert($data);
+ }
+ }
+ break;
+ case 4:
+
+ $cates=['A类'=>1,'B类'=>2,'C类'=>3];
+ $types=config('finance.parents');
+ $keys=array_keys($types);
+ $vals=array_values($types);
+ $types=array_combine($vals, $keys);
+
+ $childs=config('finance.childs');
+ foreach ($childs as $key=>$child){
+ $keys=array_keys($child);
+ $vals=array_values($child);
+ $child=array_combine($vals, $keys);
+ $childs[$key]=$child;
+ }
+
+ $tuoguan=config('tuoguan.parents');
+ $keys=array_keys($tuoguan);
+ $vals=array_values($tuoguan);
+ $tuoguan=array_combine($vals, $keys);
+
+ $tchilds=config('tuoguan.childs');
+ foreach ($tchilds as $key=>$child){
+ $keys=array_keys($tchilds);
+ $vals=array_values($tchilds);
+ $child=array_combine($vals, $keys);
+ $tchilds[$key]=$child;
+ }
+
+ $row=$rowData[0];
+ if(count($row)){
+ if($row[0]&&$row[1]){
+ $data=[];
+ $data['c_name']=$row[1];
+ $data['c_code']=$row[2];
+ $cate=trim($row[3]);
+ $data['c_cate']=isset($cates[$cate])?$cates[$cate]:'';
+ $typeid=trim($row[4]);
+ $data['c_type']=isset($types[$typeid])?$types[$typeid]:'';
+ $c_type=$data['c_type'];
+ $cid=trim($row[5]);
+ $data['c_cid']=isset($childs[$c_type][$cid])?$childs[$c_type][$cid]:'';
+ $data['c_price']=$row[6];
+ $data['c_gprice']=$row[7];
+ $data['c_num']=$row[8];
+ $data['c_size']=$row[9];
+ $data['c_material']=$row[10];
+ $data['c_class']=$row[11];
+ $data['c_year']=$row[12];
+ $gptime=strtotime(str_replace('.','-', $row[15]));
+
+ $data['c_gptime']=$gptime;
+ $data['c_time']=time();
+ $data['c_content']=$row[16];
+ $data['c_evaluation']=$row[17];
+ $data['c_transaction']=$row[18];
+ $data['c_logo']='';
+ $data['c_kind']=$kind;
+ $data['c_infostime']=time();
+ $data['c_infoetime']=time();
+
+ $typeid=trim($row[19]);
+ $data['c_parent']=isset($tuoguan[$typeid])?$tuoguan[$typeid]:'';
+ $c_type=$data['c_parent'];
+ $cid=trim($row[20]);
+ $data['c_child']=isset($tchilds[$c_type][$cid])?$tchilds[$c_type][$cid]:'';
+
+ $query=Db::name('finance')->insert($data);
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ $this->success('提交成功',url('gpgl/showlist',['kind'=>$kind]));
+ }
+ /**
+ * 文化四版挂牌列表
+ */
+ public function gp_list()
+ {
+ $c_ssbk=input('c_ssbk',0,'intval');
+ $op='=';
+ $type_id=$c_ssbk;
+ if($c_ssbk & $c_ssbk<=11){
+ $op='<';
+ $type_id=12;
+ }
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type','=',15)->where('type_id',$op,$type_id)->select();
+ $this->assign('ssbk', $ssbk);
+ //业务类型
+ $dqlxa=Db::name('type')->where('type_type',52)->select();
+ $this->assign('dqlxa', $dqlxa);
+ //企业发展阶段
+ $dqlxb=Db::name('type')->where('type_type',53)->select();
+ $this->assign('dqlxb', $dqlxb);
+ $where['type_type']=15;
+ if($c_ssbk) $where['c_ssbk']=$c_ssbk;
+ $this->assign('c_ssbk',$c_ssbk);
+ $this->assign('ssbk',$ssbk);
+ $gp_list=Db::name('cult4info')->alias('a')->join(config('database.prefix').'type b','a.c_ssbk=b.type_id')->where($where)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $gp_list->render();
+ $this->assign('page',$show);
+ $this->assign('gp_list',$gp_list);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_gp_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 文化四版挂牌状态修改
+ */
+ public function gp_state()
+ {
+ $id=input('x');
+ $status=Db::name('cult4info')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('cult4info')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('cult4info')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+ /**
+ * 文化四版挂牌修改
+ */
+ public function gp_edit()
+ {
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+ if (!$c_id) $this->error('参数错误', url('admin/Gpgl/gp_list'));
+ $gp_list = Db::name('cult4info')->where('c_id', $c_id)->find();
+ $this->assign('gp_list', $gp_list);
+ //多图字符串转换成数组
+ $pic_list = array_filter(explode(",", $gp_list['c_pics']));
+ $this->assign('pic_list', $pic_list);
+ //行业类别
+ $hylb=Db::name('type')->where('type_type',1)->select();
+ $this->assign('hylb', $hylb);
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type',15)->select();
+ $this->assign('ssbk', $ssbk);
+ //地区类型
+ $dqlx=Db::name('type')->where('type_type',2)->select();
+ $this->assign('dqlx', $dqlx);
+ //业务类型
+ $dqlxa=Db::name('type')->where('type_type',52)->select();
+ $this->assign('dqlxa', $dqlxa);
+ //企业发展阶段
+ $dqlxb=Db::name('type')->where('type_type',53)->select();
+ $this->assign('dqlxb', $dqlxb);
+ //资本额度
+ $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select();
+ $this->assign('zbed', $zbed);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gp_list'));
+ }
+ }
+ //多图
+ if ($files) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gp_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $ssbk = input('c_ssbk',1,'intval');
+ $business_type= input('c_business_type',1,'intval');
+ $qyfzjd = input('c_qyfzjd',1,'intval');
+ if($ssbk!=1){
+ $business_type=0;
+ $qyfzjd=0;
+ }
+ $sl_data=array(
+ 'c_id'=>input('c_id'),
+ 'c_project_code'=>input('c_project_code'),
+ 'c_ggxs'=>input('c_ggxs'),
+ 'c_transaction_type'=>input('c_transaction_type'),
+ 'c_bdname'=>input('c_bdname'),
+ 'c_valuation'=>input('c_valuation'),
+ 'c_type'=>input('c_type'),
+ 'c_name'=>input('c_name'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_gpprice'=>input('c_gpprice'),
+ 'c_survival_period'=>input('c_survival_period'),
+ 'c_city_consumption'=>input('c_city_consumption'),
+ 'c_industry_prospects'=>input('c_industry_prospects'),
+ 'c_enterprise_valuation'=>input('c_enterprise_valuation'),
+ 'c_market_prospects'=>input('c_market_prospects'),
+ 'c_stock_ratio'=>input('c_stock_ratio'),
+ 'c_investment_degreeofheat'=>input('c_investment_degreeofheat'),
+ 'c_market_occupy_ratio'=>input('c_market_occupy_ratio'),
+ 'c_code'=>input('c_code'),
+ 'c_homepage'=>input('c_homepage',''),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(),
+ 'c_status'=>input('c_status',0),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_ssbk'=>input('c_ssbk',1,'intval'),
+ 'c_dqlx'=>input('c_dqlx',1,'intval'),
+ 'c_hylb'=>input('c_hylb',1,'intval'),
+ 'c_qyfzjd'=>$qyfzjd,
+ 'c_business_type'=>$business_type,
+ 'c_zbed'=>input('c_zbed',1,'intval')
+
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $sl_data['c_pics']=input('pic_oldlist').$picall_url;
+ $rst=Db::name('cult4info')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/gp_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/gp_list'));
+ }
+ }
+ }
+ /**
+ * 文化四版挂牌增加
+ */
+ public function gp_add()
+ {
+ if(!request()->isAjax()) {
+ //行业类别
+ $hylb=Db::name('type')->where('type_type',1)->select();
+ $this->assign('hylb', $hylb);
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type',15)->select();
+ $this->assign('ssbk', $ssbk);
+ //地区类型
+ $dqlx=Db::name('type')->where('type_type',2)->select();
+ $this->assign('dqlx', $dqlx);
+ //业务类型
+ $dqlxa=Db::name('type')->where('type_type',52)->select();
+ $this->assign('dqlxa', $dqlxa);
+ //企业发展阶段
+ $dqlxb=Db::name('type')->where('type_type',53)->select();
+ $this->assign('dqlxb', $dqlxb);
+
+ //资本额度
+ $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select();
+ $this->assign('zbed', $zbed);
+ $base_id=input('base_id');
+ $baseinfo=Db::name('cult4baseinfo')->find($base_id);
+ $this->assign('baseinfo', $baseinfo);
+ $c_gptime =time();
+ $this->assign('c_gptime', $c_gptime);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gp_list'));
+ }
+ }
+ //多图
+ if ($files) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gp_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $ssbk = input('c_ssbk',1,'intval');
+ $business_type= input('c_business_type',1,'intval');
+ $qyfzjd = input('c_qyfzjd',1,'intval');
+ if($ssbk!=1){
+ $business_type=0;
+ $qyfzjd=0;
+ }
+ $sl_data=array(
+ 'c_name'=>input('c_name'),
+ 'c_project_code'=>input('c_project_code'),
+ 'c_ggxs'=>input('c_ggxs'),
+ 'c_transaction_type'=>input('c_transaction_type'),
+ 'c_bdname'=>input('c_bdname'),
+ 'c_valuation'=>input('c_valuation'),
+ 'c_type'=>input('c_type'),
+ 'c_gpprice'=>input('c_gpprice'),
+ 'c_survival_period'=>input('c_survival_period'),
+ 'c_city_consumption'=>input('c_city_consumption'),
+ 'c_industry_prospects'=>input('c_industry_prospects'),
+ 'c_enterprise_valuation'=>input('c_enterprise_valuation'),
+ 'c_market_prospects'=>input('c_market_prospects'),
+ 'c_stock_ratio'=>input('c_stock_ratio'),
+ 'c_investment_degreeofheat'=>input('c_investment_degreeofheat'),
+ 'c_market_occupy_ratio'=>input('c_market_occupy_ratio'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_homepage'=>input('c_homepage',''),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(),
+ 'c_status'=>input('c_status',0),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_logo'=>$img_one,
+ 'c_pics'=>$picall_url,
+ 'c_time'=>time(),
+ 'c_uid'=>session('admin_auth.aid'),
+ 'c_ssbk'=>input('c_ssbk',1,'intval'),
+ 'c_dqlx'=>input('c_dqlx',1,'intval'),
+ 'c_hylb'=>input('c_hylb',1,'intval'),
+ 'c_qyfzjd'=>$qyfzjd,
+ 'c_business_type'=>$business_type,
+ 'c_zbed'=>input('c_zbed',1,'intval')
+ );
+ $rst=Db::name('cult4info')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/gp_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/gp_list'));
+ }
+ }
+ }
+ /**
+ * 文化四版挂牌排序
+ */
+ public function gp_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/gp_list'));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('cult4info')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/gp_list'));
+ }
+ }
+ /**
+ * 文化四版挂牌删除(单个)
+ */
+ public function gp_del()
+ {
+ $p=input('p');
+ $rst=Db::name('cult4info')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/gp_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/gp_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 文化四版删除挂牌(全选)
+ */
+ public function gp_alldel()
+ {
+ $p = input('p');
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/gp_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('cult4info')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/gp_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/gp_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 文化资产列表
+ */
+ public function whzc_list()
+ {
+ $gp_list=Db::name('otinfo')->where('c_type',1)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $gp_list->render();
+ $this->assign('page',$show);
+ $this->assign('whzc_list',$gp_list);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_whzc_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 文化四版挂牌状态修改
+ */
+ public function whzc_state()
+ {
+ $id=input('x');
+ $status=Db::name('otinfo')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+ public function whzc_edit()
+ {
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+ if (!$c_id) $this->error('参数错误', url('admin/Gpgl/whzc_list'));
+ $gp_list = Db::name('otinfo')->where('c_id', $c_id)->find();
+ $this->assign('whzc_list', $gp_list);
+ $gyxm=Db::name('type')->where('type_type',4)->select();
+ $this->assign('gyxm', $gyxm);
+ $dfqy=Db::name('type')->where('type_type',5)->select();
+ $this->assign('dfqy', $dfqy);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/whzc_list'));
+ }
+ }
+ $sl_data=array(
+ 'c_id'=>input('c_id'),
+ 'c_name'=>input('c_name'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_location'=>input('c_location',''),
+ 'c_gyxm'=>input('c_gyxm',1,'intval'),
+ 'c_dfqy'=>input('c_dfqy',1,'intval'),
+ 'c_status'=>input('c_status',0),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(),
+ 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(),
+ 'c_firstnews'=>input('c_firstnews',''),
+ 'c_desc'=>input('c_desc',''),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $rst=Db::name('otinfo')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/whzc_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/whzc_list'));
+ }
+ }
+ }
+ /**
+ * 文化资产挂牌增加
+ */
+ public function whzc_add()
+ {
+ if(!request()->isAjax()) {
+ $gyxm=Db::name('type')->where('type_type',4)->select();
+ $this->assign('gyxm', $gyxm);
+ $dfqy=Db::name('type')->where('type_type',5)->select();
+ $this->assign('dfqy', $dfqy);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/whzc_list'));
+ }
+ }
+ $sl_data=array(
+ 'c_name'=>input('c_name'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_location'=>input('c_location',''),
+ 'c_gyxm'=>input('c_gyxm',1,'intval'),
+ 'c_dfqy'=>input('c_dfqy',1,'intval'),
+ 'c_status'=>input('c_status',0),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(),
+ 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(),
+ 'c_firstnews'=>input('c_firstnews',''),
+ 'c_desc'=>input('c_desc',''),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_logo'=>$img_one,
+ 'c_time'=>time(),
+ 'c_uid'=>session('admin_auth.aid'),
+ 'c_type'=>1
+ );
+ $rst=Db::name('otinfo')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/whzc_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/whzc_list'));
+ }
+ }
+ }
+ /**
+ * 文化资产挂牌排序
+ */
+ public function whzc_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/whzc_list'));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('otinfo')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/whzc_list'));
+ }
+ }
+ /**
+ * 文化资产挂牌删除(单个)
+ */
+ public function whzc_del()
+ {
+ $p=input('p');
+ $rst=Db::name('otinfo')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/whzc_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/whzc_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 文化资产删除挂牌(全选)
+ */
+ public function whzc_alldel()
+ {
+ $p = input('p');
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/whzc_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('otinfo')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/whzc_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/whzc_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 首页数据展示
+ * @return mixed|string
+ */
+ public function showlist(Request $request)
+ {
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+ $kind=$request->param('kind');
+ $page=$request->param('page');
+ $this->assign('c_kind',$kind);
+
+ $db=Db::name('finance')->where('c_kind',$kind);
+ if($search_name){
+ $db->where('c_name|c_code|c_jcname','like','%'.$search_name.'%');
+ }
+ $gp_list=$db->order('c_order desc,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('fwhzc_list',$gp_list);
+ $types=config('finance.parents');
+
+ $this->assign('types',$types);
+
+ $parents=config('tuoguan.parents');
+ $maps=[];
+ $total=0;
+ foreach ($parents as $key=>$item){
+ $count=Db::name('finance')->where(['c_parent'=>['like',[$key.',%','%,'.$key.'%',$key],'OR']])->sum('c_num');
+ $total+=$count;
+ array_push($maps, ['count'=>$count,'title'=>$item]);
+ }
+ $this->assign('showcounts',$maps);
+ $this->assign('total',$total);
+
+ $cates=[1=>'预披露','正式披露','成交结果公示','艺术资产转让'];
+ if($kind==9){
+ $cates=$this->artbook;
+ }else if($kind==11){
+ $cates=[1=>'A类','B类','C类','D类','E类'];
+ }
+ $this->assign('showcates',$cates);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_show_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function sub_del(){
+ $p=input('p');
+ $cid=input('cid');
+ $rst=Db::name('subscription')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p)));
+ }
+ }
+ /**
+ * 导出excel
+ */
+ public function sub_export(){
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+ date_default_timezone_set('PRC');
+ $cid=input('cid');
+ $where=['type'=>$cid];
+ $kind=input('kind');
+ if($kind)$where['kind']=$kind;
+ $list=Db::name('subscription')->where($where)->order('id desc')->select();
+
+ if(count($list)){
+ $title="详情咨询管理";
+ switch ($cid){
+ case 1:
+ $title="买家预约流程(艺术品)";
+ break;
+ case 4:
+ $title="竞买人登记";
+ break;
+ case 5:
+ $title="俱乐部会员申请";
+ break;
+ }
+ $expTitle=$title."_".date("Y-m-d");
+ $expCellNames=[];
+ $expCellNames[1]=[['title','产品名称'],['category','托管类型'],['platform','托管平台'],['parent','托管类别'],['child','托管子类别'],['username','姓名'],['mobile','联系电话'],['email','邮箱'],['created_time','发布时间']];
+ $expCellNames[3]=[['product','拍品名称'],['username','姓名'],['mobile','联系电话'],['remark','备注'],['created_time','发布时间']];
+ $expCellNames[4]=[['username','姓名'],['mobile','联系电话'],['num','出席人数'],['created_time','发布时间']];
+ $expCellNames[5]=[['username','姓名'],['mobile','联系电话'],['creditcard','身份证号码'],['remark','备注'],['created_time','发布时间']];
+
+ $expCellName=$expCellNames[$cid];
+ $expTableData=[];
+ $parents=config('finance.parents');
+ $childs=config('finance.childs');
+ $cates=[1=>'A担保回购式','B撮合回购式','C登记备案式'];
+ foreach ($list as $row){
+ $row['created_time']=date("Y-m-d H:i:s",$row['created_time']);
+ switch ($cid){
+ case 3:
+ $find=Db::name('product')->where(array('id'=>$row['productid']))->find();
+ $product='';
+ if($find)$product=$find['title'];
+ $row['product']=$product;
+ break;
+ case 1:
+ $title=$category=$child=$parent='';
+ $row['agree']=$row['agree']==1?'是':'否';
+ $row['prepay']=$row['prepay']==1?'是':'否';
+ if(in_array($row['type'],[3])){
+ $find=Db::name('product')->where(array('id'=>$row['productid']))->find();
+ if($find)$title=$find['title'];
+ }else{
+ $find=Db::name('finance')->where(array('c_id'=>$row['productid']))->find();
+ if($find){
+ $title=$find['c_name'];
+ $c_type=$find['c_type'];
+ $c_cid=$find['c_cid'];
+ $c_cate=$find['c_cate'];
+ $parent=isset($parents[$c_type])?$parents[$c_type]:'';
+ $child=isset($childs[$c_type][$c_cid])?$childs[$c_type][$c_cid]:'';
+ $category=isset($cates[$c_cate])?$cates[$c_cate]:'';
+ }
+ $row['platform']=$row['kind']==11?'古建资产管理计划':'艺术品资产托管平台';
+ $row['parent']=$parent;
+ $row['child']=$child;
+ $row['category']=$category;
+ }
+ $row['title']=$title;
+ break;
+ }
+ array_push($expTableData,$row);
+ }
+ exportExcel($expTitle, $expCellName, $expTableData);
+
+ }
+
+ }
+ public function showexport(){
+ error_reporting(E_ALL);
+ ini_set('display_errors', TRUE);
+ ini_set('display_startup_errors', TRUE);
+ date_default_timezone_set('PRC');
+ $kind=input('kind');
+ if(in_array($kind,[17])){
+ $where=['n_status'=>1];
+ if($kind)$where['n_kind']=$kind;
+ $list=Db::name('news')->where($where)->order('n_id desc')->select();
+ }else{
+ $where=['c_status'=>1];
+ if($kind)$where['c_kind']=$kind;
+ $list=Db::name('finance')->where($where)->order('c_id desc')->select();
+ }
+ if(count($list)){
+ $title="";
+ switch ($kind){
+ case 2:
+ $title="招拍挂平台";
+ break;
+ case 1:
+ $title="文化产业策略联盟挂牌平台 ";
+ break;
+ case 4:
+ $title="艺术资产托管平台 ";
+ break;
+ case 17:
+ $title="艺术公馆 ";
+ break;
+ case 9:
+ $title="艺品拍 ";
+ break;
+ case 11:
+ $title="中国古建资产托管交易平台 ";
+ break;
+ }
+ $expTitle=$title."_".date("Y-m-d");
+ $expCellNames=[];
+ $expCellNames[1]=[['c_code','挂牌代码'],['c_name','企业名称'],['c_gptime','挂牌有效期']];
+ $expCellNames[2]=[['c_code','挂牌代码'],['c_name','项目简称'],['c_gptime','挂牌日期'],['c_price','挂牌价格(元)']];
+ $expCellNames[4]=[['c_code','资产托管代码'],['c_name','托管资产名称'],['c_gptime','托管日期'],['c_price','卖家报价']];
+ $expCellNames[17]=[['n_id','ID'],['n_title','标题'],['n_time','创建时间']];
+ $expCellNames[9]=[['c_code','挂牌代码'],['c_name','艺术品名称'],['c_gptime','信息发布日期']];
+ $expCellNames[11]=[['c_code','资产挂牌代码'],['c_name','挂牌资产名称'],['c_parent','资产类型'],['c_gptime','挂牌起始日期'],['c_price','挂牌方报价']];
+
+ $expCellName=isset($expCellNames[$kind])?$expCellNames[$kind]:'';
+ if($expCellName){
+ $expTableData=[];
+ $parents=[1=>"构件类","在建类","仿古类","产权类"];
+ foreach ($list as $row){
+ if($kind==1||$kind==9){
+ if(!$row['c_infostime']){
+ if($row['c_gptime'])$row['c_gptime']=date("Y-m-d",$row['c_gptime']).'/'.date("Y-m-d",strtotime("+1 years",$row['c_gptime']));
+ }else{
+ $row['c_gptime']=date("Y-m-d",$row['c_infostime']).'/'.date("Y-m-d",$row['c_infoetime']);
+ }
+ }else{
+ if(isset($row['c_gptime']))$row['c_gptime']=date("Y-m-d",$row['c_gptime']);
+ }
+ if($kind==11){
+
+ $row['c_parent']=isset($parents[$row['c_parent']])?$parents[$row['c_parent']]:'';
+ }
+ if($kind==17){
+ $row['n_time']=date("Y-m-d",$row['n_time']);
+ }
+ array_push($expTableData,$row);
+ }
+ exportExcel($expTitle, $expCellName, $expTableData);
+ }
+ }
+
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function sub_alldel()
+ {
+ $p=input('p');
+ $cid=input('cid');
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/showlist',array('cid'=>$cid,'page'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('subscription')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/subscription',array('cid'=>$cid,'page'=>$p)));
+ }
+ }
+ public function subscription(Request $request)
+ {
+ $type=$request->param('cid',1);
+ $kind=$request->param('kind');
+ $this->assign('cid',$type);
+ $db=Db::name('subscription');
+ $where=['type'=>$type];
+ if($kind)$where['kind']=$kind;
+ else{
+ $db->whereOr(['kind'=>['EXP','IS NULL']]);
+ $db->whereOr(['kind'=>0]);
+ }
+ $gp_list=$db->where($where)->order('created_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$show);
+
+ $parents=config('finance.parents');
+ $childs=config('finance.childs');
+ $cates=[1=>'A担保回购式','B撮合回购式','C登记备案式'];
+ if($kind==11){
+ $cates=[1=>'A类','B类','C类','D类','E类'];
+ }
+ if($gp_list){
+ $list=$gp_list->toArray();
+ if(count($list)){
+ foreach ($list['data'] as &$item){
+
+ $title=$category=$child=$parent='';
+ $item['agree']=$item['agree']==1?'是':'否';
+ $item['prepay']=$item['prepay']==1?'是':'否';
+ if(in_array($item['type'],[3])){
+ $find=Db::name('product')->where(array('id'=>$item['productid']))->find();
+ if($find)$title=$find['title'];
+ }else{
+ $find=Db::name('finance')->where(array('c_id'=>$item['productid']))->find();
+ if($find){
+ $title=$find['c_name'];
+ $c_type=$find['c_type'];
+ $c_cid=$find['c_cid'];
+ $c_cate=$find['c_cate'];
+ $parent=isset($parents[$c_type])?$parents[$c_type]:'';
+ $child=isset($childs[$c_type][$c_cid])?$childs[$c_type][$c_cid]:'';
+ $category=isset($cates[$c_cate])?$cates[$c_cate]:'';
+ }
+ $item['parent']=$parent;
+ $item['child']=$child;
+ $item['category']=$category;
+ }
+ $item['title']=$title;
+ }
+ }
+ }
+ $this->assign('fwhzc_list',$list);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_sub_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 非文化四版挂牌状态修改
+ */
+ public function show_state()
+ {
+ $id=input('x');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $status=Db::name('finance')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('finance')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('finance')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+ public function show_edit(Request $request)
+ {
+ $kind=input('kind');
+ $page=input('page');
+ $this->assign('page',$page);
+ $this->assign('c_kind',$kind);
+ $types=[];
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+
+ if (!$c_id) $this->error('参数错误', url('admin/Gpgl/showlist',array('kind'=>$kind)));
+ $gp_list = Db::name('finance')->where('c_id', $c_id)->find();
+
+
+ //多图字符串转换成数组
+ $pic_list = array_filter(explode(",", $gp_list['c_photos']));
+ $this->assign('pic_list', $pic_list);
+ $tpl='show_edit';
+ switch ($kind){
+ case 4:
+ $tpl='show_edit4';
+ $types=config('finance.parents');
+ $childs=config('finance.childs');
+ $this->assign('childs',$childs);
+ $typeid=$gp_list['c_type'];
+ $tchilds=isset($childs[$typeid])?$childs[$typeid]:[];
+ $this->assign('tchilds',$tchilds);
+
+ $parents=config('tuoguan.parents');
+ $this->assign('parents',$parents);
+ $childs=config('tuoguan.childs');
+ $this->assign('pchilds',$childs);
+
+ $typeids=$gp_list['c_parent'];
+ $typeids=explode(',',$typeids);
+ $tchilds=[];
+ if(count($typeids)){
+ $gp_list['c_parent']=$typeids;
+ $nchilds=[];
+ $ochilds=explode(";",$gp_list['c_child']);
+ foreach ($typeids as $k=>$row){
+ if(isset($ochilds[$k]))$nchilds[$row]=explode(",",$ochilds[$k]);
+ }
+
+ $gp_list['c_child']=$nchilds;
+ foreach ($typeids as $typeid){
+ $tchild=isset($childs[$typeid])?$childs[$typeid]:[];
+ $tchild['parent']=isset($parents[$typeid])?$parents[$typeid]:'';
+ $tchilds[$typeid]=$tchild;
+ }
+ }
+
+ $this->assign('pcchilds',$tchilds);
+
+ $typeid=$gp_list['c_type'];
+ $tchilds=isset($childs[$typeid])?$childs[$typeid]:[];
+ $this->assign('tchilds',$tchilds);
+ break;
+ case 3:
+ $tpl='show_edit3';
+ //$types=[64=>'音乐资产托管'];
+ $types=config('finance.types');
+ $childs=[];
+ foreach ($types as $pid=>$parent){
+ $rows=Db::name('type')->field('id,type_name')->where(['type_type'=>$pid,'type_status'=>1])->select();
+ if(count($rows)){
+ $ids=array_column($rows,'id');
+ $names=array_column($rows, 'type_name');
+ $childs[$pid]=array_combine($ids,$names);
+ }
+ }
+ $typeid=$gp_list['c_type'];
+ $tchilds=isset($childs[$typeid])?$childs[$typeid]:[];
+ $this->assign('tchilds',$tchilds);
+ $this->assign('childs',$childs);
+ break;
+ case 5:
+ $tpl='show_edit5';
+ $types=config('finance.art_types');
+ break;
+ case 9:
+ $tpl='show_edit9';
+ try {
+ $evaluation=json_decode($gp_list['c_evaluation'],true);
+ if(is_string($evaluation)||empty($evaluation)){
+ $evaluation=json_decode(urldecode($gp_list['c_evaluation']),true);
+ }
+ $gp_list['c_evaluation']=$evaluation;
+ } catch (\Exception $e) {
+ $gp_list['c_evaluation']='';
+ }
+
+ $cates=$this->artbook;
+ $this->assign('cates',$cates);
+ break;
+
+ case 6:
+ $types=config('finance.art_enjoy');
+ $tpl='show_edit6';
+ break;
+ case 1:
+ $tpl='show_edit1';
+ break;
+ case 2:
+ $tpl='show_edit2';
+ break;
+ case 10:
+ $tpl='show_edit10';
+ break;
+ case 8:
+ $tpl='show_edit8';
+ break;
+ case 12:
+ $tpl='show_edit12';
+ break;
+
+ case 13:
+ $tpl='show_edit13';
+ break;
+ case 14:
+ $tpl='show_edit14';
+ break;
+ case 15:
+ $parents=config('building.parents3');
+ $this->assign('parents',$parents);
+
+ $childs=config('building.childs2');
+ $this->assign('childs',$childs);
+
+ $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权'];
+
+ $this->assign('elems',$elems);
+ $classs=config('building.class');
+ $sizes=config('building.size');
+ $prices=config('building.price');
+ $years=config('building.year');
+ $this->assign('classs',$classs);
+ $this->assign('sizes',$sizes);
+ $this->assign('prices',$prices);
+ $this->assign('years',$years);
+
+ $typeids=$gp_list['c_parent'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['c_parent']=$typeids;
+ }
+
+ $typeids=$gp_list['capital_elem'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['capital_elem']=$typeids;
+ }
+ $typeids=$gp_list['capital_info'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['capital_info']=$typeids;
+ }
+ $tpl='show_edit15';
+ break;
+ case 7:
+ $tpl='show_edit7';
+ break;
+ case 11:
+ $tpl='show_edit11';
+ $parents=config('building.parents');
+ $this->assign('parents',$parents);
+
+ $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权'];
+
+ $this->assign('elems',$elems);
+ $classs=config('building.class');
+ $sizes=config('building.size');
+ $prices=config('building.price');
+ $years=config('building.year');
+ $this->assign('classs',$classs);
+ $this->assign('sizes',$sizes);
+ $this->assign('prices',$prices);
+ $this->assign('years',$years);
+
+ $typeids=$gp_list['c_parent'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['c_parent']=$typeids;
+ }
+
+ $typeids=$gp_list['capital_elem'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['capital_elem']=$typeids;
+ }
+ $typeids=$gp_list['capital_info'];
+ $typeids=explode(',',$typeids);
+ if(count($typeids)){
+ $gp_list['capital_info']=$typeids;
+ }
+ break;
+ }
+
+ $this->assign('list', $gp_list);
+ $this->assign('kind',$kind);
+ $this->assign('types',$types);
+ return $this->fetch($tpl);
+ }else{
+
+ $pic_oldlist=input('pic_oldlist');//老多图字符串
+ $jump=url('admin/Gpgl/showlist',array('kind'=>$kind,'page'=>$page));
+ $img_one='';
+ $img_one2='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $file3 = request()->file('mortgage_img');
+ $files = request()->file('pic_all');
+
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+ $sl_data=$request->post();
+
+ $c_id = input('c_id', 0, 'intval');
+ $code=isset($sl_data['c_code'])?$sl_data['c_code']:'';
+ if($code){
+ $check=$this->_checkCode($code,$c_id,$kind);
+ if($check){
+ $this->error('托管代码不能重复');
+ }
+ }
+ if($kind==9){
+ $evaluation=htmlspecialchars_decode(input('c_evaluation'));
+ $evaluation=json_decode($evaluation,true);
+ if(count($evaluation)){
+ foreach ($evaluation as $k=>$row){
+ $row=array_filter($row);
+ $row=array_values($row);
+ array_walk($row,"walkparse");
+ $evaluation[$k]=$row;
+ }
+ }
+ $sl_data['c_evaluation']=json_encode($evaluation);
+ }
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ if(!empty($picall_url)){
+ $sl_data['c_photos']=$pic_oldlist.$picall_url;
+ }else{
+ $sl_data['c_photos']=$pic_oldlist;
+ }
+ $sl_data['c_infostime']=isset($sl_data['c_infostime'])?strtotime($sl_data['c_infostime']):time();
+ $sl_data['c_infoetime']=isset($sl_data['c_infoetime'])?strtotime($sl_data['c_infoetime']):time();
+ if(isset($sl_data['c_gptime']))$sl_data['c_gptime']=strtotime($sl_data['c_gptime']);
+ $sl_data['c_status']=input('c_status',0);
+ if(isset($sl_data['c_pass']))$sl_data['c_pass']=input('c_pass',0);
+ if(isset($sl_data['c_cate']))$sl_data['c_cate']=input('c_cate','');
+ if(isset($sl_data['c_cname']))$sl_data['c_cname']=input('c_cname');
+
+ $sl_data['c_content']=htmlspecialchars_decode(input('c_content'));
+ $sl_data['capital_desc']=htmlspecialchars_decode(input('capital_desc'));
+ if(isset($sl_data['pic_one2']))unset($sl_data['pic_one2']);
+ if(isset($sl_data['pic_one']))unset($sl_data['pic_one']);
+ if(isset($sl_data['checkpic']))unset($sl_data['checkpic']);
+ if(isset($sl_data['oldcheckpic']))unset($sl_data['oldcheckpic']);
+ if(isset($sl_data['pic_oldlist']))unset($sl_data['pic_oldlist']);
+ if(isset($sl_data['pic_all']))unset($sl_data['pic_all']);
+ if($kind==4){
+ $childs="";
+ $parents="";
+ if(isset($sl_data['c_parent'])&&count($sl_data['c_parent'])){
+ foreach ($sl_data['c_parent'] as $k=>$row){
+ if(!isset($sl_data['c_child'][$row])){
+ $sl_data['c_child'][$row]=[];
+ }
+ $childs.=implode(",",$sl_data['c_child'][$row]).";";
+ }
+ $childs=rtrim($childs,";");
+ $parents=isset($sl_data['c_parent'])&&count($sl_data['c_parent'])?implode(',', $sl_data['c_parent']):'';
+ }
+ $sl_data['c_parent']=$parents;
+ $sl_data['c_child']=$childs;
+
+ $ret=$this->dealFile($file2);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+
+ $sl_data['c_material']=input('c_material','');
+ $sl_data['c_year']=input('c_year','');
+ $sl_data['c_evaluation']=htmlspecialchars_decode(input('c_evaluation'));
+ $sl_data['c_transaction']=htmlspecialchars_decode(input('c_transaction'));
+ $sl_data['c_state']=input('c_state',1);
+ if(!empty($img_one2)){
+ $sl_data['c_notice']=$img_one2;
+ }
+ }
+ if($kind==11){
+ $sl_data['capital_elem']=isset($sl_data['capital_elem'])&&count($sl_data['capital_elem'])?implode(',', $sl_data['capital_elem']):'';
+
+ $sl_data['capital_level']=input('capital_level','');
+ $sl_data['c_year']=input('c_year','');
+
+
+ if(isset($sl_data['capital_land'])&&$sl_data['capital_land']==5&&isset($sl_data['land_other']))$sl_data['land_other']=input('land_other','');
+ if(isset($sl_data['c_year'])&&$sl_data['c_year']==4&&isset($sl_data['year_other']))$sl_data['year_other']=input('year_other','');
+ if(isset($sl_data['c_class'])&&$sl_data['c_class']==9&&isset($sl_data['class_other']))$sl_data['class_other']=input('class_other','');
+ if(isset($sl_data['capital_info'])){
+ if(in_array(4, $sl_data['capital_info'])&&isset($sl_data['info_other']))$sl_data['info_other']=input('info_other','');
+ $sl_data['capital_info']=implode(',', $sl_data['capital_info']);
+ }
+ $ret=$this->dealFile($file3);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one']){
+ $img=$ret['img_one'];
+ $sl_data['mortgage_img']=$img;
+ }
+ }
+ }
+ $sl_data['c_tag']=input('c_tag',0);
+ $sl_data['c_mold']=input('c_mold',0);
+ $sl_data['c_uid']=session('admin_auth.aid');
+ $item=new Finance();
+ $rst=$item->allowField(true)->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ protected function _checkCode($code='',$id='',$kind=''){
+ $find=Db::name('finance')->where(['c_code'=>$code]);
+ if($id){
+ $find->where('c_id','neq',$id);
+ }
+ if($kind){
+ $find->where(['c_kind'=>$kind]);
+ }
+ $res=$find->count();
+ return $res;
+ }
+ /**
+ * 非文化资产挂牌增加
+ */
+ public function show_add(Request $request)
+ {
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $types=[];
+ if(!request()->isAjax()) {
+ $tpl='show_add';
+ switch ($kind){
+ case 4:
+ $tpl='show_add4';
+ $types=config('finance.parents');
+ $childs=config('finance.childs');
+ $this->assign('childs',$childs);
+
+
+ $parents=config('tuoguan.parents');
+ $this->assign('parents',$parents);
+ $childs=config('tuoguan.childs');
+ $this->assign('pchilds',$childs);
+ break;
+ case 3:
+ $tpl='show_add3';
+ //$types=[64=>'音乐资产托管'];
+ $types=config('finance.types');
+ $childs=[];
+ foreach ($types as $pid=>$parent){
+ $rows=Db::name('type')->field('id,type_name')->where(['type_type'=>$pid,'type_status'=>1])->select();
+ if(count($rows)){
+ $ids=array_column($rows,'id');
+ $names=array_column($rows, 'type_name');
+ $childs[$pid]=array_combine($ids,$names);
+ }
+ }
+ $this->assign('childs',$childs);
+ break;
+ case 5:
+ $tpl='show_add5';
+ $types=config('finance.art_types');
+ break;
+ case 9:
+ $tpl='show_add9';
+ $cates=$this->artbook;
+ $this->assign('cates',$cates);
+ break;
+ case 7:
+ $tpl='show_add7';
+ break;
+ case 6:
+ $types=config('finance.art_enjoy');
+ $tpl='show_add6';
+ break;
+ case 1:
+ $tpl='show_add1';
+ break;
+ case 2:
+ $tpl='show_add2';
+ break;
+ case 10:
+ $tpl='show_add10';
+ break;
+ case 8:
+ $tpl='show_add8';
+ break;
+ case 12:
+ $tpl='show_add12';
+ break;
+ case 13:
+ $tpl='show_add13';
+ break;
+ case 14:
+ $tpl='show_add14';
+ break;
+ case 15:
+ $tpl='show_add15';
+ $parents=config('building.parents3');
+ $this->assign('parents',$parents);
+ $childs=config('building.childs2');
+ $this->assign('childs',$childs);
+
+ $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权'];
+
+ $this->assign('elems',$elems);
+ $classs=config('building.class');
+ $sizes=config('building.size');
+ $prices=config('building.price');
+ $years=config('building.year');
+ $this->assign('classs',$classs);
+ $this->assign('sizes',$sizes);
+ $this->assign('prices',$prices);
+ $this->assign('years',$years);
+ break;
+ case 11:
+ $tpl='show_add11';
+ $parents=config('building.parents');
+ $this->assign('parents',$parents);
+
+ $elems=['1'=>'资产所有权','资产使用权','资产收益权','资产租赁权'];
+
+ $this->assign('elems',$elems);
+ $classs=config('building.class');
+ $sizes=config('building.size');
+ $prices=config('building.price');
+ $years=config('building.year');
+ $this->assign('classs',$classs);
+ $this->assign('sizes',$sizes);
+ $this->assign('prices',$prices);
+ $this->assign('years',$years);
+ break;
+ }
+ $this->assign('kind',$kind);
+ $this->assign('types',$types);
+ return $this->fetch($tpl);
+ }else{
+ $jump=url('admin/Gpgl/showlist',array('kind'=>$kind));
+ $img_one='';
+ $img_one2='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $file3 = request()->file('mortgage_img');
+ $files = request()->file('pic_all');
+
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+
+
+ $item=new Finance();
+ $sl_data=$request->post();
+
+ $code=isset($sl_data['c_code'])?$sl_data['c_code']:'';
+ if($code){
+ $check=$this->_checkCode($code,'',$kind);
+ if($check){
+ $this->error('托管代码不能重复');
+ }
+ }
+ $sl_data['c_kind']=$kind;
+ $sl_data['c_infostime']=isset($sl_data['c_infostime'])?strtotime($sl_data['c_infostime']):time();
+ $sl_data['c_infoetime']=isset($sl_data['c_infoetime'])?strtotime($sl_data['c_infoetime']):time();
+ if(isset($sl_data['c_gptime']))$sl_data['c_gptime']=strtotime($sl_data['c_gptime']);
+ $sl_data['c_status']=input('c_status',0);
+ if(isset($sl_data['c_pass']))$sl_data['c_pass']=input('c_pass',0);
+ if(isset($sl_data['c_cate']))$sl_data['c_cate']=input('c_cate','');
+ if(isset($sl_data['c_state']))$sl_data['c_state']=input('c_state',1);
+ if(isset($sl_data['c_cname']))$sl_data['c_cname']=input('c_cname');
+
+ if(isset($sl_data['capital_land'])&&$sl_data['capital_land']==5&&isset($sl_data['land_other']))$sl_data['land_other']=input('land_other','');
+ if(isset($sl_data['c_year'])&&$sl_data['c_year']==4&&isset($sl_data['year_other']))$sl_data['year_other']=input('year_other','');
+ if(isset($sl_data['c_class'])&&$sl_data['c_class']==9&&isset($sl_data['class_other']))$sl_data['class_other']=input('class_other','');
+ if(isset($sl_data['capital_info'])){
+ if(in_array(4, $sl_data['capital_info'])&&isset($sl_data['info_other']))$sl_data['info_other']=input('info_other','');
+ $sl_data['capital_info']=implode(',', $sl_data['capital_info']);
+ }
+
+ $sl_data['c_content']=htmlspecialchars_decode(input('c_content'));
+ $sl_data['capital_desc']=htmlspecialchars_decode(input('capital_desc'));
+ if($kind==9){
+ $evaluation=htmlspecialchars_decode(input('c_evaluation'));
+ $evaluation=json_decode($evaluation,true);
+ if(count($evaluation)){
+ foreach ($evaluation as $k=>$row){
+ $row=array_filter($row);
+ $row=array_values($row);
+ array_walk($row,"walkparse");
+ $evaluation[$k]=$row;
+ }
+ }
+ $sl_data['c_evaluation']=json_encode($evaluation);
+ }
+ if($kind==4){
+ $childs="";
+ $parents="";
+ if(isset($sl_data['c_parent'])&&count($sl_data['c_parent'])){
+ foreach ($sl_data['c_parent'] as $k=>$row){
+ if(!isset($sl_data['c_child'][$row])){
+ $sl_data['c_child'][$row]=[];
+ }
+ $childs.=implode(",",$sl_data['c_child'][$row]).";";
+ }
+ $childs=rtrim($childs,";");
+ $parents=isset($sl_data['c_parent'])&&count($sl_data['c_parent'])?implode(',', $sl_data['c_parent']):'';
+ }
+ $sl_data['c_parent']=$parents;
+ $sl_data['c_child']=$childs;
+
+ $ret=$this->dealFile($file2);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+
+ $sl_data['c_material']=input('c_material','');
+ $sl_data['c_year']=input('c_year','');
+ $sl_data['c_evaluation']=htmlspecialchars_decode(input('c_evaluation'));
+ $sl_data['c_transaction']=htmlspecialchars_decode(input('c_transaction'));
+ if(!empty($img_one2)){
+ $sl_data['c_notice']=$img_one2;
+ }
+ }
+ if($kind==11){
+ $sl_data['capital_elem']=isset($sl_data['capital_elem'])&&count($sl_data['capital_elem'])?implode(',', $sl_data['capital_elem']):'';
+
+ $sl_data['capital_level']=input('capital_level','');
+ $sl_data['c_year']=input('c_year','');
+
+ $ret=$this->dealFile($file3);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one']){
+ $img=$ret['img_one'];
+ $sl_data['mortgage_img']=$img;
+ }
+ }
+ }
+
+ if($kind==15){
+ $sl_data['c_child']=input('c_child','');
+ }
+
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ if(!empty($picall_url)){
+ $sl_data['c_photos']=$picall_url;
+ }
+ if(isset($sl_data['pic_one']))unset($sl_data['pic_one']);
+ if(isset($sl_data['pic_one2']))unset($sl_data['pic_one2']);
+ if(isset($sl_data['checkpic']))unset($sl_data['checkpic']);
+ if(isset($sl_data['oldcheckpic']))unset($sl_data['oldcheckpic']);
+ if(isset($sl_data['pic_oldlist']))unset($sl_data['pic_oldlist']);
+ if(isset($sl_data['pic_all']))unset($sl_data['pic_all']);
+ $sl_data['c_time']=time();
+ $sl_data['c_tag']=input('c_tag',0);
+ $sl_data['c_mold']=input('c_mold',0);
+ $sl_data['c_jcname']=input('c_jcname',' ');
+ $sl_data['c_uid']=session('admin_auth.aid');
+ $rst=$item->allowField(true)->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',$jump);
+ }else{
+ $this->error('增加失败',$jump);
+ }
+ }
+ }
+
+ /**
+ * 非文化资产挂牌排序
+ */
+ public function show_order()
+ {
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/showlist',array('kind'=>$kind)));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('finance')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/showlist',array('kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function show_del()
+ {
+ $p=input('p');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $rst=Db::name('finance')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/showlist',array('p' => $p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function show_alldel()
+ {
+ $p = input('p');
+ $kind=input('kind');
+ $this->assign('c_kind',$kind);
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('finance')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/showlist',array('p'=>$p,'kind'=>$kind)));
+ }
+ }
+ /**
+ * 非文化资产列表
+ */
+ public function fwhzc_list()
+ {
+ $gp_list=Db::name('otinfo')->where('c_type',2)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $gp_list->render();
+ $this->assign('page',$show);
+ $this->assign('fwhzc_list',$gp_list);
+
+ if(request()->isAjax()){
+ return $this->fetch('ajax_fwhzc_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 非文化四版挂牌状态修改
+ */
+ public function fwhzc_state()
+ {
+ $id=input('x');
+ $status=Db::name('otinfo')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('otinfo')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+ public function fwhzc_edit()
+ {
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+ if (!$c_id) $this->error('参数错误', url('admin/Gpgl/fwhzc_list'));
+ $gp_list = Db::name('otinfo')->where('c_id', $c_id)->find();
+ $this->assign('fwhzc_list', $gp_list);
+ $gyxm=Db::name('type')->where('type_type',4)->select();
+ $this->assign('gyxm', $gyxm);
+ $dfqy=Db::name('type')->where('type_type',5)->select();
+ $this->assign('dfqy', $dfqy);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/whzc_list'));
+ }
+ }
+ $sl_data=array(
+ 'c_id'=>input('c_id'),
+ 'c_name'=>input('c_name'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_location'=>input('c_location',''),
+ 'c_gyxm'=>input('c_gyxm',1,'intval'),
+ 'c_dfqy'=>input('c_dfqy',1,'intval'),
+ 'c_status'=>input('c_status',0),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(),
+ 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(),
+ 'c_firstnews'=>input('c_firstnews',''),
+ 'c_desc'=>input('c_desc',''),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $rst=Db::name('otinfo')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/fwhzc_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/fwhzc_list'));
+ }
+ }
+ }
+ /**
+ * 非文化资产挂牌增加
+ */
+ public function fwhzc_add()
+ {
+ if(!request()->isAjax()) {
+ $gyxm=Db::name('type')->where('type_type',4)->select();
+ $this->assign('gyxm', $gyxm);
+ $dfqy=Db::name('type')->where('type_type',5)->select();
+ $this->assign('dfqy', $dfqy);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/whzc_list'));
+ }
+ }
+ $sl_data=array(
+ 'c_name'=>input('c_name'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_location'=>input('c_location',''),
+ 'c_gyxm'=>input('c_gyxm',1,'intval'),
+ 'c_dfqy'=>input('c_dfqy',1,'intval'),
+ 'c_status'=>input('c_status',0),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_infostime'=>input('c_infostime','')?strtotime(input('c_infostime','')):time(),
+ 'c_infoetime'=>input('c_infoetime','')?strtotime(input('c_infoetime','')):time(),
+ 'c_firstnews'=>input('c_firstnews',''),
+ 'c_desc'=>input('c_desc',''),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_logo'=>$img_one,
+ 'c_time'=>time(),
+ 'c_uid'=>session('admin_auth.aid'),
+ 'c_type'=>2
+ );
+ $rst=Db::name('otinfo')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/fwhzc_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/fwhzc_list'));
+ }
+ }
+ }
+ /**
+ * 非文化资产挂牌排序
+ */
+ public function fwhzc_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/fwhzc_list'));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('otinfo')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/fwhzc_list'));
+ }
+ }
+ /**
+ * 非文化资产挂牌删除(单个)
+ */
+ public function fwhzc_del()
+ {
+ $p=input('p');
+ $rst=Db::name('otinfo')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/fwhzc_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/fwhzc_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 非文化资产删除挂牌(全选)
+ */
+ public function fwhzc_alldel()
+ {
+ $p = input('p');
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/fwhzc_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('otinfo')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/fwhzc_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/fwhzc_list',array('p'=>$p)));
+ }
+ }
+ //查询公馆
+ public function manager_list(){
+ $zgwhjf_gg=Db::name('zgwhjf_gg')->order('gg_order,gg_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ if(empty($zgwhjf_gg)){
+ $this->success("查询失败",url('admin/Gpgl/gp_list'));
+ }
+ $show = $zgwhjf_gg->render();
+ $this->assign('page',$show);
+ $this->assign("zgwhjf_gg",$zgwhjf_gg);
+ //公馆分类
+ $hylb=Db::name('type')->where('type_type',50)->select();
+ $this->assign('hylb', $hylb);
+ //门类分类
+ $hylbt=Db::name('type')->where('type_type',51)->select();
+ $this->assign('hylbt', $hylbt);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_whzc_manager_list');//whzc_manager
+ }else{
+ return $this->fetch('whzc_manager');
+ }
+ }
+ //公馆新增
+ public function manager_add(){
+ $gg_code = input('gg_code');
+ if($gg_code==null){
+ //公馆分类
+ $hylb=Db::name('type')->where('type_type',50)->select();
+ $this->assign('hylb', $hylb);
+ //门类分类
+ $hylbt=Db::name('type')->where('type_type',51)->select();
+ $this->assign('hylbt', $hylbt);
+ return $this->fetch('manager_add');
+ }
+ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time();
+ }
+ $sl_data=array(
+ 'gg_code'=>input('gg_code'),
+ 'gg_museumunt'=>input('gg_museumunt'),
+ 'gg_grade'=>input('gg_grade'),
+ 'gg_opentime'=>$term,
+ 'gg_type'=>input('gg_type',1,'intval'),
+ 'gg_category'=>input('gg_category',1,'intval'),
+ 'gg_time'=>time(),
+ 'gg_uid'=>session('admin_auth.aid'),
+ 'gg_status'=>input('gg_status',0),
+ 'gg_content'=>htmlspecialchars_decode(input('gg_content')),
+ 'gg_order'=>input('gg_order'),
+ );
+ $rst=Db::name('zgwhjf_gg')->insert($sl_data);
+
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/manager_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/manager_add'));
+ }
+ }
+ //公馆删除
+ public function manager_detele(){
+ $p = input('p');
+ $ids = input('gg_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/manager_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'gg_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'gg_id='.$ids;
+ }
+ $rst=Db::name('zgwhjf_gg')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/manager_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/manager_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 公馆排序
+ */
+ public function manager_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/manager_list'));
+ }else{
+ foreach (input('post.') as $gg_id => $gg_order){
+ Db::name('zgwhjf_gg')->update(['gg_id'=>$gg_id,'gg_order'=>$gg_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/manager_list'));
+ }
+ }
+
+ /**
+ * 公馆状态修改
+ */
+ public function manager_state()
+ {
+ $id=input('x');
+ $status=Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->value('gg_status');
+ if($status==1){
+ $statedata = array('gg_status'=>0);
+ Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('gg_status'=>1);
+ Db::name('zgwhjf_gg')->where(array('gg_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+
+ /**
+ * 公馆挂牌修改
+ */
+ public function manager_edit()
+ {
+ $aa=input('aa');
+ if($aa==null) {
+ $gg_id = input('gg_id', 0, 'intval');
+ $zbed=Db::name('zgwhjf_gg')->where('gg_id',$gg_id)->find();
+ $this->assign('zbed', $zbed);
+ //公馆分类
+ $hylb=Db::name('type')->where('type_type',50)->select();
+ $this->assign('hylb', $hylb);
+ //门类分类
+ $hylbt=Db::name('type')->where('type_type',51)->select();
+ $this->assign('hylbt', $hylbt);
+ return $this->fetch('manager_update');
+ }else{
+ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('gg_opentime')?strtotime(input('gg_opentime','')):time();
+ }
+ $sl_data=array(
+ 'gg_code'=>input('gg_code'),
+ 'gg_museumunt'=>input('gg_museumunt'),
+ 'gg_grade'=>input('gg_grade'),
+ 'gg_opentime'=>$term,
+ 'gg_type'=>input('gg_type',1,'intval'),
+ 'gg_category'=>input('gg_category',1,'intval'),
+ 'gg_time'=>time(),
+ 'gg_uid'=>session('admin_auth.aid'),
+ 'gg_status'=>input('gg_status',0),
+ 'gg_content'=>htmlspecialchars_decode(input('gg_content')),
+ 'gg_order'=>input('gg_order')
+ );
+
+ $rst=Db::name('zgwhjf_gg')->where('gg_id',input('gg_id'))->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/manager_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/manager_list'));
+ }
+ }
+ }
+
+ //查询商城
+ public function shopping_list(){
+ $zgwhjf_gg=Db::name('zgwhjf_sc')->order('sc_sort,sc_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ if(empty($zgwhjf_gg)){
+ $this->success("查询失败",url('admin/Gpgl/shopping_list'));
+ }
+ $show = $zgwhjf_gg->render();
+ $this->assign('page',$show);
+ $this->assign("zgwhjf_gg",$zgwhjf_gg);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_whzc_shopping_list');//whzc_manager
+ }else{
+ return $this->fetch('shopping_list');
+ }
+ }
+
+ //商城新增
+ public function shopping_add(){
+ $sc_product_code = input('sc_product_code');
+ if($sc_product_code==null){
+ return $this->fetch('shopping_add');
+ }
+ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time();
+ }
+ $sl_data=array(
+ 'sc_sort'=>input('sc_sort'),
+ 'sc_product_code'=>input('sc_product_code'),
+ 'sc_product_name'=>input('sc_product_name'),
+ 'sc_uptime'=>$term,
+ 'sc_price'=>input('sc_price'),
+ 'sc_jbd'=>input('sc_jbd'),
+ 'sc_totalcount'=>input('sc_totalcount'),
+ 'sc_time'=>time(),
+ 'sc_uid'=>session('admin_auth.aid'),
+ 'sc_status'=>input('sc_status',0),
+ 'sc_content'=>input('sc_content'),
+ 'sc_mincount'=>input('sc_mincount'),
+ );
+ $rst=Db::name('zgwhjf_sc')->insert($sl_data);
+
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/shopping_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/shopping_add'));
+ }
+ }
+
+ //商城删除
+ public function shopping_detele(){
+ $p = input('p');
+ $ids = input('sc_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/shopping_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'sc_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'sc_id='.$ids;
+ }
+ $rst=Db::name('zgwhjf_sc')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/shopping_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/shopping_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 商城状态修改
+ */
+ public function shopping_state()
+ {
+ $id=input('x');
+ $status=Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->value('sc_status');
+ if($status==1){
+ $statedata = array('sc_status'=>0);
+ Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('sc_status'=>1);
+ Db::name('zgwhjf_sc')->where(array('sc_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+
+ /**
+ * 商城排序
+ */
+ public function shopping_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/shopping_list'));
+ }else{
+ foreach (input('post.') as $gg_id => $gg_order){
+ Db::name('zgwhjf_sc')->update(['sc_id'=>$gg_id,'sc_sort'=>$gg_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/shopping_list'));
+ }
+ }
+
+
+ /**
+ * 商城挂牌修改
+ */
+ public function shopping_edit()
+ {
+ $aa=input('aa');
+ if($aa==null) {
+ $sc_id = input('sc_id', 0, 'intval');
+ $zbed=Db::name('zgwhjf_sc')->where('sc_id',$sc_id)->find();
+ $this->assign('zbed', $zbed);
+ return $this->fetch('shopping_update');
+ }else{
+ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('sc_uptime')?strtotime(input('sc_uptime','')):time();
+ }
+ $sl_data=array(
+ 'sc_sort'=>input('sc_sort'),
+ 'sc_product_code'=>input('sc_product_code'),
+ 'sc_product_name'=>input('sc_product_name'),
+ 'sc_uptime'=>$term,
+ 'sc_price'=>input('sc_price'),
+ 'sc_jbd'=>input('sc_jbd'),
+ 'sc_totalcount'=>input('sc_totalcount'),
+ 'sc_time'=>time(),
+ 'sc_status'=>input('sc_status',0),
+ 'sc_content'=>input('sc_content'),
+ 'sc_uid'=>session('admin_auth.aid'),
+ 'sc_mincount'=>input('sc_mincount'),
+ );
+
+ $rst=Db::name('zgwhjf_sc')->where('sc_id',input('sc_id'))->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/shopping_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/shopping_list'));
+ }
+ }
+ }
+
+ //查询艺拍
+ public function making_list(){
+ $zgwhjf_gg=Db::name('zgwhjf_yp')->order('yp_sort,yp_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ if(empty($zgwhjf_gg)){
+ $this->success("查询失败",url('admin/Gpgl/making_list'));
+ }
+ $show = $zgwhjf_gg->render();
+ $this->assign('page',$show);
+ $this->assign("zgwhjf_gg",$zgwhjf_gg);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_whzc_making_list');//whzc_manager
+ }else{
+ return $this->fetch('making_list');
+ }
+ }
+
+ //艺拍新增
+ public function making_add(){
+ $yp_auction_code = input('yp_auction_code');
+ if($yp_auction_code==null){
+ return $this->fetch('making_add');
+ }
+ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time();
+ }
+ $sl_data=array(
+ 'yp_auction_code'=>input('yp_auction_code'),
+ 'yp_artist_name'=>input('yp_artist_name'),
+ 'yp_works_name'=>input('yp_works_name'),
+ 'yp_create_year'=>$term,
+ 'yp_start_price'=>input('yp_start_price'),
+ 'yp_transaction_price'=>input('yp_transaction_price'),
+ 'yp_schq'=>input('yp_schq'),
+ 'yp_time'=>time(),
+ 'yp_uid'=>session('admin_auth.aid'),
+ 'yp_status'=>input('yp_status',0),
+ 'yp_content'=>input('yp_content'),
+ 'yp_sort'=>input('yp_sort'),
+ );
+ $rst=Db::name('zgwhjf_yp')->insert($sl_data);
+
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/making_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/making_add'));
+ }
+ }
+
+ //艺拍删除
+ public function making_detele(){
+ $p = input('p');
+ $ids = input('yp_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/making_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'yp_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'yp_id='.$ids;
+ }
+ $rst=Db::name('zgwhjf_yp')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/making_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/making_list',array('p'=>$p)));
+ }
+ }
+
+
+ /**
+ * 艺拍状态修改
+ */
+ public function making_state()
+ {
+ $id=input('x');
+ $status=Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->value('yp_status');
+ if($status==1){
+ $statedata = array('yp_status'=>0);
+ Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('yp_status'=>1);
+ Db::name('zgwhjf_yp')->where(array('yp_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+
+ /**
+ * 艺拍修改
+ */
+ public function making_edit()
+ {
+ $aa=input('aa');
+ if($aa==null) {
+ $sc_id = input('yp_id', 0, 'intval');
+ $zbed=Db::name('zgwhjf_yp')->where('yp_id',$sc_id)->find();
+ $this->assign('zbed', $zbed);
+ return $this->fetch('making_update');
+ }else{
+ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('yp_create_year')?strtotime(input('yp_create_year','')):time();
+ }
+ $sl_data=array(
+ 'yp_auction_code'=>input('yp_auction_code'),
+ 'yp_artist_name'=>input('yp_artist_name'),
+ 'yp_works_name'=>input('yp_works_name'),
+ 'yp_create_year'=>$term,
+ 'yp_start_price'=>input('yp_start_price'),
+ 'yp_transaction_price'=>input('yp_transaction_price'),
+ 'yp_schq'=>input('yp_schq'),
+ 'yp_status'=>input('yp_status',0),
+ 'yp_content'=>input('yp_content'),
+ 'yp_time'=>time(),
+ 'yp_sort'=>input('yp_sort'),
+ 'yp_uid'=>session('admin_auth.aid'),
+ );
+
+ $rst=Db::name('zgwhjf_yp')->where('yp_id',input('yp_id'))->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/making_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/making_list'));
+ }
+ }
+ }
+
+ //查询艺术投行
+ public function shooting_list(){
+ $zgwhjf_gg=Db::name('zgwhjf_ysth')->order('ysth_sort,ysth_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ if(empty($zgwhjf_gg)){
+ $this->success("查询失败",url('admin/Gpgl/shooting_list'));
+ }
+ $show = $zgwhjf_gg->render();
+ $this->assign('page',$show);
+ $this->assign("zgwhjf_gg",$zgwhjf_gg);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_whzc_shooting_list');//whzc_manager
+ }else{
+ return $this->fetch('shooting_list');
+ }
+ }
+
+ //艺术投行新增
+ public function shooting_add(){
+ $ysth_code = input('ysth_code');
+ if($ysth_code==null){
+ return $this->fetch('shooting_add');
+ }
+ $term =input('ysth_term')?strtotime(input('ysth_term','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('ysth_term')?strtotime(input('ysth_term','')):time();
+ }
+ $sl_data=array(
+ 'ysth_code'=>input('ysth_code'),
+ 'ysth_product_name'=>input('ysth_product_name'),
+ 'ysth_term'=>$term,
+ 'ysth_estimate_yearrate'=>input('ysth_estimate_yearrate'),
+ 'ysth_time'=>time(),
+ 'ysth_uid'=>session('admin_auth.aid'),
+ 'ysth_status'=>input('ysth_status',0),
+ 'ysth_content'=>input('ysth_content'),
+ 'ysth_sort'=>input('ysth_sort'),
+ );
+ $rst=Db::name('zgwhjf_ysth')->insert($sl_data);
+
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/shooting_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/shooting_add'));
+ }
+ }
+
+ //艺术投行删除
+ public function shooting_detele(){
+ $p = input('p');
+ $ids = input('ysth_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/shooting_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'ysth_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'ysth_id='.$ids;
+ }
+ $rst=Db::name('zgwhjf_ysth')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/shooting_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/shooting_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 艺术投行状态修改
+ */
+ public function shooting_state()
+ {
+ $id=input('x');
+ $status=Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->value('ysth_status');
+ if($status==1){
+ $statedata = array('ysth_status'=>0);
+ Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('ysth_status'=>1);
+ Db::name('zgwhjf_ysth')->where(array('ysth_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+
+ /**
+ * 艺术投行修改
+ */
+ public function shooting_edit()
+ {
+ $aa=input('aa');
+ if($aa==null) {
+ $ysth_id = input('ysth_id', 0, 'intval');
+ $zbed=Db::name('zgwhjf_ysth')->where('ysth_id',$ysth_id)->find();
+ $this->assign('zbed', $zbed);
+ return $this->fetch('shooting_update');
+ }else{
+ $term =input('ysth_term')?strtotime(input('ysth_term','')):time();
+ if($term==null){
+ $term=time();
+ }else{
+ $term =input('ysth_term')?strtotime(input('ysth_term','')):time();
+ }
+ $sl_data=array(
+ 'ysth_code'=>input('ysth_code'),
+ 'ysth_product_name'=>input('ysth_product_name'),
+ 'ysth_term'=>$term,
+ 'ysth_estimate_yearrate'=>input('ysth_estimate_yearrate'),
+ 'ysth_time'=>time(),
+ 'ysth_uid'=>session('admin_auth.aid'),
+ 'ysth_sort'=>input('ysth_sort'),
+ 'ysth_status'=>input('ysth_status',0),
+ 'ysth_content'=>input('ysth_content'),
+ );
+
+ $rst=Db::name('zgwhjf_ysth')->where('ysth_id',input('ysth_id'))->update($sl_data);
+ if($rst!==false){
+ // return $this->redirect(url('admin/Gpgl/shooting_list'));
+ $this->success('修改成功',url('admin/Gpgl/shooting_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/shooting_list'));
+ }
+ }
+ }
+
+ /**
+ * 国有列表
+ */
+ public function gy_list()
+ {
+ $c_ssbk=input('c_ssbk',0,'intval');
+ $op='=';
+ $type_id=$c_ssbk;
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type','=',54)->where('type_id',$op,$type_id)->find();
+ $this->assign('ssbk', $ssbk);
+ $where['type_type']=54;
+ if($c_ssbk) $where['c_ssbk']=$c_ssbk;
+ $this->assign('c_ssbk',$c_ssbk);
+ $gp_list=Db::name('gyxm')->alias('a')->join(config('database.prefix').'type b','a.c_ssbk=b.type_id')->where($where)->order('c_order,c_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $gp_list->render();
+ $this->assign('page',$show);
+ $this->assign('gp_list',$gp_list);
+ if(request()->isAjax()){
+ return $this->fetch('gpgl/ajax_gy_list');
+ }else{
+ return $this->fetch('gpgl/gy_list');
+ }
+
+
+
+ }
+
+ /**
+ * 国有项目增加
+ */
+ public function gy_add()
+ {
+ if(!request()->isAjax()) {
+ //行业类别
+ $hylb=Db::name('type')->where('type_type',1)->select();
+ $this->assign('hylb', $hylb);
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type',54)->find();
+ $this->assign('ssbk', $ssbk);
+ //地区类型
+ $dqlx=Db::name('type')->where('type_type',2)->select();
+ $this->assign('dqlx', $dqlx);
+ //资本额度
+ $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select();
+ $this->assign('zbed', $zbed);
+ //公告分类
+ $gglb=Db::name('type')->where('type_type',55)->select();
+ $this->assign('gglb', $gglb);
+ //类别
+ $lb=Db::name('type')->where('type_type',56)->select();
+ $this->assign('lb', $lb);
+ $gy_time=time();
+ $this->assign('gy_time', $gy_time);
+ return $this->fetch('gy_add');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gy_list'));
+ }
+ }
+ //多图
+ if ($files) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gy_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $ssbk = input('c_ssbk',1,'intval');
+ $business_type= input('c_business_type',1,'intval');
+ $qyfzjd = input('c_qyfzjd',1,'intval');
+ if($ssbk!=1){
+ $business_type=0;
+ $qyfzjd=0;
+ }
+ $sl_data=array(
+ 'c_name'=>input('c_name'),
+ 'c_project_code'=>input('c_project_code'),
+ 'c_ggxs'=>input('c_ggxs'),
+ 'c_transaction_type'=>input('c_transaction_type'),
+ 'c_bdname'=>input('c_bdname'),
+ 'c_valuation'=>input('c_valuation'),
+ 'c_type'=>input('c_type'),
+ 'c_gpprice'=>input('c_gpprice'),
+ 'c_jcname'=>input('c_jcname',''),
+ 'c_code'=>input('c_code'),
+ 'c_desc'=>input('c_desc'),
+ 'c_homepage'=>input('c_homepage',''),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(),
+ 'c_status'=>input('c_status',0),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_logo'=>$img_one,
+ 'c_pics'=>$picall_url,
+ 'c_time'=>time(),
+ 'c_uid'=>session('admin_auth.aid'),
+ 'c_ssbk'=>input('c_ssbk',1,'intval'),
+ 'c_dqlx'=>input('c_dqlx',1,'intval'),
+ 'c_hylb'=>input('c_hylb',1,'intval'),
+ 'c_zbed'=>input('c_zbed',1,'intval')
+ );
+ $rst=Db::name('gyxm')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Gpgl/gy_list'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/gy_list'));
+ }
+ }
+ }
+
+
+ /**
+ * 国有项目修改
+ */
+ public function gy_edit()
+ {
+ if(!request()->isAjax()) {
+ $c_id = input('c_id', 0, 'intval');
+ if (!$c_id) $this->error('参数错误', url('admin/Gpgl/gy_list'));
+ $gp_list = Db::name('gyxm')->where('c_id', $c_id)->find();
+ $this->assign('gp_list', $gp_list);
+ //多图字符串转换成数组
+ $pic_list = array_filter(explode(",", $gp_list['c_pics']));
+ $this->assign('pic_list', $pic_list);
+ //行业类别
+ $hylb=Db::name('type')->where('type_type',1)->select();
+ $this->assign('hylb', $hylb);
+ //所属板块
+ $ssbk=Db::name('type')->where('type_type',54)->select();
+ $this->assign('ssbk', $ssbk);
+ //地区类型
+ $dqlx=Db::name('type')->where('type_type',2)->select();
+ $this->assign('dqlx', $dqlx);
+ //资本额度
+ $zbed=Db::name('type')->where('type_type',3)->order('type_order')->select();
+ $this->assign('zbed', $zbed);
+ //公告分类
+ $gglb=Db::name('type')->where('type_type',55)->select();
+ $this->assign('gglb', $gglb);
+ //类别
+ $lb=Db::name('type')->where('type_type',56)->select();
+ $this->assign('lb', $lb);
+ return $this->fetch('gy_edit');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gy_list'));
+ }
+ }
+ //多图
+ if ($files) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gy_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ $ssbk = input('c_ssbk',1,'intval');
+ $business_type= input('c_business_type',1,'intval');
+ $qyfzjd = input('c_qyfzjd',1,'intval');
+ if($ssbk!=1){
+ $business_type=0;
+ $qyfzjd=0;
+ }
+ $sl_data=array(
+ 'c_id'=>input('c_id'),
+ 'c_name'=>input('c_name'),
+ 'c_project_code'=>input('c_project_code'),
+ 'c_ggxs'=>input('c_ggxs'),
+ 'c_transaction_type'=>input('c_transaction_type'),
+ 'c_bdname'=>input('c_bdname'),
+ 'c_valuation'=>input('c_valuation'),
+ 'c_type'=>input('c_type'),
+ 'c_gpprice'=>input('c_gpprice'),
+ 'c_jcname'=>input('c_jcname'),
+ 'c_code'=>input('c_code'),
+ 'c_desc'=>input('c_desc'),
+ 'c_homepage'=>input('c_homepage'),
+ 'c_gptime'=>input('c_gptime','')?strtotime(input('c_gptime','')):time(),
+ 'c_cltime'=>input('c_cltime','')?strtotime(input('c_cltime','')):time(),
+ 'c_status'=>input('c_status',0),
+ 'c_content'=>htmlspecialchars_decode(input('c_content')),
+ 'c_order'=>input('c_order',50,'intval'),
+ 'c_pics'=>$picall_url,
+ 'c_time'=>time(),
+ 'c_uid'=>session('admin_auth.aid'),
+ 'c_ssbk'=>input('c_ssbk',1,'intval'),
+ 'c_dqlx'=>input('c_dqlx',1,'intval'),
+ 'c_hylb'=>input('c_hylb',1,'intval'),
+ 'c_zbed'=>input('c_zbed',1,'intval')
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['c_logo']=$img_one;
+ }
+ $sl_data['c_pics']=input('pic_oldlist').$picall_url;
+ $rst=Db::name('gyxm')->update($sl_data);
+
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Gpgl/gy_list'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/gy_list'));
+ }
+ }
+ }
+
+ /**
+ * 国有项目状态修改
+ */
+ public function gy_state()
+ {
+ $id=input('x');
+ $status=Db::name('gyxm')->where(array('c_id'=>$id))->value('c_status');
+ if($status==1){
+ $statedata = array('c_status'=>0);
+ Db::name('gyxm')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('c_status'=>1);
+ Db::name('gyxm')->where(array('c_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+
+ /**
+ * 国有项排序
+ */
+ public function gy_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Gpgl/gy_list'));
+ }else{
+ foreach (input('post.') as $c_id => $c_order){
+ Db::name('gyxm')->update(['c_id'=>$c_id,'c_order'=>$c_order]);
+ }
+ $this->success('排序更新成功',url('admin/Gpgl/gy_list'));
+ }
+ }
+
+
+ /**
+ * 文化四版挂牌删除(单个)
+ */
+ public function gy_del()
+ {
+ $p=input('p');
+ $rst=Db::name('gyxm')->delete(input('c_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/gy_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/gy_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 文化四版删除挂牌(全选)
+ */
+ public function gy_alldel()
+ {
+ $p = input('p');
+ $ids = input('c_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Gpgl/gy_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'c_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'c_id='.$ids;
+ }
+ $rst=Db::name('gyxm')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Gpgl/gy_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/gy_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 鉴定评估中心检测报告
+ * @return mixed|string
+ */
+ public function verify(Request $request){
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+ $page=$request->param('page');
+
+ $db=Db::name('artverify');
+ if($search_name){
+ $db->where('name','like','%'.$search_name.'%');
+ }
+ $gp_list=$db->order('id desc,create_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $gp_list->render();
+ $this->assign('page',$page);
+ $this->assign('pageshow',$show);
+ $this->assign('list',$gp_list);
+ return $this->fetch('gpgl/verify');
+ }
+
+ public function verify_add(){
+ if(request()->isAjax()) {
+ $idno=input('idno');
+ $gpdate=input('gp_date');
+ $check=Db::name('artverify')->where(['idno'=>$idno])->count();
+ if($check){
+ $this->error('此证书编号已存在');
+ }
+ $sl_data=array(
+ 'name'=>input('name'),
+ 'mobile'=>input('mobile'),
+ 'poster'=>input('poster'),
+ 'ower'=>input('ower'),
+ 'cardno'=>input('cardno'),
+ 'idno'=>$idno,
+ 'reporturl'=>input('reporturl'),
+ 'create_time'=>time(),
+ 'update_time'=>time(),
+ 'status'=>input('status',0),
+ 'gp_date'=>$gpdate?strtotime($gpdate):''
+ );
+ $id=Db::name('artverify')->insert($sl_data,false,true);
+ if($id){
+ if($id){
+ $url =SITE_PATH.url('/listn/verify',['id'=>$id]); //二维码内容
+ $qrcode=$this->createqr($url,$idno);
+ $barcode=$this->barcode($idno);
+ Db::name('artverify')->where(['id'=>$id])->update(['qrcode'=>$qrcode,'barcode'=>$barcode]);
+ }
+ $this->success('增加成功',url('admin/Gpgl/verify'));
+ }else{
+ $this->error('增加失败',url('admin/Gpgl/verify'));
+ }
+ }
+ return $this->fetch('gpgl/verify_add');
+ }
+ protected function createqr($url,$name){
+ $errorCorrectionLevel = 'L';//容错级别
+ $matrixPointSize = 6;//生成图片大小
+ //生成二维码图片
+ $file=ROOT_PATH.'extend'.DS.'phpqrcode'.DS.'phpqrcode.php';
+ include($file);
+
+ $path=config('upload_path').'/verifyqr/';
+ $file=$path.$name.'.png';
+
+ if(!is_dir('.'.$path))@mkdir('.'.$path,0755,true);
+ $filepath='.'.$file;
+ if(!file_exists($filepath)){
+ touch($filepath);
+ \QRcode::png($url, '.'.$file, $errorCorrectionLevel, $matrixPointSize, 2);
+ $logo =false;//准备好的logo图片 需要加入到二维码中的logo
+ $QR=$filepath;//已经生成的原始二维码图
+ $QR = imagecreatefromstring(file_get_contents($QR));
+ if ($logo !== FALSE) {
+ $logo = imagecreatefromstring(file_get_contents($logo));
+ $QR_width =imagesx($QR);//二维码图片宽度
+ $QR_height =imagesy($QR);//二维码图片高度
+ $logo_width =imagesx($logo);//logo图片宽度
+ $logo_height =imagesy($logo);//logo图片高度
+ $logo_qr_width = $QR_width / 5;
+ $scale = $logo_width/$logo_qr_width;
+ $logo_qr_height = $logo_height/$scale;
+ $from_width = ($QR_width - $logo_qr_width) / 2;
+ //重新组合图片并调整大小
+ imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width,$logo_qr_height, $logo_width, $logo_height);
+ }
+ //输出图片
+ imagepng($QR,$filepath);
+ }
+ return $file;
+ }
+ public function verify_edit(){
+ $id=input('id');
+ if(request()->isAjax()) {
+ $gpdate=input('gp_date');
+ $idno=input('idno');
+ $id=input('id');
+ $check=Db::name('artverify')->where(['idno'=>$idno,'id'=>['neq',$id]])->count();
+ if($check){
+ $this->error('此证书编号已存在');
+ }
+ $sl_data=array(
+ 'id'=>$id,
+ 'name'=>input('name'),
+ 'mobile'=>input('mobile'),
+ 'poster'=>input('poster'),
+ 'ower'=>input('ower'),
+ 'userid'=>input('userid'),
+ 'cardno'=>input('cardno'),
+ 'idno'=>$idno,
+ 'reporturl'=>input('reporturl'),
+ 'create_time'=>time(),
+ 'update_time'=>time(),
+ 'status'=>input('status',0),
+ 'gp_date'=>$gpdate?strtotime($gpdate):''
+ );
+ if($id){
+ $url =SITE_PATH.url('/listn/verify',['id'=>$id]); //二维码内容
+ $qrcode=$this->createqr($url,$idno);
+ $barcode=$this->barcode($idno);
+ if($qrcode)$sl_data['qrcode']=$qrcode;
+ if($barcode)$sl_data['barcode']=$barcode;
+ }
+ $rst=Db::name('artverify')->update($sl_data);
+ if($rst){
+ $this->success('修改成功',url('admin/Gpgl/verify'));
+ }else{
+ $this->error('修改失败',url('admin/Gpgl/verify'));
+ }
+ }else{
+ $user_list = Db::query("SELECT member_list_username,member_list_id,member_list_nickname,member_list_tel FROM `".config('database.prefix')."member_list` WHERE member_list_groupid=1 or member_list_groupid=5 order by member_list_id desc");
+ $this->assign('user_list',$user_list);
+ $gp_list = Db::name('artverify')->where('id', $id)->find();
+ $this->assign('item', $gp_list);
+ }
+ return $this->fetch('gpgl/verify_edit');
+ }
+
+ /**
+ * 文化四版挂牌删除(单个)
+ */
+ public function verify_del()
+ {
+ $rst=Db::name('artverify')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Gpgl/verify'));
+ }else{
+ $this -> error("删除失败!",url('admin/Gpgl/verify'));
+ }
+ }
+ private function barcode($sn){
+ include ROOT_PATH.'/extend/Barcode.php';
+ $path=config('upload_path').'/verifyqr/';
+ $file=$path.$sn.'_barcode.png';
+ if(!is_dir('.'.$path))@mkdir('.'.$path,0755,true);
+ $filepath='.'.$file;
+ if(!file_exists($filepath)){
+ \Barcode::code39($sn,$filepath);
+ }
+ return $file;
+ }
+}
diff --git a/app/admin/controller/Gyzc.php b/app/admin/controller/Gyzc.php
new file mode 100644
index 0000000..d852995
--- /dev/null
+++ b/app/admin/controller/Gyzc.php
@@ -0,0 +1,70 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Gyzc extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='gyzc';
+ $this->controller_name='Gyzc';
+ $this->has_source=false;
+ $this->has_imgs=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function gyzc_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function gyzc_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function gyzc_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function gyzc_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function gyzc_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function gyzc_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function gyzc_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Help.php b/app/admin/controller/Help.php
new file mode 100644
index 0000000..a3a949e
--- /dev/null
+++ b/app/admin/controller/Help.php
@@ -0,0 +1,17 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Help extends Base
+{
+ public function soft()
+ {
+ return $this->fetch();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Hyzq.php b/app/admin/controller/Hyzq.php
new file mode 100644
index 0000000..2333f23
--- /dev/null
+++ b/app/admin/controller/Hyzq.php
@@ -0,0 +1,168 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Hyzq extends Base
+{
+ /**
+ * 栏目列表
+ */
+ public function hyzq_list()
+ {
+ $cu_cid=input('cid',0,'intval');
+ $hyzqs=Db::name('hyzq')->where('cu_cid',$cu_cid)->order('cu_order,cu_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $hyzqs->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('cu_cid',$cu_cid);
+ $this->assign('hyzqs',$hyzqs);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_hyzq_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function hyzq_add()
+ {
+ $cu_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $this->assign('cu_cid',$cu_cid);
+ return $this->fetch();
+ }else{
+ $sl_data=array(
+ 'cu_order'=>input('cu_order',50,'intval'),
+ 'cu_status'=>input('cu_status',0),
+ 'cu_uid'=>session('admin_auth.aid'),
+ 'cu_time'=>time(),
+ 'cu_content'=>htmlspecialchars_decode(input('cu_content')),
+ 'cu_title'=>input('cu_title'),
+ 'cu_cid'=>$cu_cid
+ );
+ $rst=Db::name('hyzq')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }else{
+ $this->error('添加失败',url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function hyzq_edit()
+ {
+ $cu_cid=input('cid',0,'intval');
+ if (!request()->isAjax()) {
+ $d_id = input('cu_id');
+ if (empty($d_id)) {
+ $this->error('参数错误', url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }
+ $hyzq_list = Db::name('hyzq')->find($d_id);
+ $this->assign('hyzq_list', $hyzq_list);
+ $this->assign('cu_cid',$cu_cid);
+ return $this->fetch();
+ }else{
+ $sl_data=array(
+ 'cu_id'=>input('cu_id'),
+ 'cu_order'=>input('cu_order',50,'intval'),
+ 'cu_status'=>input('cu_status',0),
+ 'cu_content'=>htmlspecialchars_decode(input('cu_content')),
+ 'cu_title'=>input('cu_title')
+ );
+ $rst=Db::name('hyzq')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }else{
+ $this->error('修改失败',url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function hyzq_del()
+ {
+ $cu_cid=input('cid',0,'intval');
+ $p=input('p');
+ $rst=Db::name('hyzq')->delete(input('cu_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/hyzq/hyzq_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/hyzq/hyzq_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function hyzq_alldel()
+ {
+ $p = input('p');
+ $ids = input('cu_id/a');
+ $cu_cid=input('cid',0,'intval');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/hyzq/hyzq_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ if(is_array($ids)){
+ $where = 'cu_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'cu_id='.$ids;
+ }
+ $rst=Db::name('hyzq')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/hyzq/hyzq_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/hyzq/hyzq_list',array('p'=>$p,'cid'=>$cu_cid)));
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function hyzq_state()
+ {
+ $id=input('x');
+ $status=Db::name('hyzq')->where(array('cu_id'=>$id))->value('cu_status');
+ if($status==1){
+ $statedata = array('cu_status'=>0);
+ Db::name('hyzq')->where(array('cu_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('cu_status'=>1);
+ Db::name('hyzq')->where(array('cu_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+ /**
+ * 排序
+ */
+ public function hyzq_order()
+ {
+ $cu_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ if($cu_cid){
+ $this->error('提交方式不正确', url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }else{
+ $this->error('提交方式不正确', url('admin/hyzq/hyzq_list'));
+ }
+ }else{
+ foreach (input('post.') as $cu_id => $cu_order){
+ Db::name('hyzq')->update(['cu_id'=>$cu_id,'cu_order'=>$cu_order]);
+ }
+ if($cu_cid){
+ $this->success('排序更新成功',url('admin/hyzq/hyzq_list',['cid'=>$cu_cid]));
+ }else{
+ $this->success('排序更新成功',url('admin/hyzq/hyzq_list'));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Index.php b/app/admin/controller/Index.php
new file mode 100644
index 0000000..55ecaa2
--- /dev/null
+++ b/app/admin/controller/Index.php
@@ -0,0 +1,52 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Cache;
+use think\helper\Time;
+use app\admin\model\News as NewsModel;
+use app\admin\model\MemberList;
+
+class Index extends Base
+{
+ /**
+ * 后台首页
+ */
+ public function index()
+ {
+ //渲染模板
+ return $this->fetch();
+ }
+ /**
+ * 后台多语言切换
+ */
+ public function lang()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确');
+ }else{
+ $lang=input('lang_s');
+ session('login_http_referer',$_SERVER["HTTP_REFERER"]);
+ switch ($lang) {
+ case 'cn':
+ cookie('think_var', 'zh-cn');
+ break;
+ case 'en':
+ cookie('think_var', 'en-us');
+ break;
+ //其它语言
+ default:
+ cookie('think_var', 'zh-cn');
+ }
+ Cache::clear();
+ $this->success('切换成功',session('login_http_referer'));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Join.php b/app/admin/controller/Join.php
new file mode 100644
index 0000000..0b632ef
--- /dev/null
+++ b/app/admin/controller/Join.php
@@ -0,0 +1,100 @@
+where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+
+ return $this->fetch();
+ }
+
+
+ /**
+ * 修改
+ */
+ public function edit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('joinus')->find(input('admin_id'));
+ $this->assign('list',$list);
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedit()
+ {
+
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+
+ $data=[];
+ $data['state']=input('state');
+ $id=input('id');
+ $rst=Db::name('joinus')->where(['id'=>$id])->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('Join/index',['kind'=>$kind]));
+ }else{
+ $this->error('修改失败',url('Join/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('Join/index',['kind'=>$kind]));
+ }
+ $rst=Db::name('joinus')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('Join/index',['kind'=>$kind]));
+ }else{
+ $this->error('删除失败',url('Join/index',['kind'=>$kind]));
+ }
+ }
+
+
+ /**
+ * 审核/取消审核
+ */
+ public function state()
+ {
+ $id=input('x');
+ $find=Db::name('joinus')->where(array('id'=>$id))->find();
+ $msg='未审';
+ if($find){
+ $status=$find['state'];
+ if($status==1){
+ $statedata = array('state'=>0);
+ }else{
+ $statedata = array('state'=>1);
+ $msg='已审';
+ }
+ $query=Db::name('joinus')->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Lcgyxm.php b/app/admin/controller/Lcgyxm.php
new file mode 100644
index 0000000..1861cb0
--- /dev/null
+++ b/app/admin/controller/Lcgyxm.php
@@ -0,0 +1,164 @@
+order('gyxm_sort,gyxm_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $gyxm_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('gyxm_list',$gyxm_list);
+ if(request()->isAjax()){
+ return $this->fetch('lcgyxm/ajax_lc_gyxm_list');
+ }else{
+ return $this->fetch('lcgyxm/lc_gyxm_list');
+ }
+ }
+
+ /**
+ * 增加
+ */
+ public function gyxm_add()
+ {
+ if(!request()->isAjax()) {
+ return $this->fetch('lcgyxm/lc_gyxm_add');
+ }else{
+
+ $sl_data=array(
+ 'gyxm_name'=>input('gyxm_name'),
+ 'gyxm_price'=>input('gyxm_price'),
+ 'gyxm_pstatus'=>input('gyxm_pstatus'),
+ 'gyxm_uptime'=>input('gyxm_uptime','')?strtotime(input('gyxm_uptime','')):time(),
+ 'gyxm_status'=>input('gyxm_status',0),
+ 'gyxm_sort'=>input('gyxm_sort'),
+ 'gyxm_content'=>htmlspecialchars_decode(input('gyxm_content')),
+ 'gyxm_time'=>time(),
+ 'gyxm_uid'=>session('admin_auth.aid'),
+ );
+ $rst=Db::name('lc_gyxm')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Lcgyxm/gyxm_list'));
+ }else{
+ $this->error('增加失败',url('admin/Lcgyxm/gyxm_list'));
+ }
+ }
+ }
+
+ /**
+ * 修改
+ */
+ public function gyxm_edit()
+ {
+ if(!request()->isAjax()) {
+ $gyxm_id = input('gyxm_id', 0, 'intval');
+ if (!$gyxm_id) $this->error('参数错误', url('admin/Lcgyxm/gyxm_list'));
+ $gyxm_list = Db::name('lc_gyxm')->where('gyxm_id', $gyxm_id)->find();
+ $this->assign('gyxm_list',$gyxm_list);
+ return $this->fetch('lcgyxm/lc_gyxm_edit');
+ }else{
+
+ $sl_data=array(
+ 'gyxm_id'=>input('gyxm_id'),
+ 'gyxm_name'=>input('gyxm_name'),
+ 'gyxm_price'=>input('gyxm_price'),
+ 'gyxm_pstatus'=>input('gyxm_pstatus'),
+ 'gyxm_uptime'=>input('gyxm_uptime','')?strtotime(input('gyxm_uptime','')):time(),
+ 'gyxm_status'=>input('gyxm_status',0),
+ 'gyxm_sort'=>input('gyxm_sort'),
+ 'gyxm_content'=>htmlspecialchars_decode(input('gyxm_content')),
+ 'gyxm_time'=>time(),
+ 'gyxm_uid'=>session('admin_auth.aid'),
+ );
+ $rst=Db::name('lc_gyxm')->update($sl_data);
+
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcgyxm/gyxm_list'));
+ }else{
+ $this->error('修改失败',url('admin/Lcgyxm/gyxm_list'));
+ }
+ }
+ }
+
+ /**
+ * 排序
+ */
+ public function gyxm_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Lcgyxm/gyxm_list'));
+ }else{
+ foreach (input('post.') as $gyxm_id => $gyxm_sort){
+ Db::name('lc_gyxm')->update(['gyxm_id'=>$gyxm_id,'gyxm_sort'=>$gyxm_sort]);
+ }
+ $this->success('排序更新成功',url('admin/Lcgyxm/gyxm_list'));
+ }
+ }
+
+ /**
+ * 删除(单个)
+ */
+ public function gyxm_del()
+ {
+ $p=input('p');
+ $rst=Db::name('lc_gyxm')->delete(input('gyxm_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Lcgyxm/gyxm_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcgyxm/gyxm_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 删除(全选)
+ */
+ public function gyxm_alldel()
+ {
+ $p = input('p');
+ $ids = input('gyxm_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcgyxm/gyxm_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'gyxm_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'gyxm_id='.$ids;
+ }
+ $rst=Db::name('lc_gyxm')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcgyxm/gyxm_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcgyxm/gyxm_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 状态修改
+ */
+ public function gyxm_state()
+ {
+ $id=input('x');
+ $status=Db::name('lc_gyxm')->where(array('gyxm_id'=>$id))->value('gyxm_status');
+ if($status==1){
+ $statedata = array('gyxm_status'=>0);
+ Db::name('lc_gyxm')->where(array('gyxm_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('gyxm_status'=>1);
+ Db::name('lc_gyxm')->where(array('gyxm_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Lcmanager.php b/app/admin/controller/Lcmanager.php
new file mode 100644
index 0000000..865c1de
--- /dev/null
+++ b/app/admin/controller/Lcmanager.php
@@ -0,0 +1,976 @@
+order('p_sort,p_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $mansion_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('mansion_list',$mansion_list);
+ if(request()->isAjax()){
+ return $this->fetch('lcmanager/ajax_lc_mansion_list');
+ }else{
+ return $this->fetch('lcmanager/lc_mansion_list');
+ }
+ }
+
+ /**
+ * 公馆增加
+ */
+ public function mansion_add()
+ {
+ if(!request()->isAjax()) {
+ return $this->fetch('lcmanager/lc_mansion_add');
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_gg')->where(array('p_status'=>1))->count();
+
+ if($count<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_name'=>input('p_name'),
+ 'p_ysj'=>input('p_ysj'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_logo'=>$img_one,
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ $rst=Db::name('lc_gg')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Lcmanager/mansion_list'));
+ }else{
+ $this->error('增加失败',url('admin/Lcmanager/mansion_list'));
+ }
+ }
+ }
+
+ /**
+ * 公馆修改
+ */
+ public function mansion_edit()
+ {
+ if(!request()->isAjax()) {
+ $p_id = input('p_id', 0, 'intval');
+ if (!$p_id) $this->error('参数错误', url('admin/Lcmanager/mansion_list'));
+ $mansion_list = Db::name('lc_gg')->where('p_id', $p_id)->find();
+ $this->assign('mansion_list',$mansion_list);
+ return $this->fetch('lcmanager/lc_mansion_edit');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_gg')->where(array('p_status'=>1))->count();
+ if($count<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_id'=>input('p_id'),
+ 'p_name'=>input('p_name'),
+ 'p_ysj'=>input('p_ysj'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ if(!empty($img_one)){
+ $sl_data['p_logo']=$img_one;
+ }
+ $rst=Db::name('lc_gg')->update($sl_data);
+
+ $countTow=Db::name('lc_gg')->where(array('p_status'=>1))->count();
+ if($countTow>4){
+ $rst=Db::name('lc_gg')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcmanager/mansion_list'));
+ }else{
+ $this->error('修改失败',url('admin/Lcmanager/mansion_list'));
+ }
+ }
+ }
+
+ /**
+ * 公馆排序
+ */
+ public function mansion_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Lcmanager/mansion_list'));
+ }else{
+ foreach (input('post.') as $p_id => $p_sort){
+ Db::name('lc_gg')->update(['p_id'=>$p_id,'p_sort'=>$p_sort]);
+ }
+ $this->success('排序更新成功',url('admin/Lcmanager/mansion_list'));
+ }
+ }
+
+ /**
+ * 公馆删除(单个)
+ */
+ public function mansion_del()
+ {
+ $p=input('p');
+ $rst=Db::name('lc_gg')->delete(input('p_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Lcmanager/mansion_list',array('p' => $p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcmanager/mansion_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 公馆删除(全选)
+ */
+ public function mansion_alldel()
+ {
+ $p = input('p');
+ $ids = input('p_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcmanager/mansion_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'p_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'p_id='.$ids;
+ }
+ $rst=Db::name('lc_gg')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcmanager/mansion_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcmanager/mansion_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 公馆状态修改
+ */
+ public function mamsion_state()
+ {
+ $id=input('x');
+ $status=Db::name('lc_gg')->where(array('p_id'=>$id))->value('p_status');
+ $count=Db::name('lc_gg')->where(array('p_status'=>1))->count();
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_gg')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($count<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_gg')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/mansion_list'));
+ }
+
+ }
+ }
+
+ /**
+ * 楼层艺拍列表
+ */
+ public function making_list()
+ {
+ $making_list=Db::name('lc_yp')->order('p_sort,p_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $making_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('making_list',$making_list);
+ if(request()->isAjax()){
+ return $this->fetch('lcmanager/ajax_lc_making_list');
+ }else{
+ return $this->fetch('lcmanager/lc_making_list');
+ }
+ }
+
+
+ /**
+ * 艺拍增加
+ */
+ public function making_add()
+ {
+ if(!request()->isAjax()) {
+ //艺拍分类
+ $yplb=Db::name('type')->where('type_type',57)->select();
+ $this->assign('yplb', $yplb);
+ return $this->fetch('lcmanager/lc_making_add');
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+
+ //根据选择类别修改
+ /*$p_type=Db::name('lc_gg')->where(array('p_id'=>$p_id))->value('p_type');*/
+ $countp=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>80))->count();//艺品拍
+ $countx=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>81))->count();//艺享拍
+ $countb=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>82))->count();//艺版拍
+ $p_type=input('p_type');
+ if($p_type==80){
+ if($countp<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }else if($p_type==81){
+ if($countx<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }else if($p_type==82){
+ if($countb<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }
+
+ $sl_data=array(
+ 'p_name'=>input('p_name'),
+ 'p_sprice'=>input('p_sprice'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_endtime'=>input('p_endtime','')?strtotime(input('p_endtime','')):time(),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_type'=>input('p_type'),
+ 'p_count'=>input('p_count'),
+ 'p_time'=>time(),
+ 'p_logo'=>$img_one,
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ $rst=Db::name('lc_yp')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Lcmanager/making_list'));
+ }else{
+ $this->error('增加失败',url('admin/Lcmanager/making_list'));
+ }
+ }
+ }
+
+ /**
+ * 艺拍修改
+ */
+ public function making_edit()
+ {
+ if(!request()->isAjax()) {
+ $p_id = input('p_id', 0, 'intval');
+ if (!$p_id) $this->error('参数错误', url('admin/Lcmanager/making_list'));
+ $making_list = Db::name('lc_yp')->where('p_id', $p_id)->find();
+ $this->assign('making_list',$making_list);
+ //艺拍分类
+ $yplb=Db::name('type')->where('type_type',57)->select();
+ $this->assign('yplb', $yplb);
+ return $this->fetch('lcmanager/lc_making_edit');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ //根据选择类别修改
+ /*$p_type=Db::name('lc_gg')->where(array('p_id'=>$p_id))->value('p_type');*/
+ $countp=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>80))->count();//艺品拍
+ $countx=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>81))->count();//艺享拍
+ $countb=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>82))->count();//艺版拍
+ $p_type=input('p_type');
+ if($p_type==80){
+ if($countp<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }else if($p_type==81){
+ if($countx<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }else if($p_type==82){
+ if($countb<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ }
+
+ $sl_data=array(
+ 'p_id'=>input('p_id'),
+ 'p_name'=>input('p_name'),
+ 'p_sprice'=>input('p_sprice'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_type'=>input('p_type'),
+ 'p_count'=>input('p_count'),
+ 'p_endtime'=>input('p_endtime','')?strtotime(input('p_endtime','')):time(),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ if(!empty($img_one)){
+ $sl_data['p_logo']=$img_one;
+ }
+ $rst=Db::name('lc_yp')->update($sl_data);
+
+ $countp=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>80))->count();//艺品拍
+ $countx=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>81))->count();//艺享拍
+ $countb=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>82))->count();//艺版拍
+ if($p_type==80){
+ if($countp>4){
+ $rst=Db::name('lc_yp')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ }else if($p_type==81){
+ if($countx>4){
+ $rst=Db::name('lc_yp')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ }else if($p_type==82){
+ if($countb>4){
+ $rst=Db::name('lc_yp')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ }
+
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcmanager/making_list'));
+ }else{
+ $this->error('修改失败',url('admin/Lcmanager/making_list'));
+ }
+ }
+ }
+
+ /**
+ * 艺拍排序
+ */
+ public function making_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Lcmanager/making_list'));
+ }else{
+ foreach (input('post.') as $p_id => $p_sort){
+ Db::name('lc_yp')->update(['p_id'=>$p_id,'p_sort'=>$p_sort]);
+ }
+ $this->success('排序更新成功',url('admin/Lcmanager/making_list'));
+ }
+ }
+
+ /**
+ * 艺拍删除(单个)
+ */
+ public function making_del()
+ {
+ $p = input('p');
+ $rst = Db::name('lc_yp')->delete(input('p_id'));
+ if ($rst !== false) {
+ $this->success('删除成功', url('admin/Lcmanager/making_list', array('p' => $p)));
+ } else {
+ $this->error("删除失败!", url('admin/Lcmanager/making_list', array('p' => $p)));
+ }
+ }
+
+ /**
+ * 艺拍删除(全选)
+ */
+ public function making_alldel()
+ {
+ $p = input('p');
+ $ids = input('p_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcmanager/making_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'p_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'p_id='.$ids;
+ }
+ $rst=Db::name('lc_yp')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcmanager/making_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcmanager/making_list',array('p'=>$p)));
+ }
+ }
+
+
+ /**
+ * 艺拍状态修改
+ */
+ public function making_state()
+ {
+ $id=input('x');
+ $status=Db::name('lc_yp')->where(array('p_id'=>$id))->value('p_status');
+ //根据选择类别修改
+ $p_type=Db::name('lc_yp')->where(array('p_id'=>$id))->value('p_type');
+
+ $countp=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>80))->count();//艺品拍
+ $countx=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>81))->count();//艺享拍
+ $countb=Db::name('lc_yp')->where(array('p_status'=>1,'p_type'=>82))->count();//艺版拍
+
+ if($p_type==80){
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($countp<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/mansion_list'));
+ }
+ }
+ }else if($p_type==81){
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($countx<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/mansion_list'));
+ }
+ }
+ }else if($p_type==82){
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($countb<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_yp')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/mansion_list'));
+ }
+ }
+ }
+ }
+
+ /**
+ * 楼层商城列表
+ */
+ public function shopping_list()
+ {
+ $shopping_list=Db::name('lc_sc')->order('p_sort,p_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $shopping_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('shopping_list',$shopping_list);
+ if(request()->isAjax()){
+ return $this->fetch('lcmanager/ajax_lc_shopping_list');
+ }else{
+ return $this->fetch('lcmanager/lc_shopping_list');
+ }
+ }
+
+ /**
+ * 商城增加
+ */
+ public function shopping_add()
+ {
+ if(!request()->isAjax()) {
+ return $this->fetch('lcmanager/lc_shopping_add');
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_sc')->where(array('p_status'=>1))->count();
+
+ if($count<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_name'=>input('p_name'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_logo'=>$img_one,
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ $rst=Db::name('lc_sc')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Lcmanager/shopping_list'));
+ }else{
+ $this->error('增加失败',url('admin/Lcmanager/shopping_list'));
+ }
+ }
+ }
+
+ /**
+ * 商城修改
+ */
+ public function shopping_edit()
+ {
+ if(!request()->isAjax()) {
+ $p_id = input('p_id', 0, 'intval');
+ if (!$p_id) $this->error('参数错误', url('admin/Lcmanager/shopping_list'));
+ $shopping_list = Db::name('lc_sc')->where('p_id', $p_id)->find();
+ $this->assign('shopping_list',$shopping_list);
+ return $this->fetch('lcmanager/lc_shopping_edit');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_sc')->where(array('p_status'=>1))->count();
+ if($count<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_id'=>input('p_id'),
+ 'p_name'=>input('p_name'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ if(!empty($img_one)){
+ $sl_data['p_logo']=$img_one;
+ }
+ $rst=Db::name('lc_sc')->update($sl_data);
+
+ $countTow=Db::name('lc_sc')->where(array('p_status'=>1))->count();
+ if($countTow>4){
+ $rst=Db::name('lc_sc')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcmanager/shopping_list'));
+ }else{
+ $this->error('修改失败',url('admin/Lcmanager/shopping_list'));
+ }
+ }
+ }
+
+ /**
+ * 商城排序
+ */
+ public function shopping_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Lcmanager/shopping_list'));
+ }else{
+ foreach (input('post.') as $p_id => $p_sort){
+ Db::name('lc_sc')->update(['p_id'=>$p_id,'p_sort'=>$p_sort]);
+ }
+ $this->success('排序更新成功',url('admin/Lcmanager/shopping_list'));
+ }
+ }
+
+ /**
+ * 商城删除(单个)
+ */
+ public function shopping_del()
+ {
+ $p = input('p');
+ $rst = Db::name('lc_sc')->delete(input('p_id'));
+ if ($rst !== false) {
+ $this->success('删除成功', url('admin/Lcmanager/shopping_list', array('p' => $p)));
+ } else {
+ $this->error("删除失败!", url('admin/Lcmanager/shopping_list', array('p' => $p)));
+ }
+ }
+
+ /**
+ * 商城删除(全选)
+ */
+ public function shopping_alldel()
+ {
+ $p = input('p');
+ $ids = input('p_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcmanager/shopping_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'p_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'p_id='.$ids;
+ }
+ $rst=Db::name('lc_sc')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcmanager/shopping_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcmanager/shopping_list',array('p'=>$p)));
+ }
+ }
+
+
+ /**
+ * 商城状态修改
+ */
+ public function shopping_state()
+ {
+ $id=input('x');
+ $status=Db::name('lc_sc')->where(array('p_id'=>$id))->value('p_status');
+ $count=Db::name('lc_sc')->where(array('p_status'=>1))->count();
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_sc')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($count<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_sc')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/shopping_list'));
+ }
+
+ }
+ }
+
+ /**
+ * 楼层投行列表
+ */
+ public function bank_list()
+ {
+ $bank_list=Db::name('lc_th')->order('p_sort,p_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $bank_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('bank_list',$bank_list);
+ if(request()->isAjax()){
+ return $this->fetch('lcmanager/ajax_lc_bank_list');
+ }else{
+ return $this->fetch('lcmanager/lc_bank_list');
+ }
+ }
+
+ /**
+ *投行增加
+ */
+ public function bank_add()
+ {
+ if(!request()->isAjax()) {
+ return $this->fetch('lcmanager/lc_bank_add');
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_th')->where(array('p_status'=>1))->count();
+
+ if($count<4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_name'=>input('p_name'),
+ 'p_price'=>input('p_price'),
+ 'p_url'=>input('p_url'),
+ 'p_jd'=>input('p_jd'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_logo'=>$img_one,
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ $rst=Db::name('lc_th')->insert($sl_data);
+ if($rst){
+ $this->success('增加成功',url('admin/Lcmanager/bank_list'));
+ }else{
+ $this->error('增加失败',url('admin/Lcmanager/bank_list'));
+ }
+ }
+ }
+
+ /**
+ * 投行修改
+ */
+ public function bank_edit()
+ {
+ if(!request()->isAjax()) {
+ $p_id = input('p_id', 0, 'intval');
+ if (!$p_id) $this->error('参数错误', url('admin/Lcmanager/bank_list'));
+ $bank_list = Db::name('lc_th')->where('p_id', $p_id)->find();
+ $this->assign('bank_list',$bank_list);
+ return $this->fetch('lcmanager/lc_bank_edit');
+ }else{
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcmanager/making_list'));
+ }
+ }
+ $count=Db::name('lc_th')->where(array('p_status'=>1))->count();
+ if($count<=4){
+ $status =input('p_status',0);
+ }else{
+ $status =0;
+ }
+ $sl_data=array(
+ 'p_id'=>input('p_id'),
+ 'p_name'=>input('p_name'),
+ 'p_price'=>input('p_price'),
+ 'p_jd'=>input('p_jd'),
+ 'p_url'=>input('p_url'),
+ 'p_uptime'=>input('p_uptime','')?strtotime(input('p_uptime','')):time(),
+ 'p_status'=>$status,
+ 'p_sort'=>input('p_sort'),
+ 'p_time'=>time(),
+ 'p_uid'=>session('admin_auth.aid')
+ );
+ if(!empty($img_one)){
+ $sl_data['p_logo']=$img_one;
+ }
+ $rst=Db::name('lc_th')->update($sl_data);
+
+ $countTow=Db::name('lc_th')->where(array('p_status'=>1))->count();
+ if($countTow>4){
+ $rst=Db::name('lc_th')->where(array('p_id'=>input('p_id')))->update(array('p_status'=>0));
+ }
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcmanager/bank_list'));
+ }else{
+ $this->error('修改失败',url('admin/Lcmanager/bank_list'));
+ }
+ }
+ }
+
+ /**
+ * 投行排序
+ */
+ public function bank_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Lcmanager/bank_list'));
+ }else{
+ foreach (input('post.') as $p_id => $p_sort){
+ Db::name('lc_th')->update(['p_id'=>$p_id,'p_sort'=>$p_sort]);
+ }
+ $this->success('排序更新成功',url('admin/Lcmanager/bank_list'));
+ }
+ }
+
+ /**
+ * 投行删除(单个)
+ */
+ public function bank_del()
+ {
+ $p = input('p');
+ $rst = Db::name('lc_th')->delete(input('p_id'));
+ if ($rst !== false) {
+ $this->success('删除成功', url('admin/Lcmanager/bank_list', array('p' => $p)));
+ } else {
+ $this->error("删除失败!", url('admin/Lcmanager/bank_list', array('p' => $p)));
+ }
+ }
+
+ /**
+ * 投行删除(全选)
+ */
+ public function bank_alldel()
+ {
+ $p = input('p');
+ $ids = input('p_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcmanager/bank_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'p_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'p_id='.$ids;
+ }
+ $rst=Db::name('lc_th')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcmanager/bank_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcmanager/bank_list',array('p'=>$p)));
+ }
+ }
+
+
+ /**
+ * 投行状态修改
+ */
+ public function bank_state()
+ {
+ $id=input('x');
+ $status=Db::name('lc_th')->where(array('p_id'=>$id))->value('p_status');
+ $count=Db::name('lc_th')->where(array('p_status'=>1))->count();
+ if($status==1){
+ $statedata = array('p_status'=>0);
+ Db::name('lc_th')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ if($count<4){
+ $statedata = array('p_status'=>1);
+ Db::name('lc_th')->where(array('p_id'=>$id))->setField($statedata);
+ $this->success('状态启用');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcmanager/bank_list'));
+ }
+
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/controller/Lcwhcyb.php b/app/admin/controller/Lcwhcyb.php
new file mode 100644
index 0000000..32ddaa2
--- /dev/null
+++ b/app/admin/controller/Lcwhcyb.php
@@ -0,0 +1,244 @@
+[1=>'国有产权指定进场业务','文化和旅游产业专项债中介服务','文化产权登记托管平台','文化艺术资产托管','深圳市文化金融服务中心','区域股权中介服务','文化金融城市学院','','登记备案','托管转让','组织交易','交易见证'],
+ 2=>[13=>'艺投资','艺术品资产管配','文化金融大讲堂','常态路演平台','上市公司艺术资产管理办公室','家族艺术资产管理办公室','深圳文化产权交易所俱乐部',],
+ ];
+ /**
+ * 楼层文化产业列表
+ */
+ public function whcyb_list()
+ {
+
+ //栏目
+ $whcyb_type='';
+ $whcyb_cid=input('cid','');
+ $this->assign('cid',$whcyb_cid);
+ $whcyb=Db::name('lc_whcyb')->where(['whcyb_cid'=>$whcyb_cid])->order('whcyb_sort desc,whcyb_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $whcyb->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('whcyb',$whcyb);
+ $this->assign('whcyb_type',$whcyb_type);
+ if(request()->isAjax()){
+ return $this->fetch('lc/ajax_lc_list');
+ }else{
+ return $this->fetch('lc/lc_list');
+ }
+ }
+
+ /**
+ * 添加显示
+ */
+ public function whcyb_add()
+ {
+ $whcyb_cid=input('cid','');
+ $this->assign('types',$this->types[$whcyb_cid]);
+ $this->assign('cid',$whcyb_cid);
+ $whcyb_type=input('whcyb_type');
+ if (!request()->isAjax()){
+ $this->assign('whcyb_type',$whcyb_type);
+ return $this->fetch('lc/lc_add');
+ }else{
+ $type=input('whcyb_type');
+ $count = Db::name('lc_whcyb')->where(['whcyb_status'=>1,'whcyb_type'=>$type,'whcyb_cid'=>$whcyb_cid])->count();
+ if($count>=1){
+ $status=0;
+ }else{
+ $status=input('whcyb_status',0);
+ }
+ $name=$this->types[$whcyb_cid][$whcyb_type];
+ $sl_data=array(
+ 'whcyb_name'=>$name,
+ 'whcyb_sort'=>input('whcyb_sort'),
+ 'whcyb_type'=>$type,
+ 'whcyb_cid'=>$whcyb_cid,
+ 'whcyb_status'=>$status,
+ 'whcyb_time'=>input('whcyb_time','')?strtotime(input('whcyb_time','')):time(),
+ 'whcyb_content'=>htmlspecialchars_decode(input('whcyb_content')),
+ 'whcyb_uid'=>session('admin_auth.aid'),
+ );
+ $img_one=$this->_uploadOne();
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['whcyb_img']=$img_one;
+ }
+ $rst=Db::name('lc_whcyb')->insert($sl_data);
+ if($rst){
+ $this->success('新增成功',url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }else{
+ $this->error('新增失败',url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }
+ }
+ }
+
+ /**
+ * \删除(单个)
+ */
+ public function whcyb_del()
+ {
+ $whcyb_cid=input('cid','');
+ $this->assign('cid',$whcyb_cid);
+ $type=input('whcyb_type');
+ $rst=Db::name('lc_whcyb')->delete(input('whcyb_id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }
+ }
+
+ /**
+ * 删除(全选)
+ */
+ public function whcyb_alldel()
+ {
+ $whcyb_cid=input('cid','');
+ $this->assign('cid',$whcyb_cid);
+ $type=input('whcyb_type');
+ $ids = input('whcyb_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除的数据",url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }
+ if(is_array($ids)){
+ $where = 'whcyb_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'whcyb_id='.$ids;
+ }
+ $rst=Db::name('lc_whcyb')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }else{
+ $this -> error("删除失败!",url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }
+ }
+
+ /**
+ * 状态修改
+ */
+ public function whcyb_state()
+ {
+ $whcyb_cid=input('cid','');
+ $this->assign('cid',$whcyb_cid);
+ $id=input('whcyb_id');
+ $status=Db::name('lc_whcyb')->where(array('whcyb_id'=>$id))->value('whcyb_status');
+ if($status==1){
+ $statedata = array('whcyb_status'=>0);
+ Db::name('lc_whcyb')->where(array('whcyb_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $type=input('whcyb_type');
+ $count = Db::name('lc_whcyb')->where(['whcyb_status'=>1,'whcyb_type'=>$type])->count();
+ if($count<1){
+ $statedata = array('whcyb_status'=>1);
+ Db::name('lc_whcyb')->where(array('whcyb_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }else{
+ $this -> error("状态个数已达到!",url('admin/Lcwhcyb/whcyb_list',['cid'=>$whcyb_cid]));
+ }
+ }
+ }
+ /**
+ * 上传单张图片
+ * @return string
+ */
+ protected function _uploadOne(){
+ $validate = config('upload_validate');
+ $img_one='';
+ $file = request()->file('pic_one');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Gpgl/gp_list'));
+ }
+ }
+ return $img_one;
+ }
+ /**
+ * 排序
+ */
+ public function whcyb_order()
+ {
+ $whcyb_cid=input('cid','');
+ $jumpParam=['cid'=>$whcyb_cid];
+ $jump=url('admin/Lcwhcyb/whcyb_list',$jumpParam);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',$jump);
+ }else{
+ foreach (input('post.') as $n_id => $n_order){
+ Db::name('lc_whcyb')->update(['whcyb_id'=>$n_id,'whcyb_sort'=>$n_order]);
+ }
+ $this->success('排序更新成功',$jump);
+ }
+ }
+ //修改
+ public function whcyb_edit()
+ {
+ $whcyb_cid=input('cid','');
+ $this->assign('cid',$whcyb_cid);
+ $this->assign('types',$this->types[$whcyb_cid]);
+ if(!request()->isAjax()) {
+
+ $whcyb_id= input('whcyb_id', 0, 'intval');
+ if (!$whcyb_id) $this->error('参数错误', url('admin/Lcwhcyb/whcyb_list',['cid'=>$whcyb_cid]));
+ $gp_list = Db::name('lc_whcyb')->where('whcyb_id', $whcyb_id)->find();
+ $this->assign('gp_list',$gp_list);
+ return $this->fetch('lc/lc_edit');
+ }else{
+ $type=input('whcyb_type');
+ $name=$this->types[$whcyb_cid][$type];
+ $content=input('whcyb_content','','htmlspecialchars_decode');
+
+ $status=input('whcyb_status',0);
+
+ $sl_data=array(
+ 'whcyb_name'=>$name,
+ 'whcyb_id'=>input('whcyb_id'),
+ 'whcyb_sort'=>input('whcyb_sort'),
+ 'whcyb_type'=>$type,
+ 'whcyb_cid'=>$whcyb_cid,
+ 'whcyb_status'=>$status,
+ 'whcyb_time'=>input('whcyb_time','')?strtotime(input('whcyb_time','')):time(),
+ 'whcyb_content'=>$content,
+ 'whcyb_uid'=>session('admin_auth.aid'),
+ );
+
+ $img_one=$this->_uploadOne();
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['whcyb_img']=$img_one;
+ }
+ $rst=Db::name('lc_whcyb')->update($sl_data);
+ $count = Db::name('lc_whcyb')->where(['whcyb_status'=>1,'whcyb_type'=>$type])->count();
+ if($count>1){
+ $rst=Db::name('lc_whcyb')->where(array('whcyb_id'=>input('whcyb_id')))->update(array('whcyb_status'=>0));
+ }
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }else{
+ $this->error('修改失败',url('admin/Lcwhcyb/whcyb_list',['whcyb_type'=>$type,'cid'=>$whcyb_cid]));
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/controller/License.php b/app/admin/controller/License.php
new file mode 100644
index 0000000..e9b7abb
--- /dev/null
+++ b/app/admin/controller/License.php
@@ -0,0 +1,100 @@
+where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+
+ return $this->fetch();
+ }
+
+
+ /**
+ * 修改
+ */
+ public function edit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('license')->find(input('admin_id'));
+ $this->assign('list',$list);
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedit()
+ {
+
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+
+ $data=[];
+ $data['state']=input('state');
+ $id=input('id');
+ $rst=Db::name('license')->where(['id'=>$id])->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('License/index',['kind'=>$kind]));
+ }else{
+ $this->error('修改失败',url('License/index',['kind'=>$kind]));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('License/index',['kind'=>$kind]));
+ }
+ $rst=Db::name('license')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('License/index',['kind'=>$kind]));
+ }else{
+ $this->error('删除失败',url('License/index',['kind'=>$kind]));
+ }
+ }
+
+
+ /**
+ * 审核/取消审核
+ */
+ public function state()
+ {
+ $id=input('x');
+ $find=Db::name('license')->where(array('id'=>$id))->find();
+ $msg='未审';
+ if($find){
+ $status=$find['state'];
+ if($status==1){
+ $statedata = array('state'=>0);
+ }else{
+ $statedata = array('state'=>1);
+ $msg='已审';
+ }
+ $query=Db::name('license')->where(array('id'=>$id))->setField($statedata);
+ }
+ $this->success($msg);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Link.php b/app/admin/controller/Link.php
new file mode 100644
index 0000000..f8bb8b9
--- /dev/null
+++ b/app/admin/controller/Link.php
@@ -0,0 +1,250 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Link extends Base
+{
+ /**
+ * 链接列表
+ */
+ public function link_list()
+ {
+ $lk_cid=input('cid',0,'intval');
+ $where['type_type']=14;
+ $where['lk_type']=14;
+ if($lk_cid){
+ $where['lk_cid']=$lk_cid;
+ }
+ $links=Db::name('link')->alias('a')
+ ->join(config('database.prefix').'type b','a.lk_cid=b.type_id')
+ ->where($where)->order('lk_order desc,lk_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show = $links->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('lk_cid',$lk_cid);
+ $this->assign('links',$links);
+ $this->assign('page',$show);
+ $lk_cids=Db::name('type')->where('type_type',14)->order('type_order')->select();
+ $this->assign('lk_cids',$lk_cids);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_link_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function link_add()
+ {
+ $lk_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $lk_cids=Db::name('type')->where('type_type',14)->order('type_order')->select();
+ $this->assign('lk_cids',$lk_cids);
+ $this->assign('lk_cid',$lk_cid);
+ return $this->fetch();
+ }else{
+ //上传图片部分
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Link/link_list',['cid'=>$lk_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ $sl_data=array(
+ 'lk_name'=>input('lk_name'),
+ 'lk_status'=>input('lk_status',0),
+ 'lk_uid'=>session('admin_auth.aid'),
+ 'lk_time'=>time(),
+ 'lk_order'=>input('lk_order',50,'intval'),
+ 'lk_url'=>input('lk_url'),
+ 'lk_pic'=>$img_one,
+ 'lk_cid'=>$lk_cid,
+ 'lk_type'=>14
+ );
+ $rst=Db::name('link')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }else{
+ $this->error('添加失败',url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function link_edit()
+ {
+ $lk_cid=input('cid',0,'intval');
+ if (!request()->isAjax()) {
+ $lk_id = input('lk_id');
+ if (empty($lk_id)) {
+ if($lk_cid){
+ $this->error('参数错误', url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }else{
+ $this->error('参数错误', url('admin/Link/link_list'));
+ }
+ }
+ $link_list = Db::name('link')->find($lk_id);
+ $lk_cids=Db::name('type')->where('type_type',14)->order('type_order')->select();
+ $this->assign('lk_cids',$lk_cids);
+ $this->assign('link_list', $link_list);
+ $this->assign('lk_cid',$link_list['lk_cid']);
+ return $this->fetch();
+ }else{
+ //上传图片部分
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Link/link_list',['cid'=>$lk_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ $sl_data=array(
+ 'lk_id'=>input('lk_id'),
+ 'lk_name'=>input('lk_name'),
+ 'lk_status'=>input('lk_status',0),
+ 'lk_order'=>input('lk_order',50,'intval'),
+ 'lk_url'=>input('lk_url'),
+ 'lk_cid'=>$lk_cid
+ );
+ if(!empty($img_one)){
+ $sl_data['lk_pic']=$img_one;
+ }
+ $rst=Db::name('link')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }else{
+ $this->error('修改失败',url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }
+ }
+ }
+ /**
+ * 排序
+ */
+ public function link_order()
+ {
+ $lk_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ if($lk_cid){
+ $this->error('提交方式不正确', url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }else{
+ $this->error('提交方式不正确', url('admin/Link/link_list'));
+ }
+ }else{
+ foreach (input('post.') as $lk_id => $lk_order){
+ Db::name('link')->update(['lk_id'=>$lk_id,'lk_order'=>$lk_order]);
+ }
+ if($lk_cid){
+ $this->success('排序更新成功',url('admin/Link/link_list',['cid'=>$lk_cid]));
+ }else{
+ $this->success('排序更新成功',url('admin/Link/link_list'));
+ }
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function link_del()
+ {
+ $lk_cid=input('cid',0,'intval');
+ $p=input('p');
+ $rst=Db::name('link')->delete(input('lk_id'));
+ if($rst!==false){
+ if($lk_cid){
+ $this->success('删除成功',url('admin/Link/link_list',array('p'=>$p,'cid'=>$lk_cid)));
+ }else{
+ $this->success('删除成功',url('admin/Link/link_list',array('p'=>$p)));
+ }
+ }else{
+ if($lk_cid){
+ $this -> error("删除失败!",url('admin/Link/link_list',array('p'=>$p,'cid'=>$lk_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Link/link_list',array('p'=>$p)));
+ }
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function link_alldel()
+ {
+ $p = input('p');
+ $ids = input('lk_id/a');
+ $lk_cid=input('cid',0,'intval');
+ if(empty($ids)){
+ if($lk_cid){
+ $this -> error("请选择待删除数据",url('admin/Link/link_list',array('p'=>$p,'cid'=>$lk_cid)));
+ }else{
+ $this -> error("请选择待删除数据",url('admin/Link/link_list',array('p'=>$p)));
+ }
+ }
+ if(is_array($ids)){
+ $where = 'lk_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'lk_id='.$ids;
+ }
+ $rst=Db::name('link')->where($where)->delete();
+ if($rst!==false){
+ if($lk_cid){
+ $this->success("删除成功",url('admin/Link/link_list',array('p'=>$p,'cid'=>$lk_cid)));
+ }else{
+ $this->success("删除成功",url('admin/Link/link_list',array('p'=>$p)));
+ }
+ }else{
+ if($lk_cid){
+ $this -> error("删除失败!",url('admin/Link/link_list',array('p'=>$p,'cid'=>$lk_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Link/link_list',array('p'=>$p)));
+ }
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function link_state()
+ {
+ $id=input('x');
+ $status=Db::name('link')->where(array('lk_id'=>$id))->value('lk_status');
+ if($status==1){
+ $statedata = array('lk_status'=>0);
+ Db::name('link')->where(array('lk_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('lk_status'=>1);
+ Db::name('link')->where(array('lk_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Login.php b/app/admin/controller/Login.php
new file mode 100644
index 0000000..60bbb0f
--- /dev/null
+++ b/app/admin/controller/Login.php
@@ -0,0 +1,82 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use app\common\controller\Common;
+use app\admin\model\Admin as AdminModel;
+use think\Validate;
+use think\captcha\Captcha;
+
+class Login extends Common
+{
+ protected function _initialize()
+ {
+ parent::_initialize();
+ }
+ /**
+ * 登录显示
+ */
+ public function login()
+ {
+ // if(strcmp(input('key','123456'),'SZCAEECultureAdmin')!=0){
+ // $this->redirect('home/Index/index');//未登录
+ // }
+ if($this->check_admin_login()) $this->redirect('admin/Index/index');
+ return $this->fetch();
+ }
+ /**
+ * 验证码
+ */
+ public function verify()
+ {
+ if($this->check_admin_login()) $this->redirect('admin/Index/index');
+ $config=config('verify');
+ $config['codeSet']='0123456789';
+ ob_end_clean();
+ $verify = new Captcha($config);
+ return $verify->entry('aid');
+ }
+ /**
+ * 登录验证
+ */
+ public function runlogin()
+ {
+ if (!request()->isAjax()){
+ $this->error("提交方式错误!",url('admin/Login/login'));
+ }else{
+ if(config('geetest.geetest_on')){
+ if(!geetest_check(input('post.'))){
+ $this->error('验证不通过',url('admin/Login/login'));
+ };
+ }else{
+ $this->verify_check('aid');
+ }
+ $admin_username=input('admin_username');
+ $password=input('admin_pwd');
+ $rememberme=input('rememberme');
+ $admin=new AdminModel;
+ if($admin->login($admin_username,$password,$rememberme)){
+ $this->success('恭喜您,登陆成功',url('admin/Index/index'));
+ }else{
+ $this->error($admin->getError(),url('admin/Login/login'));
+ }
+ }
+ }
+ /**
+ * 退出登录
+ */
+ public function logout()
+ {
+ session('admin_auth',null);
+ session('admin_auth_sign',null);
+ cookie('aid', null);
+ cookie('signin_token', null);
+ $this->redirect('admin/Login/login',['key'=>'SZCAEECultureAdmin']);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Lxwm.php b/app/admin/controller/Lxwm.php
new file mode 100644
index 0000000..e2e83e0
--- /dev/null
+++ b/app/admin/controller/Lxwm.php
@@ -0,0 +1,70 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Lxwm extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='lxwm';
+ $this->controller_name='Lxwm';
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function lxwm_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function lxwm_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function lxwm_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function lxwm_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function lxwm_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function lxwm_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function lxwm_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Member.php b/app/admin/controller/Member.php
new file mode 100644
index 0000000..5e14bf7
--- /dev/null
+++ b/app/admin/controller/Member.php
@@ -0,0 +1,341 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use app\admin\model\MemberList;
+
+class Member extends Base
+{
+ /*
+ * 用户管理
+ */
+ public function member_list(){
+ $key=input('key');
+ $opentype_check=input('opentype_check','');
+ $activetype_check=input('activetype_check','');
+ $membertype_check=input('membertype_check','');
+ $where=array();
+ if($opentype_check !== ''){
+ $where['member_list_open']=$opentype_check;
+ }
+ if($activetype_check !== ''){
+ $where['user_status']=$activetype_check;
+ }
+ if($membertype_check !== ''){
+ $where['member_list_groupid']=$membertype_check;
+ }
+ $member_model=new MemberList;
+ $member_list=$member_model->alias('a')->join(config('database.prefix').'member_group b','a.member_list_groupid=b.member_group_id')
+ ->where($where)->where('member_list_username|member_list_tel|member_list_email|member_list_tel2|member_list_tel3','like',"%".$key."%")
+ ->order('member_list_addtime desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show=$member_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('opentype_check',$opentype_check);
+ $this->assign('activetype_check',$activetype_check);
+ $this->assign('membertype_check',$membertype_check);
+ $this->assign('member_list',$member_list);
+ $this->assign('page',$show);
+ $this->assign('val',$key);
+
+ $member_group=Db::name('member_group')->order('member_group_order')->select();
+ $this->assign('groups',$member_group);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_member_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /*
+ * 添加用户显示
+ */
+ public function member_add(){
+ $province = Db::name('Region')->where ( array('pid'=>1) )->select ();
+ $this->assign('province',$province);
+ $member_group=Db::name('member_group')->order('member_group_order')->select();
+ $this->assign('member_group',$member_group);
+ return $this->fetch();
+ }
+
+ /*
+ * 添加用户操作
+ */
+ public function member_runadd(){
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Member/member_list'));
+ }else{
+ $member_list_salt=random(10);
+ $sl_data=array(
+ 'member_list_groupid'=>input('member_list_groupid'),
+ 'member_list_username'=>input('member_list_username'),
+ 'first_pwd'=>input('first_pwd'),
+ 'member_list_salt' => $member_list_salt,
+ 'member_list_pwd'=>encrypt_password(input('member_list_pwd'),$member_list_salt),
+ 'member_list_nickname'=>input('member_list_nickname'),
+ 'member_list_province'=>input('member_list_province'),
+ 'member_list_city'=>input('member_list_city'),
+ 'member_list_town'=>input('member_list_town'),
+ 'member_list_sex'=>input('member_list_sex'),
+ 'member_list_tel'=>input('member_list_tel'),
+ 'member_list_email'=>input('member_list_email'),
+ 'member_list_open'=>input('member_list_open',0),
+ 'user_url'=>input('user_url'),
+ 'member_list_addtime'=>time(),
+ 'user_status'=>input('user_status',0),
+ 'signature'=>input('signature'),
+ 'score'=>input('score',0,'intval'),
+ 'coin'=>input('coin',0,'intval'),
+ );
+ $rst=MemberList::create($sl_data);
+ if($rst!==false){
+ $this->success('会员添加成功',url('admin/Member/member_list'));
+ }else{
+ $this->error('会员添加失败',url('admin/Member/member_list'));
+ }
+ }
+ }
+
+ /*
+ * 修改用户信息界面
+ */
+ public function member_edit(){
+ $province = Db::name('Region')->where ( array('pid'=>1) )->select ();
+ $member_group=Db::name('member_group')->order('member_group_order')->select();
+ $member_list_edit=Db::name('member_list')->where(array('member_list_id'=>input('member_list_id')))->find();
+ $city=Db::name('Region')->where ( array('pid'=>$member_list_edit['member_list_province']) )->select ();
+ $town=Db::name('Region')->where ( array('pid'=>$member_list_edit['member_list_city']) )->select ();
+ $this->assign('member_list_edit',$member_list_edit);
+ $this->assign('province',$province);
+ $this->assign('city',$city);
+ $this->assign('town',$town);
+ $this->assign('member_group',$member_group);
+ return $this->fetch();
+ }
+ /*
+ * 修改用户操作
+ */
+ public function member_runedit(){
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Member/member_list'));
+ }else{
+ $sl_data['member_list_id']=input('member_list_id');
+ $sl_data['member_list_groupid']=input('member_list_groupid');
+ $sl_data['member_list_username']=input('member_list_username');
+ $pwd=input('member_list_pwd');
+ if (!empty($pwd)){
+ $member_list_salt=random(10);
+ $sl_data['member_list_salt']=$member_list_salt;
+ $sl_data['member_list_pwd']=encrypt_password($pwd,$member_list_salt);
+ }
+
+ $sl_data['first_pwd']=input('first_pwd');
+ $sl_data['member_list_nickname']=input('member_list_nickname');
+ $sl_data['member_list_province']=input('member_list_province');
+ $sl_data['member_list_city']=input('member_list_city');
+ $sl_data['member_list_town']=input('member_list_town');
+ $sl_data['member_list_sex']=input('member_list_sex');
+ $sl_data['member_list_tel']=input('member_list_tel');
+ $sl_data['member_list_nickname2']=input('member_list_nickname2');
+ $sl_data['member_list_tel2']=input('member_list_tel2');
+ $sl_data['member_list_tel3']=input('member_list_tel3');
+ $sl_data['member_list_email']=input('member_list_email');
+ $sl_data['user_status']=input('user_status',0);
+ $sl_data['member_list_open']=input('member_list_open',0);
+ $sl_data['user_url']=input('user_url');
+ $sl_data['signature']=input('signature');
+ $sl_data['score']=input('score',0,'intval');
+ $sl_data['coin']=input('coin',0,'intval');
+ $rst=MemberList::update($sl_data);
+ if($rst!==false){
+ $this->success('会员修改成功',url('admin/Member/member_list'));
+ }else{
+ $this->error('会员修改失败',url('admin/Member/member_list'));
+ }
+ }
+ }
+ /*
+ * 会员禁止/取消禁止
+ */
+ public function member_state(){
+ $id=input('x');
+ $member_model=new MemberList;
+ $status=$member_model->where(array('member_list_id'=>$id))->value('member_list_open');//判断当前状态情况
+ if($status==1){
+ $statedata = array('member_list_open'=>0);
+ $member_model->where(array('member_list_id'=>$id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('member_list_open'=>1);
+ $member_model->where(array('member_list_id'=>$id))->setField($statedata);
+ $this->success('状态开启');
+ }
+ }
+ /*
+ * 会员激活/取消激活
+ */
+ public function member_active()
+ {
+ $id=input('x');
+ $member_model=new MemberList;
+ $status=$member_model->where(array('member_list_id'=>$id))->value('user_status');//判断当前状态情况
+ if($status==1){
+ $statedata = array('user_status'=>0);
+ $member_model->where(array('member_list_id'=>$id))->setField($statedata);
+ $this->success('未激活');
+ }else{
+ $statedata = array('user_status'=>1);
+ $member_model->where(array('member_list_id'=>$id))->setField($statedata);
+ $this->success('已激活');
+ }
+ }
+
+ /*
+ * 会员删除
+ */
+ public function member_del()
+ {
+ $p=input('p');
+ $member_list_id=input('member_list_id');
+ $member_model=new MemberList;
+ $rst=Db::name('admin')->where('member_id',$member_list_id)->find();
+ if($rst){
+ $this->error('此会员已关联管理员,请从管理员处删除',url('admin/Member/member_list', array('p' => $p)));
+ }else{
+ $rst=$member_model->where(array('member_list_id'=>$member_list_id))->delete();
+ if($rst!==false){
+ $this->success('会员删除成功',url('admin/Member/member_list', array('p' => $p)));
+ }else{
+ $this->error('会员删除失败',url('admin/Member/member_list', array('p' => $p)));
+ }
+ }
+ }
+ /*
+ *会员组显示列表
+ */
+ public function member_group_list()
+ {
+ $member_group=Db::name('member_group');
+ $member_group_list=$member_group->order('member_group_order')->select();
+ $this->assign('member_group_list',$member_group_list);
+ return $this->fetch();
+ }
+
+ /*
+ * 会员组添加方法
+ */
+ public function member_group_runadd()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Member/member_group_list'));
+ }else{
+ $rst=Db::name('member_group')->insert(input('post.'));
+ if($rst!==false){
+ $this->success('会员组添加成功',url('admin/Member/member_group_list'));
+ }else{
+ $this->error('会员组添加失败',url('admin/Member/member_group_list'));
+ }
+ }
+ }
+
+ /*
+ * 会员组删除
+ */
+ public function member_group_del()
+ {
+ $member_group_id=input('member_group_id');
+ if (empty($member_group_id)){
+ $this->error('会员组ID不存在',url('admin/Member/member_group_list'));
+ }
+ $rst=Db::name('member_group')->where(array('member_group_id'=>input('member_group_id')))->delete();
+ if($rst!==false){
+ $this->success('会员组删除成功',url('admin/Member/member_group_list'));
+ }else{
+ $this->error('会员组删除失败',url('admin/Member/member_group_list'));
+ }
+ }
+
+ /*
+ * 改变会员组状态
+ */
+ public function member_group_state()
+ {
+ $member_group_id=input('x');
+ if (!$member_group_id){
+ $this->error('ID:'.$member_group_id.'不存在',url('admin/Member/member_group_list'));
+ }
+ $status=Db::name('member_group')->where(array('member_group_id'=>$member_group_id))->value('member_group_open');//判断当前状态情况
+ if($status==1){
+ $statedata = array('member_group_open'=>0);
+ Db::name('member_group')->where(array('member_group_id'=>$member_group_id))->setField($statedata);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('member_group_open'=>1);
+ Db::name('member_group')->where(array('member_group_id'=>$member_group_id))->setField($statedata);
+ $this->success('状态开启');
+ }
+ }
+
+ /*
+ * 排序更新
+ */
+ public function member_group_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Member/member_group_list'));
+ }else{
+ $post=input('post.');
+ foreach ($post as $id => $sort){
+ Db::name('member_group')->where(array('member_group_id' => $id ))->setField('member_group_order' , $sort);
+ }
+ $this->success('排序更新成功',url('admin/Member/member_group_list'));
+ }
+ }
+
+ /*
+ * 修改会员组返回值
+ */
+ public function member_group_edit()
+ {
+ $member_group_id=input('member_group_id');
+ $member_group=Db::name('member_group')->where(array('member_group_id'=>$member_group_id))->find();
+ $sl_data['member_group_id']=$member_group['member_group_id'];
+ $sl_data['member_group_name']=$member_group['member_group_name'];
+ $sl_data['member_group_open']=$member_group['member_group_open'];
+ //$sl_data['member_group_toplimit']=$member_group['member_group_toplimit'];
+ //$sl_data['member_group_bomlimit']=$member_group['member_group_bomlimit'];
+ $sl_data['member_group_order']=$member_group['member_group_order'];
+ $sl_data['code']=1;
+ return json($sl_data);
+ }
+
+ /*
+ * 修改用户组方法
+ */
+ public function member_group_runedit()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Member/member_group_list'));
+ }else{
+ $sl_data=array(
+ 'member_group_id'=>input('member_group_id'),
+ 'member_group_name'=>input('member_group_name'),
+ //'member_group_toplimit'=>input('member_group_toplimit'),
+ //'member_group_bomlimit'=>input('member_group_bomlimit'),
+ 'member_group_order'=>input('member_group_order'),
+
+ );
+ $rst=Db::name('member_group')->update($sl_data);
+ if($rst!==false){
+ $this->success('会员组修改成功',url('admin/Member/member_group_list'));
+ }else{
+ $this->error('会员组修改失败',url('admin/Member/member_group_list'));
+ }
+ }
+ }
+}
diff --git a/app/admin/controller/Menu.php b/app/admin/controller/Menu.php
new file mode 100644
index 0000000..aa29261
--- /dev/null
+++ b/app/admin/controller/Menu.php
@@ -0,0 +1,331 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use app\admin\model\Menu as MenuModel;
+use app\admin\model\Options as OptionsModel;
+
+class Menu extends Base
+{
+ public function _initialize()
+ {
+ parent::_initialize();
+ }
+ /**
+ * 前台菜单列表
+ */
+ public function news_menu_list()
+ {
+ $menu_l=input('menu_l');
+ $where=array();
+ if(!empty($menu_l)){
+ $where['menu_l']=array('eq',$menu_l);
+ }
+ if(!config('lang_switch_on')){
+ $where['menu_l']= $this->lang;
+ }
+ $menu_model=new MenuModel;
+ $menus=$menu_model->where($where)->order('menu_l Desc,listorder')->select();
+ //$menus=get_menu_model($menus);
+ $show='';
+ $arr = menu_left($menus,'id','parentid');
+ $this->assign('arr',$arr);
+ $this->assign('menu_l',$menu_l);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_news_menu_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 前台菜单添加显示
+ */
+ public function news_menu_add()
+ {
+ $parentid=input('id',0);
+ //id不为0,取lang
+ $menu_l='';
+ $menu_model=new MenuModel;
+ if($parentid){
+ $menu_l=$menu_model->where('id',$parentid)->value('menu_l');
+ }
+ $where=array();
+ if(!empty($menu_l)){
+ $where['menu_l']=array('eq',$menu_l);
+ }
+ if(!config('lang_switch_on')){
+ $where['menu_l']= $this->lang;
+ }
+ $options_model=new OptionsModel;
+ $tpls=$options_model->tpls($this->lang);
+ $model='';//Db::name('model')->select();
+ $this->assign('model',$model);
+ $menu_text=$menu_model->where($where)->order('menu_l Desc,listorder')->select();
+ $menu_text = menu_left($menu_text,'id','parentid');
+ $this->assign('menu_text',$menu_text);
+ $this->assign('parentid',$parentid);
+ $this->assign('menu_l',$menu_l);
+ $this->assign('tpls',$tpls);
+ return $this->fetch();
+ }
+ /**
+ * 前台菜单添加操作
+ */
+ public function news_menu_runadd()
+ {
+ $lang_list=input('lang_list');
+ if(empty($lang_list)) $lang_list=input('menu_l',$this->lang);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }else{
+ //处理图片
+ $img_url='';
+ $file = request()->file('file0');
+ if($file){
+ if(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->upload();
+ $error = $upload->getError();
+ if ($info) {
+ $img_url= config('storage.domain').$info[0]['key'];
+ }else{
+ $this->error($error,url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }
+ }else{
+ $validate=config('upload_validate');
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if($info) {
+ $img_url=config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime']=time();
+ $data['filesize']=$info->getSize();
+ $data['path']=$img_url;
+ Db::name('plug_files')->insert($data);
+ }else{
+ $this->error($file->getError(),url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }
+ }
+ }
+ //处理语言
+ $parentid=input('parentid',0,'intval');
+ if($parentid){
+ $menu_l=Db::name('menu')->where('id',$parentid)->value('menu_l');
+ }else{
+ $menu_l=input('menu_l',$this->lang);
+ }
+ //构建数组
+ $data=array(
+ 'menu_name'=>input('menu_name'),
+ 'menu_l'=>$menu_l,
+ 'menu_enname'=>input('menu_enname'),
+ 'menu_type'=>input('menu_type'),
+ 'menu_modelid'=>input('menu_modelid',0,'intval'),
+ 'parentid'=>$parentid,
+ 'menu_listtpl'=>input('menu_listtpl'),
+ 'menu_newstpl'=>input('menu_newstpl'),
+ 'menu_address'=>input('menu_address'),
+ 'menu_open'=>input('menu_open',0),
+ 'top'=>input('top',1),
+ 'listorder'=>input('listorder'),
+ 'menu_seo_title'=>input('menu_seo_title'),
+ 'menu_seo_key'=>input('menu_seo_key'),
+ 'menu_seo_des'=>input('menu_seo_des'),
+ 'menu_target'=>input('menu_target'),
+ 'menu_content'=>htmlspecialchars_decode(input('menu_content')),
+ 'menu_img'=>$img_url,
+ );
+ $rst=MenuModel::create($data);
+ $menu_model=new MenuModel;
+ if($rst!==false){
+ $arr=MenuModel::get(input('parentid'));
+ if(input('menu_type')==3 && $arr['menu_type']==3){
+ $menu_model->where(array('id'=>input('parentid')))->setField('menu_type',1);
+ }
+ cache('site_nav_main',null);
+ $this->success('菜单添加成功',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }else{
+ $this->error('菜单添加失败',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }
+ }
+ }
+ /**
+ * 前台菜单编辑显示
+ */
+ public function news_menu_edit()
+ {
+ $menu=MenuModel::get(input('id'));
+ $options_model=new OptionsModel;
+ $tpls=$options_model->tpls($this->lang);
+ $model='';//Db::name('model')->select();
+ $this->assign('model',$model);
+ $where=array();
+ $where['menu_l']=array('eq',$menu['menu_l']);
+ if(!config('lang_switch_on')){
+ $where['menu_l']= $this->lang;
+ }
+ $menu_text=Db::name('menu')->where($where)->order('menu_l Desc,listorder')->select();
+ $menu_text = menu_left($menu_text,'id','parentid');
+ $this->assign('menu_text',$menu_text);
+ $this->assign('menu',$menu);
+ $this->assign('tpls',$tpls);
+ return $this->fetch();
+ }
+ /**
+ * 前台菜单编辑操作
+ */
+ public function news_menu_runedit()
+ {
+ $lang_list=input('lang_list');
+ if(empty($lang_list)) $lang_list=input('menu_l',$this->lang);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }else{
+ $checkpic=input('checkpic');
+ $oldcheckpic=input('oldcheckpic');
+ $img_url='';
+ if ($checkpic!=$oldcheckpic){
+ $file = request()->file('file0');
+ if($file){
+ if(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->upload();
+ $error = $upload->getError();
+ if ($info) {
+ $img_url= config('storage.domain').$info[0]['key'];
+ }else{
+ $this->error($error,url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));//否则就是上传错误,显示错误原因
+ }
+ }else{
+ $validate=config('upload_validate');
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if($info) {
+ $img_url=config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime']=time();
+ $data['filesize']=$info->getSize();
+ $data['path']=$img_url;
+ Db::name('plug_files')->insert($data);
+ }else{
+ $this->error($file->getError(),url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }
+ }
+ }
+ }
+ //处理语言
+ $parentid=input('parentid',0,'intval');
+ if($parentid){
+ $menu_l=Db::name('menu')->where('id',$parentid)->value('menu_l');
+ }else{
+ $menu_l=input('menu_l',$this->lang);
+ }
+ $data=array(
+ 'id'=>input('id'),
+ 'menu_name'=>input('menu_name'),
+ 'menu_enname'=>input('menu_enname'),
+ 'menu_type'=>input('menu_type'),
+ 'menu_modelid'=>input('menu_modelid',0,'intval'),
+ 'parentid'=>$parentid,
+ 'menu_l'=>$menu_l,
+ 'menu_listtpl'=>input('menu_listtpl'),
+ 'menu_newstpl'=>input('menu_newstpl'),
+ 'menu_address'=>input('menu_address'),
+ 'menu_open'=>input('menu_open',0),
+ 'top'=>input('top',1),
+ 'listorder'=>input('listorder'),
+ 'menu_seo_title'=>input('menu_seo_title'),
+ 'menu_seo_key'=>input('menu_seo_key'),
+ 'menu_seo_des'=>input('menu_seo_des'),
+ 'menu_target'=>input('menu_target'),
+ 'menu_content'=>htmlspecialchars_decode(input('menu_content')),
+ );
+ if ($checkpic!=$oldcheckpic){
+ $data['menu_img']=$img_url;
+ }
+ $rst=MenuModel::update($data);
+ if($rst!==false){
+ cache('site_nav_main',null);
+ cache('site_nav',null);
+ $this->success('菜单修改成功',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }else{
+ $this->error('菜单修改失败',url('admin/Menu/news_menu_list',array('menu_l'=>$lang_list)));
+ }
+ }
+ }
+ /**
+ * 前台菜单删除
+ */
+ public function news_menu_del()
+ {
+ $lang_list=input('lang_list');
+ $id=input('id');
+ $arr=MenuModel::get($id);
+ $model_id=$arr['menu_modelid'];
+ $parentid=$arr['parentid'];
+ $parent_arr=MenuModel::get($parentid);
+ $ids=get_menu_byid($id,1,2);//返回含自身id及子菜单id数组
+ $rst=MenuModel::destroy($ids);
+ $menu_model=new MenuModel;
+ //处理父级
+ if($rst!==false){
+ //判断其父菜单是否还存在子菜单,如无子菜单,且父菜单类型为1
+ if($parentid && $parent_arr['menu_type']==1){
+ $child=$menu_model->where(array('parentid'=>$parentid))->select();
+ if(empty($child)){
+ $menu_model->where(array('id'=>$parentid))->update(['menu_type'=>3,'menu_modelid'=>$model_id]);
+ }
+ }
+ cache('site_nav_main',null);
+ $this->success('菜单删除成功',url('admin/Menu/news_menu_list',['menu_l'=>$lang_list]));
+ }else{
+ $this -> error("菜单删除失败!",url('admin/Menu/news_menu_list',['menu_l'=>$lang_list]));
+ }
+ }
+ /**
+ * 前台菜单排序
+ */
+ public function news_menu_order(){
+ $lang_list=input('lang_list');
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Menu/news_menu_list',['menu_l'=>$lang_list]));
+ }else{
+ $list=[];
+ foreach (input('post.') as $id => $sort){
+ $list[]=['id'=>$id,'listorder'=>$sort];
+ }
+ $menu_model=new MenuModel;
+ $menu_model->saveAll($list);
+ cache('site_nav_main',null);
+ $this->success('排序更新成功',url('admin/Menu/news_menu_list',['menu_l'=>$lang_list]));
+ }
+ }
+ /**
+ * 前台菜单开启/禁止
+ */
+ public function news_menu_state()
+ {
+ $id=input('x');
+ $menu_model=new MenuModel;
+ $status=$menu_model->where(array('id'=>$id))->value('menu_open');//判断当前状态情况
+ if($status==1){
+ $statedata = array('menu_open'=>0);
+ $menu_model->where(array('id'=>$id))->setField($statedata);
+ cache('site_nav_main',null);
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('menu_open'=>1);
+ $menu_model->where(array('id'=>$id))->setField($statedata);
+ cache('site_nav_main',null);
+ $this->success('状态开启');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/News.php b/app/admin/controller/News.php
new file mode 100644
index 0000000..ca51d67
--- /dev/null
+++ b/app/admin/controller/News.php
@@ -0,0 +1,713 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class News extends Base
+{
+ protected $table_name='news';
+ protected $controller_name='news';
+ protected $has_img=true;
+ protected $has_imgs=true;
+ protected $has_source=true;
+ public function _initialize()
+ {
+ parent::_initialize();
+ $this->assign('table_name',$this->table_name);
+ $this->assign('controller',$this->controller_name);
+ $this->assign('has_img',$this->has_img);
+ $this->assign('has_imgs',$this->has_imgs);
+ $this->assign('has_source',$this->has_source);
+ }
+ /**
+ * 删除(单个)
+ */
+ public function apply_del()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p=input('p');
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $jumpParam=['p' => $p,'cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/apply_list',$jumpParam);
+ $rst=Db::name('apply')->delete(input('n_id'));
+ if($rst!==false){
+ $this->success('删除成功',$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function apply_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('n_id/a');
+ $n_cid=input('cid',0,'intval');
+ $n_kind=input('kind','','intval');
+ $jumpParam=['kind'=>$n_kind,'p' => $p,'cid'=>$n_cid,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/apply_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('apply')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function apply_edit()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $jumpParam=['kind'=>$n_kind,'cid'=>$n_cid,'page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/apply_list',$jumpParam);
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $this->assign('n_cid', $n_cid);
+ $this->assign('n_kind', $n_kind);
+ $news_list = Db::name('apply')->find($n_id);
+ $poster=$news_list['cred_poster'];
+ if($poster){
+ $news_list['cred_poster']=explode(';', $poster);
+ }
+
+
+ $this->assign('list', $news_list);
+ return $this->fetch('apply/news_edit');
+
+ }
+ public function apply_list(){
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $this->assign('n_kind',$n_kind);
+ $where=[];
+ if($n_cid)$where['cid']=$n_cid;
+ if($n_kind)$where['kind']=$n_kind;
+ $news=Db::name('apply')->where($where)->order(['create_time'=>'desc'])->paginate(config('paginate.list_rows'),false,['query'=>get_query(),'page'=>$page]);
+ $show = $news->render();
+
+
+ $this->assign('pageshow',$show);
+ $this->assign('news',$news);
+ $this->assign('n_cid',$n_cid);
+ if(request()->isAjax()){
+ return $this->fetch('apply/ajax_news_list'.$n_cid);
+ }else{
+ return $this->fetch('apply/news_list'.$n_cid);
+ }
+ }
+ /**
+ * 导出名单
+ */
+ public function export(){
+ $id=input('cid');
+ $kind=input('kind',1);
+ if(empty($kind))$this->error("请选择平台");
+ $map=['cid'=>$id,'kind'=>$kind];
+ $applys=Db::name('apply')->where($map)->select();
+
+ $expTitle="古建收藏俱乐部申请表(机构)";
+ if($id==2)$expTitle="古建收藏俱乐部申请表(个人)";
+
+ $expCellName=[];
+ if($id==1){
+ array_push($expCellName,['org_name','机构名称']);
+ array_push($expCellName,['org_code','机构信用代码']);
+ array_push($expCellName,['address','联系地址']);
+ array_push($expCellName,['username','法人代表人']);
+ array_push($expCellName,['cred_num','身份证号码']);
+ array_push($expCellName,['contact','联系人']);
+ array_push($expCellName,['mobile','联系电话']);
+ array_push($expCellName,['direction','古建收藏或意向投资方向']);
+ array_push($expCellName,['org_desc','机构简介']);
+ }
+ if($id==2){
+ array_push($expCellName,['username','姓名']);
+ array_push($expCellName,['cred_type','证件类型']);
+ array_push($expCellName,['cred_num','证件号码']);
+ array_push($expCellName,['address','联系地址']);
+ array_push($expCellName,['contact','联系人']);
+ array_push($expCellName,['mobile','联系电话']);
+ array_push($expCellName,['join_year','古建收藏/投资经验']);
+ array_push($expCellName,['infor','古建藏品介绍']);
+ array_push($expCellName,['experience','个人简介']);
+ }
+ array_push($expCellName,['create_time','报名时间','','date']);
+ foreach ($applys as &$row){
+ $ctype=$row['cred_type'];
+ if($ctype==1)$ctype="身份证";
+ if($ctype==2)$ctype="护照";
+ if($ctype==3)$ctype="军人证";
+ $row['cred_type']=$ctype;
+ }
+ $expTableData=$applys;
+ $res=exportExcel($expTitle,$expCellName,$expTableData);
+ }
+ /**
+ * 删除(单个)
+ */
+ public function buildapply_del()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p=input('p');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/buildapply_list',$jumpParam);
+ $rst=Db::name('buildapply')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function buildapply_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('n_id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/buildapply_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('buildapply')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+
+ /**
+ * 编辑显示
+ */
+ public function buildapply_edit()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/buildapply_list',$jumpParam);
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $news_list = Db::name('buildapply')->find($n_id);
+ $poster=$news_list['closepic'];
+ if($poster){
+ $news_list['closepic']=explode(';', $poster);
+ }
+ $style=$news_list['style'];
+ if($style){
+ $temp=['A'=>[],'B'=>[],'C'=>[],'D'=>[]];
+ try {
+ $style=json_decode($style,true);
+ } catch (Exception $e) {
+ $style=array();
+ }
+ if(!is_array($style))$style=[];
+ $temp=array_merge($temp,$style);
+ $news_list['style']=$temp;
+ }else{
+ $news_list['style']=['A'=>[],'B'=>[],'C'=>[],'D'=>[]];
+ }
+ $poster=$news_list['visionpic'];
+ if($poster){
+ $news_list['visionpic']=explode(';', $poster);
+ }
+ $poster=$news_list['allpic'];
+ if($poster){
+ $news_list['allpic']=explode(';', $poster);
+ }
+ $poster=$news_list['planepic'];
+ if($poster){
+ $news_list['planepic']=explode(';', $poster);
+ }
+
+ $service=$news_list['tgservice'];
+ if($service){
+ $news_list['tgservice']=explode(';', $service);
+ }else{
+ $news_list['tgservice']=[];
+ }
+ $service=$news_list['mgservice'];
+ if($service){
+ $news_list['mgservice']=explode(';', $service);
+ }else{
+ $news_list['mgservice']=[];
+ }
+ $service=$news_list['tfservice'];
+ if($service){
+ $news_list['tfservice']=explode(';', $service);
+ }else{
+ $news_list['tfservice']=[];
+ }
+ $service=$news_list['useservice'];
+ if($service){
+ $news_list['useservice']=explode(';', $service);
+ }else{
+ $news_list['useservice']=[];
+ }
+ $this->assign('list', $news_list);
+ return $this->fetch('apply/build_edit');
+
+ }
+ public function buildapply_list(){
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $where=[];
+ $news=Db::name('buildapply')->where($where)->order(['create_time'=>'desc'])->paginate(config('paginate.list_rows'),false,['query'=>get_query(),'page'=>$page]);
+ $show = $news->render();
+
+ $this->assign('pageshow',$show);
+ $this->assign('news',$news);
+ if(request()->isAjax()){
+ return $this->fetch('apply/ajax_build_list');
+ }else{
+ return $this->fetch('apply/build_list');
+ }
+ }
+
+ /**
+ * 删除(单个)
+ */
+ public function cultureapply_del()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p=input('p');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/cultureapply_list',$jumpParam);
+ $rst=Db::name('cultureapply')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function cultureapply_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('n_id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/cultureapply_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('cultureapply')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+
+ /**
+ * 编辑显示
+ */
+ public function cultureapply_edit()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/cultureapply_list',$jumpParam);
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $news_list = Db::name('cultureapply')->find($n_id);
+ $legal=$news_list['legal'];
+ if($legal){
+ $news_list['legal']=json_decode($legal);
+ }
+ $org=$news_list['org'];
+ if($org){
+ $news_list['org']=json_decode($org);
+ }
+ $cont=$news_list['cont'];
+ if($cont){
+ $news_list['cont']=json_decode($cont);
+ }
+
+ $this->assign('list', $news_list);
+ return $this->fetch('apply/culture_edit');
+
+ }
+ public function cultureapply_list(){
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $where=[];
+ $news=Db::name('cultureapply')->where($where)->order(['create_time'=>'desc'])->paginate(config('paginate.list_rows'),false,['query'=>get_query(),'page'=>$page]);
+ $show = $news->render();
+
+ $this->assign('pageshow',$show);
+ $this->assign('news',$news);
+ if(request()->isAjax()){
+ return $this->fetch('apply/ajax_culture_list');
+ }else{
+ return $this->fetch('apply/culture_list');
+ }
+ }
+
+ /**
+ * 列表
+ */
+ public function news_list()
+ {
+ //栏目
+ $search_name=input('search_name','','trim');
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $page=input('page','','intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $this->assign('n_kind',$n_kind);
+ $this->assign('search_name',$search_name);
+ $where=[];
+ if($n_cid)$where['n_cid']=$n_cid;
+ if($n_kind)$where['n_kind']=$n_kind;
+ if($search_name){
+ $where['n_title|n_content']=array('like',['%'.$search_name.'%','%'.$search_name,$search_name.'%',$search_name],'or');
+ }
+ $order=['n_order'=>'asc','n_time'=>'desc'];
+ if($this->table_name=='bsgg'||$this->table_name=='bsyw'){
+ $order=['n_top'=>'desc','n_order'=>'asc','n_time'=>'desc'];
+ }
+ $query=get_query();
+ if(isset($query)&&$page){
+ $query['page']=$page;
+ }
+ $news=Db::name($this->table_name)->where($where)->order($order)->paginate(config('paginate.list_rows'),false,['query'=>$query]);
+
+ $show = $news->render();
+ $this->assign('pageshow',$show);
+ $this->assign('news',$news);
+ $this->assign('n_cid',$n_cid);
+ if(request()->isAjax()){
+ return $this->fetch('news/ajax_news_list');
+ }else{
+ return $this->fetch('news/news_list');
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function news_add()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ if (!request()->isAjax()){
+ //栏目
+ $this->assign('n_cid',$n_cid);
+ $source=Db::name('source')->select();
+ $this->assign('source',$source);
+
+ $source=Db::name('finance')->field('c_id,c_name')->where(['c_status'=>1,'c_kind'=>4])->select();
+ $keys=array_column($source,'c_id');
+ $vals=array_column($source,'c_name');
+ $source=array_combine($keys, $vals);
+ $this->assign('flist',$source);
+ $this->assign('fjson',json_encode($source));
+
+ $this->assign('tablename',$this->table_name);
+ return $this->fetch('news/news_add');
+ }else{
+ //上传图片部分
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ $jumpParam=['cid'=>$n_cid,'page'=>$page];
+ if($this->table_name!='bsgg'){
+ $jumpParam['kind']=$n_kind;
+ }
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+
+ $n_time=input('n_time','');
+ if(empty($n_time))$n_time=time();
+ else $n_time=strtotime($n_time);
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+ $n_pids=isset($_POST['n_pids'])?$_POST['n_pids']:'';
+ $n_order=input('n_order','','intval');
+ $ncid=input('n_cid','','intval');
+ if($ncid)$n_cid=$ncid;
+ $sl_data=array(
+ 'n_title'=>input('n_title'),
+ 'n_cid'=>$n_cid,
+ 'n_source'=>input('n_source',''),
+ 'n_pics'=>$picall_url,//多图路径
+ 'n_img'=>$img_one,//封面图片路径
+ 'n_status'=>input('n_status',0),
+ 'n_desc'=>input('n_desc',''),
+ 'n_content'=>htmlspecialchars_decode(input('n_content')),
+ 'n_uid'=>session('admin_auth.aid'),
+ 'n_time'=>$n_time,
+ 'n_order'=>$n_order,
+ );
+ if($n_pids)$sl_data['n_pids']=is_array($n_pids)?implode(';',$n_pids):'';
+ if($n_kind)$sl_data['n_kind']=$n_kind;
+ $n_top=input('n_top',0,'intval');
+ if($n_top!=='')$sl_data['n_top']=$n_top;
+ $rst=Db::name($this->table_name)->insert($sl_data);
+ $this->assign('tablename',$this->table_name);
+ if($rst){
+ if(empty($n_order)){
+ $lastId=Db::name($this->table_name)->getLastInsID();
+ Db::name($this->table_name)->where(['n_id'=>$lastId])->update(['n_order'=>$lastId]);
+ }
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function news_edit()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['cid'=>$n_cid,'page'=>$page];
+ if($this->table_name!='bsgg'){
+ $jumpParam['kind']=$n_kind;
+ }
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if (!request()->isAjax()) {
+ $n_id = input('n_id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $this->assign('n_cid', $n_cid);
+
+ $source=Db::name('finance')->field('c_id,c_name')->where(['c_status'=>1,'c_kind'=>4])->select();
+ $keys=array_column($source,'c_id');
+ $vals=array_column($source,'c_name');
+ $source=array_combine($keys, $vals);
+ $this->assign('flist',$source);
+ $this->assign('fjson',json_encode($source));
+
+ $news_list = Db::name($this->table_name)->find($n_id);
+ if(isset($news_list['n_pids'])){
+ $pids = array_filter(explode(";", $news_list['n_pids']));
+ $this->assign('pids',json_encode($pids));
+ }else{
+ $this->assign('pids',json_encode([]));
+ }
+
+ //多图字符串转换成数组
+ $pic_list = array_filter(explode(",", $news_list['n_pics']));
+ $this->assign('pic_list', $pic_list);
+ $source = Db::name('source')->select();//来源
+ $this->assign('source', $source);
+ $this->assign('news_list', $news_list);
+ $this->assign('tablename',$this->table_name);
+ return $this->fetch('news/news_edit');
+ }else{
+ $pic_oldlist=input('pic_oldlist');//老多图字符串
+ $img_one='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $files = request()->file('pic_all');
+ //单图
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+ $n_pids=isset($_POST['n_pids'])?$_POST['n_pids']:'';
+ $sl_data=array(
+ 'n_id'=>input('n_id'),
+ 'n_title'=>input('n_title'),
+ 'n_source'=>input('n_source',''),
+ 'n_status'=>input('n_status',0),
+ 'n_desc'=>input('n_desc',''),
+ 'n_content'=>htmlspecialchars_decode(input('n_content')),
+ 'n_order'=>input('n_order',50,'intval'),
+ );
+ if($n_pids){
+ $sl_data['n_pids']=is_array($n_pids)?implode(';',$n_pids):'';
+ }
+ $ncid=input('n_cid','','intval');
+ if($ncid)$sl_data['n_cid']=$ncid;
+ $n_time=input('n_time','');
+ if($n_time)$sl_data['n_time']=strtotime($n_time);
+ if($n_kind)$sl_data['n_kind']=$n_kind;
+ $n_top=input('n_top',0,'intval');
+ if($n_top!=='')$sl_data['n_top']=$n_top;
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['n_img']=$img_one;
+ }
+ $sl_data['n_pics']=$pic_oldlist.$picall_url;
+ $rst=Db::name($this->table_name)->update($sl_data);
+ $this->assign('tablename',$this->table_name);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ /**
+ * 排序
+ */
+ public function news_order()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',$jump);
+ }else{
+ foreach (input('post.') as $n_id => $n_order){
+ Db::name($this->table_name)->update(['n_id'=>$n_id,'n_order'=>$n_order]);
+ }
+ $this->success('排序更新成功',$jump);
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function news_del()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p=input('p');
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['p' => $p,'cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ $rst=Db::name($this->table_name)->delete(input('n_id'));
+ if($rst!==false){
+ $this->success('删除成功',$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function news_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('n_id/a');
+ $n_cid=input('cid',0,'intval');
+ $n_kind=input('kind',0,'intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['p' => $p,'cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'n_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'n_id='.$ids;
+ }
+ $rst=Db::name($this->table_name)->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function news_state()
+ {
+ $id=input('x');
+ $status=Db::name($this->table_name)->where(array('n_id'=>$id))->value('n_status');
+ if($status==1){
+ $statedata = array('n_status'=>0);
+ Db::name($this->table_name)->where(array('n_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('n_status'=>1);
+ Db::name($this->table_name)->where(array('n_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
diff --git a/app/admin/controller/Nwwd.php b/app/admin/controller/Nwwd.php
new file mode 100644
index 0000000..9358bc3
--- /dev/null
+++ b/app/admin/controller/Nwwd.php
@@ -0,0 +1,72 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Nwwd extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='nwwd';
+ $this->controller_name='Nwwd';
+ $this->has_source=false;
+ $this->has_imgs=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function nwwd_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function nwwd_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function nwwd_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function nwwd_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function nwwd_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function nwwd_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function nwwd_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Page.php b/app/admin/controller/Page.php
new file mode 100644
index 0000000..ddb6255
--- /dev/null
+++ b/app/admin/controller/Page.php
@@ -0,0 +1,62 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Request;
+
+class Page extends Base{
+ public function index(){
+ $kind=input('kind');
+ $this->assign('kind',$kind);
+
+ if (request()->isAjax()){
+ $id=input('id');
+ $jumpParam=['kind'=>$kind];
+ $jump=url('index',$jumpParam);
+
+ $n_order=input('sort','','intval');
+ $sl_data=array(
+ 'title'=>input('title'),
+ 'status'=>input('status',0),
+ 'infor'=>input('infor',''),
+ 'content'=>htmlspecialchars_decode(input('content')),
+ 'uid'=>session('admin_auth.aid'),
+ 'create_time'=>time(),
+ 'sort'=>$n_order,
+ );
+ if($kind)$sl_data['kind']=$kind;
+ if($id){
+ unset($sl_data["create_time"]);
+ $rst=Db::name("page")->where(['id'=>$id])->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }else{
+ $rst=Db::name("page")->insert($sl_data);
+ if($rst){
+ if(empty($n_order)||$n_order==50){
+ $lastId=Db::name("page")->getLastInsID();
+ Db::name("page")->where(['id'=>$lastId])->update(['sort'=>$lastId]);
+ }
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ }else{
+ $page=Db::name("page")->where(['kind'=>$kind])->find();
+ $this->assign('page',$page);
+ }
+
+ return $this->fetch();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Plug.php b/app/admin/controller/Plug.php
new file mode 100644
index 0000000..5da7db3
--- /dev/null
+++ b/app/admin/controller/Plug.php
@@ -0,0 +1,460 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Validate;
+
+class Plug extends Base
+{
+ protected $files_res_exists;
+ protected $files_res_used;
+ protected $files_unused;
+ /*
+ * 留言列表
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_sug_list()
+ {
+ $plug_sug=Db::name('plug_sug')->order('plug_sug_open,plug_sug_addtime desc')->paginate(config('paginate.list_rows'));
+ $show=$plug_sug->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('plug_sug',$plug_sug);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_plug_sug_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /*
+ * 留言回复返回数据
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_sug_reply()
+ {
+ $plug_sug_id=input('plug_sug_id');
+ $plug_sug=Db::name('plug_sug')->where(array('plug_sug_id'=>$plug_sug_id))->find();
+ $rule = [
+ ['plug_sug_email','require|email','留言邮箱为空|留言邮箱格式不正确'],
+ ];
+ $validate = new Validate($rule);
+ $rst = $validate->check(array(
+ 'plug_sug_email'=>$plug_sug['plug_sug_email']
+ ));
+ if(true !==$rst){
+ $sl_data['code']=0;
+ $sl_data['msg']=$validate->getError();
+ }else{
+ $sl_data['plug_sug_email']=$plug_sug['plug_sug_email'];
+ $sl_data['plug_sug_name']=$plug_sug['plug_sug_name'];
+ $sl_data['plug_sug_id']=$plug_sug['plug_sug_id'];
+ $sl_data['code']=1;
+ }
+ return json($sl_data);
+ }
+ /*
+ * 留言回复
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_sug_runreply()
+ {
+ $email=input('plug_sug_toemail');
+ $name=input('plug_sug_toname');
+ $plug_sug_id=input('plug_sug_id');
+ $content=htmlspecialchars_decode(input('plug_sug_replycontent'));
+ $send_result=sendMail($email,"Reply:". $name, $content);
+ if($send_result['error']){
+ $this->error('邮箱设置不正确或对方邮箱地址不存在',url('admin/Plug/plug_sug_list'));
+ }else{
+ $rst=Db::name('plug_sug')->where('plug_sug_id',$plug_sug_id)->setField('plug_sug_open',1);
+ if($rst!==false){
+ $this->success('回复留言成功',url('admin/Plug/plug_sug_list'));
+ }else{
+ $this->error('回复留言失败',url('admin/Plug/plug_sug_list'));
+ }
+ }
+ }
+ /*
+ * 留言删除
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_sug_del()
+ {
+ $p = input('p');
+ $plug_sug_id=input('plug_sug_id');
+ $rst=Db::name('plug_sug')->where(array('plug_sug_id'=>$plug_sug_id))->delete();
+ if($rst!==false){
+ $this->success('留言删除成功',url('admin/Plug/plug_sug_list',array('p'=>$p)));
+ }else{
+ $this->error('留言删除失败',url('admin/Plug/plug_sug_list',array('p'=>$p)));
+ }
+ }
+ /*
+ * 留言删除(全选)
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_sug_alldel()
+ {
+ $p = input('p');
+ $ids = input('sug_id/a');
+ if(empty($ids)){
+ $this -> error("请选择删除留言",url('admin/Plug/plug_sug_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'plug_sug_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'plug_sug_id='.$ids;
+ }
+ $rst=Db::name('plug_sug')->where($where)->delete();
+ if($rst!==false){
+ $this->success("留言删除成功!",url('admin/Plug/plug_sug_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除留言失败!",url('admin/Plug/plug_sug_list',array('p' => $p)));
+ }
+ }
+ /*
+ * 本地文件列表
+ * @author rainfer <81818832@qq.com>
+ */
+ public function plug_file_list()
+ {
+ $map=array();
+ //查询:时间格式过滤
+ $sldate=input('reservation','');//获取格式 2015-11-12 - 2015-11-18
+ $arr = explode(" - ",$sldate);//转换成数组
+ if(count($arr)==2){
+ $arrdateone=strtotime($arr[0]);
+ $arrdatetwo=strtotime($arr[1].' 23:55:55');
+ $map['uptime'] = array(array('egt',$arrdateone),array('elt',$arrdatetwo),'AND');
+ }
+ //查询文件路径
+ $val=input('val');
+ if(!empty($val)){
+ $map['path']= array('like',"%".$val."%");
+ }
+ $plug_files=Db::name('plug_files')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $plug_files->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('plug_files',$plug_files);
+ $this->assign('sldate',$sldate);
+ $this->assign('val',$val);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_plug_file_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 文件过滤
+ */
+ public function plug_file_filter()
+ {
+ //获取本地文件数组,'./data/upload/2016-01-21/56a03ff96b6ff.jpg' => int 224138
+ $file_list=list_file('data/upload');
+ $path="/data/upload/";
+ $this->files_res_exists=array();
+ foreach ($file_list as $a){
+ if ($a ['isDir']) {
+ foreach (list_file($a ['pathname'] . '/') as $d) {
+ if (!$d ['isDir']) {
+ //文件
+ if($d['ext']!='html' && $d['ext']!='lock'){
+ $this->files_res_exists [$path . $a ['filename'] . '/' . $d ['filename']] = $d ['size'];
+ }
+ }
+ }
+ }
+ }
+ //获取数据表datafile已存记录,并删除资源数组里的成员,完毕后得到未存入数据表datafile的资源文件
+ $datas = Db::name('plug_files')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ $f = $d ['path'];
+ if (isset ($this->files_res_exists [$f])) {
+ unset ($this->files_res_exists [$f]);
+ }
+ }
+ }
+ //未存入数据表的数据写入数据表
+ $time=time();
+ foreach ($this->files_res_exists as $d => $v) {
+ Db::name('plug_files')->insert(array(
+ 'path' => $d,
+ 'uptime' => $time,
+ 'filesize' => $v
+ ));
+ }
+ //获取利用到的资源文件
+ $this->files_res_used=array();
+ //avatar,涉及表admin里字段admin_avatar,member_list里member_list_headpic,头像只保存头像图片名
+ $datas = Db::name('admin')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ if($d['admin_avatar']){
+ if(stripos($d['admin_avatar'],'http')===false){
+ //本地头像
+ $this->files_res_used['/data/upload/avatar/' . $d['admin_avatar']]=true;
+ }
+ }
+ }
+ }
+ $datas = Db::name('member_list')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ if($d['member_list_headpic']){
+ if(stripos($d['member_list_headpic'],'http')===false){
+ //本地头像
+ $this->files_res_used['/data/upload/avatar/' . $d['member_list_headpic']]=true;
+ }
+ }
+ }
+ }
+ //news里的news_img,news_pic_allurl,news_content
+ $datas = Db::name('news')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ //字段保存'/data/....'
+ if($d['news_img']){
+ if(stripos($d['news_img'],'http')===false){
+ $this->files_res_used[$d['news_img']]=true;
+ }
+ }
+ //字段保存'/data/....'
+ if($d['news_pic_allurl']){
+ $imgs=array_filter(explode(",",$d['news_pic_allurl']));
+ foreach ($imgs as &$f) {
+ if(stripos($f,'http')===false && !empty($f)){
+ $this->files_res_used[$f]=true;
+ }
+ }
+ }
+ if($d['news_content']){
+ //匹配'/网站目录/data/....'
+ $preg_match=__ROOT__.'\/data\/upload\/([0-9]{4}[-][0-9]{2}[-][0-9]{2}\/[a-z0-9]{13}\.[a-z0-9]+)/i';
+ @preg_match_all($preg_match, $d['news_content'], $mat);
+ if(!empty($mat [1])){
+ foreach ($mat [1] as &$f) {
+ $this->files_res_used['/data/upload/'.$f]=true;
+ }
+ }
+
+ //匹配'./data/....'
+ $preg_match='/\.\/data\/upload\/([0-9]{4}[-][0-9]{2}[-][0-9]{2}\/[a-z0-9]{13}\.[a-z0-9]+)/i';
+ @preg_match_all($preg_match, $d['news_content'], $mat);
+ if(!empty($mat [1])){
+ foreach ($mat [1] as &$f) {
+ $this->files_res_used['/data/upload/'.$f]=true;
+ }
+ }
+ }
+ }
+ }
+ //options里'option_name'=>'site_options'的site_logo、site_qr,字段保存'/data/....'
+ $datas = Db::name('options')->where(array('option_name'=>'site_options'))->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ if($d['option_value']){
+ $smeta=json_decode($d['option_value'],true);
+ if($smeta['site_logo'] && stripos($smeta['site_logo'],'http')===false){
+ $this->files_res_used[$smeta['site_logo']]=true;
+ }
+ if(!empty($smeta['site_qr']) && stripos($smeta['site_qr'],'http')===false){
+ $this->files_res_used[$smeta['site_qr']]=true;
+ }
+ }
+ }
+ }
+ //plug_ad里plug_ad_pic,字段保存'/data/....'
+ $datas = Db::name('plug_ad')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ if($d['plug_ad_pic']){
+ if(stripos($d['plug_ad_pic'],'http')===false){
+ //本地图片
+ $this->files_res_used[$d['plug_ad_pic']]=true;
+ }
+ }
+ }
+ }
+ //menu里menu_img,字段保存'/data/....'
+ $datas = Db::name('menu')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ if($d['menu_img']){
+ if(stripos($d['menu_img'],'http')===false){
+ //本地图片
+ $this->files_res_used[$d['menu_img']]=true;
+ }
+ }
+ }
+ }
+ //model自定义模型
+ $table_arr=Db::name('model')->column('model_name,model_fields','model_name');
+ foreach ($table_arr as $table=>$fields){
+ $fields=json_decode($fields,true);
+ foreach ($fields as $field){
+ //文件或图片或富文本字段
+ if(in_array($field['type'],['imagefile','images','file','files','richtext'])){
+ $datas=Db::name($table)->field($field['name'])->select();
+ foreach ($datas as $d) {
+ if($d[$field['name']]){
+ if($field['type']=='richtext'){
+ //匹配'/网站目录/data/....'
+ $preg_match=__ROOT__.'\/data\/upload\/([0-9]{4}[-][0-9]{2}[-][0-9]{2}\/[a-z0-9]{13}\.[a-z0-9]+)/i';
+ @preg_match_all($preg_match, $d[$field['name']], $mat);
+ if(!empty($mat [1])){
+ foreach ($mat [1] as &$f) {
+ $this->files_res_used['/data/upload/'.$f]=true;
+ }
+ }
+
+ //匹配'./data/....'
+ $preg_match='/\.\/data\/upload\/([0-9]{4}[-][0-9]{2}[-][0-9]{2}\/[a-z0-9]{13}\.[a-z0-9]+)/i';
+ @preg_match_all($preg_match, $d[$field['name']], $mat);
+ if(!empty($mat [1])){
+ foreach ($mat [1] as &$f) {
+ $this->files_res_used['/data/upload/'.$f]=true;
+ }
+ }
+ }elseif($field['type']=='imagefile' || $field['type']=='file'){
+ if(stripos($d[$field['name']],'http')===false){
+ //本地图片
+ $this->files_res_used[$d[$field['name']]]=true;
+ }
+ }else{
+ //字段保存'/data/....'
+ if($d[$field['name']]){
+ $imgs=array_filter(explode(",",$d[$field['name']]));
+ foreach ($imgs as &$f) {
+ if(stripos($f,'http')===false && !empty($f)){
+ $this->files_res_used[$f]=true;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ //找出未使用的资源文件
+ $this->files_unused=array();
+ $ids=array();
+ $datas = Db::name('plug_files')->select();
+ if (is_array($datas)) {
+ foreach ($datas as &$d) {
+ $f = $d ['path'];
+ if (isset ($this->files_res_used[$f])) {
+ unset ($this->files_res_used[$f]);
+ } else {
+ $ids[]=$d ['id'];
+ $this->files_unused [] = array(
+ 'id' => $d ['id'],
+ 'filesize' =>$d['filesize'],
+ 'path' => $f,
+ 'uptime' => $d ['uptime']
+ );
+ }
+ }
+ }
+ //数据库
+ $where=array();
+ $plug_files=array();
+ $show='';
+ if(!empty($ids)){
+ $where['id']=array('in',$ids);
+ $plug_files=Db::name('plug_files')->where($where)->order('id desc')->paginate(config('paginate.list_rows'));
+ $show = $plug_files->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ }
+ $this->assign('plug_files',$plug_files);
+ $this->assign('page',$show);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_plug_file_filter');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 文件删除(全选)
+ */
+ public function plug_file_alldel(){
+ $p = input('p');
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择要删除的文件",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ foreach (Db::name('plug_files')->field('path')->where($where)->select() as $r) {
+ $file = $r ['path'];
+ if(stripos($file, "/")===0){
+ $file=substr($file,1);
+ }
+ if (file_exists($file)) {
+ unlink($file);
+ }
+ }
+ if (Db::name('plug_files')->where($where)->delete()!==false) {
+ $this->success("删除文件成功!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ } else {
+ $this->error("删除文件失败!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ }else{
+ $r=Db::name('plug_files')->find($ids);
+ if($r){
+ $file=$r['path'];
+ if(stripos($file, "/")===0){
+ $file=substr($file,1);
+ }
+ if (file_exists($file)) {
+ unlink($file);
+ }
+ if (Db::name('plug_files')->delete($ids)!==false) {
+ $this->success("删除文件成功!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }else{
+ $this->error("删除文件失败!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ }else{
+ $this->error("删除文件失败!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ }
+ }
+ /**
+ * 文件删除
+ */
+ public function plug_file_del()
+ {
+ $id=input('id');
+ $p = input('p');
+ if (empty($id)){
+ $this->error('参数错误',url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }else{
+ $r=Db::name('plug_files')->find($id);
+ if($r){
+ $file=$r['path'];
+ if(stripos($file, "/")===0){
+ $file=substr($file,1);
+ }
+ if (file_exists($file)) {
+ unlink($file);
+ }
+ if (Db::name('plug_files')->delete($id)!==false) {
+ $this->success("删除文件成功!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }else{
+ $this->error("删除文件失败!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ }else{
+ $this->error("删除文件失败!",url('admin/Plug/plug_file_filter',array('p'=>$p)));
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Product.php b/app/admin/controller/Product.php
new file mode 100644
index 0000000..065b34f
--- /dev/null
+++ b/app/admin/controller/Product.php
@@ -0,0 +1,881 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Image;
+
+class Product extends Base
+{
+ protected $table_name='product';
+ protected $controller_name='product';
+ protected $has_img=true;
+ protected $maps=[];
+ protected $has_imgs=true;
+ protected $has_source=true;
+ public function _initialize()
+ {
+ parent::_initialize();
+ $this->assign('table_name',$this->table_name);
+ $this->assign('controller',$this->controller_name);
+ $this->assign('has_img',$this->has_img);
+ $this->assign('has_imgs',$this->has_imgs);
+ $this->assign('has_source',$this->has_source);
+
+ $maps=[
+ '58'=>['name'=>'书画篆刻'],
+ '59'=>['name'=>'工艺作品'],
+ '60'=>['name'=>'造型艺术'],
+ '61'=>['name'=>'玉翠珠宝'],
+ '62'=>['name'=>'文玩杂项'],
+ '63'=>['name'=>'其他'],
+ ];
+ $types=Db::name('type')->where(['type_type'=>58])->select();
+ $maps['58']['childs']=$types;
+ $types=Db::name('type')->where(['type_type'=>59])->select();
+ $maps['59']['childs']=$types;
+ $types=Db::name('type')->where(['type_type'=>60])->select();
+ $maps['60']['childs']=$types;
+ $types=Db::name('type')->where(['type_type'=>61])->select();
+ $maps['61']['childs']=$types;
+ $types=Db::name('type')->where(['type_type'=>62])->select();
+ $maps['62']['childs']=$types;
+ $types=Db::name('type')->where(['type_type'=>63])->select();
+ $maps['63']['childs']=$types;
+ $this->maps=$maps;
+ }
+
+ public function show_list(){
+ $this->assign('table_name','show');
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $where=[];
+ $list=Db::name('proquarter')->where($where)->order(['sort'=>'asc','create_time'=>'desc'])->paginate(config('paginate.list_rows'),false,['query'=>get_query(),'page'=>$page]);
+ $show = $list->render();
+ $this->assign('pageshow',$show);
+ $this->assign('list',$list);
+ if(request()->isAjax()){
+ return $this->fetch('product/ajax_show_list');
+ }else{
+ return $this->fetch('product/show_list');
+ }
+ }
+ /**
+ * 排序
+ */
+ public function show_order()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/show_list',$jumpParam);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',$jump);
+ }else{
+ foreach (input('post.') as $n_id => $sort){
+ Db::name('proquarter')->update(['id'=>$n_id,'sort'=>$sort]);
+ }
+ $this->success('排序更新成功',$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function show_del($id='')
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/show_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ $rst=Db::name('proquarter')->where(['id'=>$id])->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function show_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/show_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('proquarter')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ public function category_list(){
+ $this->assign('table_name','category');
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $types=Db::name('proquarter')->field('id,title')->select();
+ $map=[];
+ if(count($types)){
+ $ids=array_search_key('id',$types);
+ $titles=array_search_key('title',$types);
+ $map=array_combine($ids,$titles);
+ }
+
+ $this->assign('types',$map);
+ $where=[];
+ $list=Db::name('procategory')->where($where)->order(['sort'=>'desc','create_time'=>'desc'])->paginate(config('paginate.list_rows'),false,['query'=>get_query(),'page'=>$page]);
+ $show = $list->render();
+ $this->assign('pageshow',$show);
+ $this->assign('list',$list);
+ if(request()->isAjax()){
+ return $this->fetch('product/ajax_category_list');
+ }else{
+ return $this->fetch('product/category_list');
+ }
+ }
+ public function category_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/category_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('procategory')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ public function category_del($id=''){
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('id/a');
+ $jumpParam=['p' => $p,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/category_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ $rst=Db::name('procategory')->where(['id'=>$id])->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 排序
+ */
+ public function category_order()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/category_list',$jumpParam);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',$jump);
+ }else{
+ foreach (input('post.') as $n_id => $sort){
+ Db::name('procategory')->update(['id'=>$n_id,'sort'=>$sort]);
+ }
+ $this->success('排序更新成功',$jump);
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function category_add()
+ {
+ $this->table_name='procategory';
+ $this->assign('table_name','category');
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $types=Db::name('proquarter')->select();
+ $this->assign('types',$types);
+ if (!request()->isAjax()){
+ //栏目
+ return $this->fetch('product/category_add');
+ }else{
+ //上传图片部分
+ $img_one='';
+ $img_one2='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/category_list',$jumpParam);
+
+ $ret=$this->dealFile($file,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ }
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+ $sort=input('sort','','intval');
+ $sl_data=array(
+ 'title'=>input('title'),
+ 'pid'=>input('pid'),
+ 'style'=>input('style'),
+ 'style2'=>input('style2'),
+ 'uid'=>session('admin_auth.aid'),
+ 'status'=>input('status',0),
+ 'poster'=>$img_one,//封面图片路径
+ 'create_time'=>time(),
+ 'sort'=>$sort,
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['poster']=$img_one;
+ }
+ if(!empty($img_one2)){
+ $sl_data['poster2']=$img_one2;
+ }
+ $rst=Db::name($this->table_name)->insert($sl_data);
+ if($rst){
+ if(empty($sort)){
+ $lastId=Db::name($this->table_name)->getLastInsID();
+ Db::name($this->table_name)->where(['id'=>$lastId])->update(['sort'=>$lastId]);
+ }
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function category_edit()
+ {
+ $types=Db::name('proquarter')->select();
+ $this->assign('types',$types);
+ $this->assign('table_name','category');
+ $this->table_name='procategory';
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/category_list',$jumpParam);
+ if (!request()->isAjax()) {
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $product_list = Db::name($this->table_name)->find($n_id);
+
+ $this->assign('list', $product_list);
+ return $this->fetch('product/category_edit');
+ }else{
+
+ $img_one='';
+ $img_one2='';
+ $button='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ //单图
+ $ret=$this->dealFile($file,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ }
+
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+ $sl_data=array(
+ 'id'=>input('id'),
+ 'pid'=>input('pid'),
+ 'style'=>input('style'),
+ 'style2'=>input('style2'),
+ 'title'=>input('title'),
+ 'status'=>input('status',0),
+ 'sort'=>input('sort',50,'intval'),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['poster']=$img_one;
+ }
+
+ if(!empty($img_one2)){
+ $sl_data['poster2']=$img_one2;
+ }
+ $rst=Db::name($this->table_name)->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function show_add()
+ {
+ $this->table_name='proquarter';
+ $this->assign('table_name','show');
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+
+ if (!request()->isAjax()){
+ //栏目
+ return $this->fetch('product/show_add');
+ }else{
+ //上传图片部分
+ $img_one='';
+ $img_one2='';
+ $button='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $file3 = request()->file('pic_one3');
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/show_list',$jumpParam);
+
+ $ret=$this->dealFile($file,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ }
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+ $ret=$this->dealFile($file3,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$button=$ret['img_one'];
+ }
+ $sort=input('sort','','intval');
+ $sl_data=array(
+ 'title'=>input('title'),
+ 'address'=>input('address'),
+ 'open_time'=>input('open_time'),
+ 'infor'=>input('infor'),
+ 'color'=>input('color'),
+ 'fcolor'=>input('fcolor'),
+ 'style'=>input('style'),
+ 'music'=>input('music'),
+ 'uid'=>session('admin_auth.aid'),
+ 'status'=>input('status',0),
+ 'poster'=>$img_one,//封面图片路径
+ 'create_time'=>time(),
+ 'sort'=>$sort,
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['poster']=$img_one;
+ }
+ if(!empty($img_one2)){
+ $sl_data['poster2']=$img_one2;
+ }
+ if(!empty($button)){
+ $sl_data['button']=$button;
+ }
+ $rst=Db::name($this->table_name)->insert($sl_data);
+ if($rst){
+ if(empty($sort)){
+ $lastId=Db::name($this->table_name)->getLastInsID();
+ Db::name($this->table_name)->where(['id'=>$lastId])->update(['sort'=>$lastId]);
+ }
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function show_edit()
+ {
+ $this->assign('table_name','show');
+ $this->table_name='proquarter';
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $jumpParam=['page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/show_list',$jumpParam);
+ if (!request()->isAjax()) {
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $product_list = Db::name($this->table_name)->find($n_id);
+
+ $this->assign('list', $product_list);
+ return $this->fetch('product/show_edit');
+ }else{
+
+ $img_one='';
+ $img_one2='';
+ $button='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $file3 = request()->file('pic_one3');
+ //单图
+ $ret=$this->dealFile($file,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ }
+
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+ $ret=$this->dealFile($file3,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$button=$ret['img_one'];
+ }
+ $sl_data=array(
+ 'id'=>input('id'),
+ 'infor'=>input('infor'),
+ 'address'=>input('address'),
+ 'open_time'=>input('open_time'),
+ 'title'=>input('title'),
+ 'style'=>input('style'),
+ 'color'=>input('color'),
+ 'fcolor'=>input('fcolor'),
+ 'music'=>input('music'),
+ 'status'=>input('status',0),
+ 'sort'=>input('sort',50,'intval'),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['poster']=$img_one;
+ }
+
+ if(!empty($img_one2)){
+ $sl_data['poster2']=$img_one2;
+ }
+ if(!empty($button)){
+ $sl_data['button']=$button;
+ }
+ $rst=Db::name($this->table_name)->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ /**
+ * 列表
+ */
+ public function product_list()
+ {
+ $search_name=input('search_name','');
+ $this->assign('search_name',$search_name);
+ //栏目
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $page=input('page',1,'intval');
+ $postPage=input('post.page','','intval');
+ if($postPage)$page=$postPage;
+ $this->assign('page',$page);
+ $this->assign('n_kind',$n_kind);
+ $where=[];
+ if($n_cid)$where['cid']=$n_cid;
+ if($n_kind)$where['kind']=$n_kind;
+ $db=Db::name($this->table_name)->where($where);
+ if($search_name){
+ $db->where('title','like','%'.$search_name.'%');
+ }
+ $news=$db->order(['sort'=>'asc','create_time'=>'desc'])->paginate(10,false,['query'=>get_query(),'page'=>$page]);
+ $show = $news->render();
+ $this->assign('pageshow',$show);
+ $this->assign('news',$news);
+ $this->assign('n_cid',$n_cid);
+ if(request()->isAjax()){
+ return $this->fetch('product/ajax_product_list');
+ }else{
+ return $this->fetch('product/product_list');
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function product_add()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+
+ $this->assign('types',$this->maps);
+ if (!request()->isAjax()){
+ //栏目
+ $this->assign('n_cid',$n_cid);
+ return $this->fetch('product/product_add');
+ }else{
+ //上传图片部分
+ $img_one='';
+ $img_one2='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $files = request()->file('pic_all');
+ $jumpParam=['cid'=>$n_cid,'page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+
+ $sort=input('sort','','intval');
+ $sl_data=array(
+ 'title'=>input('title'),
+ 'kind'=>input('kind'),
+ 'year'=>input('year'),
+ 'weight'=>input('weight'),
+ 'author'=>input('author'),
+ 'size'=>input('size'),
+ 'price'=>input('price'),
+ 'gprice'=>input('gprice'),
+ 'video'=>input('video'),
+ 'code'=>input('code'),
+ 'style'=>input('style'),
+ 'description'=>input('description'),
+ 'topic'=>input('topic'),
+ 'material'=>input('material'),
+ 'uid'=>session('admin_auth.aid'),
+ 'status'=>input('status',0),
+ 'cid'=>$n_cid,
+ 'photos'=>$picall_url,//多图路径
+ 'poster'=>$img_one,//封面图片路径
+ 'xcode'=>$img_one2,//封面图片路径
+ 'link'=>input('link'),
+ 'kind'=>input('kind'),
+ 'create_time'=>time(),
+ 'sort'=>$sort,
+ );
+ $rst=Db::name($this->table_name)->insert($sl_data);
+ if($rst){
+ if(empty($sort)){
+ $lastId=Db::name($this->table_name)->getLastInsID();
+ Db::name($this->table_name)->where(['id'=>$lastId])->update(['sort'=>$lastId]);
+ }
+ $this->success('添加成功',$jump);
+ }else{
+ $this->error('添加失败',$jump);
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function product_edit()
+ {
+ $this->assign('types',$this->maps);
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['cid'=>$n_cid,'page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if (!request()->isAjax()) {
+ $n_id = input('id');
+ if (empty($n_id)) {
+ $this->error('参数错误', $jump);
+ }
+ $this->assign('n_cid', $n_cid);
+ $product_list = Db::name($this->table_name)->find($n_id);
+
+ //多图字符串转换成数组
+ $pic_list = array_filter(explode(",", $product_list['photos']));
+ $this->assign('pic_list', $pic_list);
+ $source = Db::name('source')->select();//来源
+ $this->assign('source', $source);
+ $this->assign('list', $product_list);
+ return $this->fetch('product/product_edit');
+ }else{
+ $pic_oldlist=input('pic_oldlist');//老多图字符串
+ $img_one='';
+ $img_one2='';
+ $picall_url='';
+ $file = request()->file('pic_one');
+ $file2 = request()->file('pic_one2');
+ $files = request()->file('pic_all');
+ //单图
+ $ret=$this->dealFile($file,$files);
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one=$ret['img_one'];
+ if(isset($ret['picall_url'])&&$ret['picall_url'])$picall_url=$ret['picall_url'];
+ }
+ $ret=$this->dealFile($file2,'');
+ if(isset($ret['error'])){
+ $this->error($ret['error'],$jump);
+ }else{
+ if(isset($ret['img_one'])&&$ret['img_one'])$img_one2=$ret['img_one'];
+ }
+ $sl_data=array(
+ 'id'=>input('id'),
+ 'year'=>input('year'),
+ 'kind'=>input('kind'),
+ 'weight'=>input('weight'),
+ 'title'=>input('title'),
+ 'author'=>input('author'),
+ 'size'=>input('size'),
+ 'price'=>input('price'),
+ 'gprice'=>input('gprice'),
+ 'video'=>input('video'),
+ 'code'=>input('code'),
+ 'style'=>input('style'),
+ 'description'=>input('description'),
+ 'topic'=>input('topic'),
+ 'material'=>input('material'),
+ 'status'=>input('status',0),
+ 'link'=>input('link'),
+ 'kind'=>input('kind'),
+ 'sort'=>input('sort',50,'intval'),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['poster']=$img_one;
+ }
+ if(!empty($img_one2)){
+ $sl_data['xcode']=$img_one2;//封面图片路径
+ }
+ $sl_data['photos']=$pic_oldlist.$picall_url;
+
+ $rst=Db::name($this->table_name)->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',$jump);
+ }else{
+ $this->error('修改失败',$jump);
+ }
+ }
+ }
+ /**
+ * 处理上传图片
+ * @param string $file
+ * @param string $files
+ * @return NULL[]|string[]
+ */
+ protected function dealFile($file='',$files=''){
+ $validate = config('upload_validate');
+ $img_one='';
+ $picall_url='';
+ //单图
+ if (!empty($file)) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ $imgfile='.'.$img_url;
+ //等比例宿放
+ if(file_exists($imgfile)){
+ $image=Image::open($imgfile);
+ $width=$image->width();
+ $height=$image->height();
+ if($width>1000){
+ $nhei=(1000/$width)*$height;
+ $image->thumb(1000,$nhei);
+ $image->save($imgfile);
+ }
+ }
+
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+
+ return ['error'=>$file[0]->getError()];
+ }
+ }
+ //多图
+ if (!empty($files)) {
+ foreach ($files as $file) {
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ $imgfile='.'.$img_url;
+ //等比例宿放
+ if(file_exists($imgfile)){
+ $image=Image::open($imgfile);
+ $width=$image->width();
+ $height=$image->height();
+ if($width>1000){
+ $nhei=(1000/$width)*$height;
+ $image->thumb(1000,$nhei);
+ $image->save($imgfile);
+ }
+ }
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $picall_url = $img_url . ',' . $picall_url;
+ } else {
+ return ['error'=>$file[0]->getError()];
+ }
+ }
+ }
+ return ['img_one'=>$img_one,'picall_url'=>$picall_url];
+ }
+ /**
+ * 排序
+ */
+ public function product_order()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',$jump);
+ }else{
+ foreach (input('post.') as $n_id => $sort){
+ Db::name($this->table_name)->update(['id'=>$n_id,'sort'=>$sort]);
+ }
+ $this->success('排序更新成功',$jump);
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function product_del()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p=input('p');
+ $n_cid=input('cid','','intval');
+ $n_kind=input('kind','','intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['p' => $p,'cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ $rst=Db::name($this->table_name)->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function product_alldel()
+ {
+ $page=input('page','','intval');
+ $this->assign('page',$page);
+ $p = input('p');
+ $ids = input('id/a');
+ $n_cid=input('cid',0,'intval');
+ $n_kind=input('kind',0,'intval');
+ $this->assign('n_kind',$n_kind);
+ $jumpParam=['p' => $p,'cid'=>$n_cid,'kind'=>$n_kind,'page'=>$page];
+
+ $jump=url('admin/'.$this->controller_name.'/'.$this->table_name.'_list',$jumpParam);
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",$jump);
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name($this->table_name)->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",$jump);
+ }else{
+ $this -> error("删除失败!",$jump);
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function product_state()
+ {
+
+ $id=input('x');
+ $status=Db::name($this->table_name)->where(array('id'=>$id))->value('status');
+ if($status==1){
+ $statedata = array('status'=>0);
+ Db::name($this->table_name)->where(array('id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name($this->table_name)->where(array('nid'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Rczp.php b/app/admin/controller/Rczp.php
new file mode 100644
index 0000000..515ff75
--- /dev/null
+++ b/app/admin/controller/Rczp.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Rczp extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='rczp';
+ $this->controller_name='Rczp';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 本所荣誉列表
+ */
+ public function rczp_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function rczp_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function rczp_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function rczp_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function rczp_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function rczp_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function rczp_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Region.php b/app/admin/controller/Region.php
new file mode 100644
index 0000000..2e5ae4f
--- /dev/null
+++ b/app/admin/controller/Region.php
@@ -0,0 +1,162 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+use think\Db;
+class Region extends Base
+{
+ public function region_list(){
+ $key=input('key');
+ $where['pid']=0;
+ $province=input('province','');
+ $this->assign('province',$province);
+ if($province !== ''){
+ $where['pid']=$province;
+ }
+ $city=input('city','');
+ $this->assign('city',$city);
+ if($city !== ''){
+ $cityfind=DB::name('region')->where(array('type'=>2,'pid'=>$province,'id'=>$city))->find();
+ if($cityfind){
+ $where['pid']=$city;
+ }else{
+ $this->assign('city','');
+ }
+ }
+ if($where['pid']==0){
+ $where['pid']=array(array('eq',0),array('eq',1),'or');;
+ }
+
+ $province_list=DB::name('region')->where(array('type'=>1))->order('id,pid')->select();
+ $this->assign('province_list',$province_list);
+ $city_list=DB::name('region')->where(array('type'=>2,'pid'=>$province))->order('id,pid')->select();
+ $this->assign('city_list',$city_list);
+ $region_list=DB::name('region')->where($where)->where('name','like',"%".$key."%")->order('id,pid')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show=$region_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('region_list',$region_list);
+ $this->assign('page',$show);
+ $this->assign('val',$key);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_region_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+
+ public function region_add(){
+ $province = Db::name('Region')->where ( array('pid'=>1) )->select ();
+ $this->assign('province',$province);
+ return $this->fetch();
+ }
+
+ public function region_runadd(){
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Region/region_add'));
+ }else{
+ $input_type=input('input_type',0);
+ $province=input('region_list_province');
+ $city=input('region_list_city');
+ if($input_type==2){
+ if(!$province){
+ $this->error('请选择省份',url('admin/Region/region_add'));
+ }
+ $pid=$province;
+ }elseif($input_type==3){
+ if(!$city){
+ $this->error('请选择城市',url('admin/Region/region_add'));
+ }
+ $pid=$city;
+ }else{
+ $pid=1;
+ }
+
+ $sl_data=array(
+ 'pid'=>$pid,
+ 'name'=>input('areaname'),
+ 'type' => $input_type,
+ );
+
+ $rst=DB::name('region')->insert($sl_data);
+ if($rst!==false){
+ $this->success('添加成功',url('admin/Region/region_list',array('province'=>$province,'city'=>$city)));
+ }else{
+ $this->error('添加失败',url('admin/Region/region_add'));
+ }
+ }
+ }
+
+ public function region_edit(){
+ $editdata = Db::name('Region')->where ( array('id'=>input('id')) )->find();
+ $this->assign('editdata',$editdata);
+ $province = Db::name('Region')->where ( array('pid'=>1) )->select ();
+ $this->assign('province',$province);
+ if($editdata['type']==2){//市
+ $provincedata = Db::name('Region')->where ( array('id'=>$editdata['pid']) )->find();
+ $this->assign('provinceid',$provincedata['id']);
+ $this->assign('cityid',0);
+ }elseif($editdata['type']==3){//县
+ $citydata = Db::name('Region')->where ( array('id'=>$editdata['pid']) )->find();
+ $provincedata = Db::name('Region')->where ( array('id'=>$citydata['pid']) )->find();
+ $this->assign('cityid',$citydata['id']);
+ $this->assign('provinceid',$provincedata['id']);
+ $city = Db::name('Region')->where ( array('pid'=>$citydata['pid']) )->select();
+ $this->assign('city',$city);
+ }else{//省
+ $this->assign('provinceid',0);
+ $this->assign('cityid',0);
+ }
+ return $this->fetch();
+ }
+
+ public function region_runedit(){
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Region/region_add'));
+ }else{
+ $input_type=input('input_type',0);
+ $province=input('region_list_province');
+ $city=input('region_list_city');
+ if($input_type==2){
+ if(!$province){
+ $this->error('请选择省份',url('admin/Region/region_edit'));
+ }
+ $pid=$province;
+ }elseif($input_type==3){
+ if(!$city){
+ $this->error('请选择城市',url('admin/Region/region_edit'));
+ }
+ $pid=$city;
+ }else{
+ $pid=1;
+ }
+
+ $sl_data['pid']=$pid;
+ $sl_data['name']=input('areaname');
+ $sl_data['type']=$input_type;
+
+ $rst=DB::name('region')->where(array('id'=>input('regionid')))->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Region/region_list',array('province'=>$province,'city'=>$city)));
+ }else{
+ $this->error('修改失败',url('admin/Region/region_edit'));
+ }
+ }
+ }
+
+ public function region_del()
+ {
+ $id=input('id');
+ $rst=Db::name('region')->where('id',$id)->delete();
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Region/region_list'));
+ }else{
+ $this->error('删除失败',url('admin/Region/region_list'));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Roadshow.php b/app/admin/controller/Roadshow.php
new file mode 100644
index 0000000..a17092b
--- /dev/null
+++ b/app/admin/controller/Roadshow.php
@@ -0,0 +1,308 @@
+order('sort,create_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $roadshow_list->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('roadshow_list',$roadshow_list);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_roadshow_list');
+ }else{
+ return $this->fetch('roadshow_list');
+ }
+ }
+
+ /**
+ * 添加显示
+ */
+ public function roadshow_add()
+ {
+ if (!request()->isAjax()){
+ return $this->fetch('roadshow_add');
+ }else{
+ $count=Db::name('lypt')-> count();
+ if($count>=24){
+ $this->error('最多上传24个视频文件!',url('admin/Roadshow/roadshow_list'));
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcwhcyb/whcybly_list',['whcyb_type'=>$type]));
+ }
+ }
+ //视频(使用oss)
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ if(config('aliyun_oss.oss_open')){
+ $config=config('aliyun_oss');
+ $oss=new \OSS\OssClient($config['accesskey'],$config['secretkey'],$config['endpoint'],true);
+ foreach ($files as $file) {
+ $fileinfo=$file->getInfo();
+ $size_list= $fileinfo['size'];
+ if($size_list>209715200){
+ $this->error('不能上传超过200M的视频文件!', url('admin/Roadshow/roadshow_list'));//限制上传大小
+ }
+ $filename=$fileinfo['name'];
+ $path=$fileinfo['tmp_name'];
+ try{
+ $oss->uploadFile($config['bucket'],$filename,$path);
+ } catch(OssException $e) {
+ $this->error($e->getMessage(), url('admin/Roadshow/roadshow_list'));//否则就是上传错误,显示错误原因
+ }
+ $file_url = $config['endpoint'].'/'.$filename;
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $fileinfo['size'];
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ }
+ }else{
+ foreach ($files as $file) {
+ $info = $file->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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Roadshow/roadshow_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ }
+ $sl_data=array(
+ 'name'=>input('name'),
+ 'activity_introduce'=>input('activity_introduce'),
+ 'start_time'=>input('start_time','')?strtotime(input('start_time','')):time(),
+ 'host_unit'=>input('host_unit'),
+ 'status'=>input('status',0),
+ 'create_uid'=>session('admin_auth.aid'),
+ 'create_time'=>time(),
+ 'sort'=>input('sort',20,'intval'),
+ 'video'=>$fileall_url,
+ 'pic'=>$img_one,
+ );
+ $rst=Db::name('lypt')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Roadshow/roadshow_list'));
+ }else{
+ $this->error('添加失败',url('admin/Roadshow/roadshow_list'));
+ }
+ }
+
+ }
+ }
+
+ /**
+ * 编辑显示
+ */
+ public function roadshow_edit()
+ {
+ if (!request()->isAjax()) {
+ $id = input('id');
+ if (empty($id)) {
+ if($id){
+ $this->error('参数错误', url('admin/Roadshow/roadshow_list'));
+ }else{
+ $this->error('参数错误', url('admin/Roadshow/roadshow_list'));
+ }
+ }
+ $roadshow_list = Db::name('lypt')->find($id);
+ $this->assign('roadshow_list', $roadshow_list);
+ return $this->fetch('roadshow_edit');
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Lcwhcyb/whcybly_list',['whcyb_type'=>$type]));
+ }
+ }
+ //视频
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ if(config('aliyun_oss.oss_open')){
+ $config=config('aliyun_oss');
+ $oss=new \OSS\OssClient($config['accesskey'],$config['secretkey'],$config['endpoint'],true);
+ foreach ($files as $file) {
+ $fileinfo=$file->getInfo();
+ $size_list= $fileinfo['size'];
+ if($size_list>209715200){
+ $this->error('不能上传超过200M的视频文件!', url('admin/Roadshow/roadshow_list'));//限制上传大小
+ }
+ $filename=$fileinfo['name'];
+ $path=$fileinfo['tmp_name'];
+ try{
+ $oss->uploadFile($config['bucket'],$filename,$path);
+ } catch(OssException $e) {
+ $this->error($e->getMessage(), url('admin/Roadshow/roadshow_list'));//否则就是上传错误,显示错误原因
+ }
+ $file_url = $config['endpoint'].'/'.$filename;
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $fileinfo['size'];
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ }
+ }else{
+ foreach ($files as $file) {
+ $info = $file->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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Roadshow/roadshow_list'));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ }
+ $sl_data=array(
+ 'id'=>input('id'),
+ 'name'=>input('name'),
+ 'activity_introduce'=>input('activity_introduce'),
+ 'start_time'=>input('start_time','')?strtotime(input('start_time','')):time(),
+ 'host_unit'=>input('host_unit'),
+ 'status'=>input('status',0),
+ 'create_uid'=>session('admin_auth.aid'),
+ 'create_time'=>time(),
+ 'sort'=>input('sort',20,'intval'),
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['pic']=$img_one;
+ }
+
+ if(!empty($fileall_url)){
+ $sl_data['video']=$fileall_url;
+ }
+ $rst=Db::name('lypt')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Roadshow/roadshow_list'));
+ }else{
+ $this->error('修改失败',url('admin/Roadshow/roadshow_list'));
+ }
+ }
+ }
+
+ /**
+ * 排序
+ */
+ public function roadshow_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确', url('admin/Roadshow/roadshow_list'));
+ }else{
+ foreach (input('post.') as $vd_id => $vd_order){
+ Db::name('lypt')->update(['id'=>$vd_id,'sort'=>$vd_order]);
+ }
+ $this->success('排序更新成功',url('admin/Roadshow/roadshow_list'));
+ }
+ }
+
+ /**
+ * 删除(单个)
+ */
+ public function roadshow_del()
+ {
+ $p=input('p');
+ $rst=Db::name('lypt')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Roadshow/roadshow_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Roadshow/roadshow_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 删除(全选)
+ */
+ public function roadshow_alldel()
+ {
+ $p = input('p');
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/Roadshow/roadshow_list',array('p'=>$p)));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('lypt')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Roadshow/roadshow_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Roadshow/roadshow_list',array('p'=>$p)));
+ }
+ }
+
+ /**
+ * 审核/取消审核
+ */
+ public function roadshow_state()
+ {
+ $id=input('x');
+ $status=Db::name('lypt')->where(array('id'=>$id))->value('status');
+ if($status==1){
+ $statedata = array('status'=>0);
+ Db::name('lypt')->where(array('id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name('lypt')->where(array('id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/admin/controller/Scnew.php b/app/admin/controller/Scnew.php
new file mode 100644
index 0000000..139ce37
--- /dev/null
+++ b/app/admin/controller/Scnew.php
@@ -0,0 +1,72 @@
+table_name='zgwhjf_scnew';
+ $this->controller_name='Scnew';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zgwhjf_scnew_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zgwhjf_scnew_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zgwhjf_scnew_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zgwhjf_scnew_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zgwhjf_scnew_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zgwhjf_scnew_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zgwhjf_scnew_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Scsj.php b/app/admin/controller/Scsj.php
new file mode 100644
index 0000000..3bf3fb9
--- /dev/null
+++ b/app/admin/controller/Scsj.php
@@ -0,0 +1,168 @@
+assign('table_name',$this->table_name);
+ $this->assign('controller',$this->controller_name);
+ }
+ /**
+ * 列表
+ */
+ public function scsj_list()
+ {
+ //栏目
+ $scsj=Db::name($this->table_name)->order('n_order,n_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $scsj->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ //市场分类
+ $hylb=Db::name('type')->where('type_type',49)->select();
+ $this->assign('hylb', $hylb);
+ $this->assign('scsj',$scsj);
+ if(request()->isAjax()){
+ return $this->fetch('scsj/ajax_scsj_list');
+ }else{
+ return $this->fetch('scsj/scsj_list');
+ }
+
+
+ }
+
+ /**
+ * 添加
+ */
+ public function scsj_add()
+ {
+ $auth_group = Db::name('auth_group')->where('status', '1')->select();
+ //市场分类
+ $hylb=Db::name('type')->where('type_type',49)->select();
+ $this->assign('hylb', $hylb);
+ $this->assign('auth_group', $auth_group);
+ return $this->fetch();
+ }
+
+ /**
+ * 添加操作
+ */
+ public function scsj_runadd()
+ {
+ $sl_data=array(
+ 'n_title'=>input('n_title'),
+ 'n_company'=>input('n_company'),
+ 'n_type'=>input('n_type'),
+ 'n_status'=>input('n_status',0),
+ 'n_content'=>input('n_content'),
+ 'n_uid'=>session('admin_auth.aid'),
+ 'n_time'=>time(),
+ 'n_order'=>input('n_order',50,'intval'),
+ );
+ $rst=Db::name($this->table_name)->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Scsj/scsj_list'));
+ }else{
+ $this->error('添加失败',url('admin/Scsj/scsj_list'));
+ }
+ }
+ /**
+ * 编辑
+ */
+ public function scsj_edit()
+ {
+ $n_id = input('n_id');
+ if (empty($n_id)) {
+ $this->error('参数错误', url('admin/Scsj/scsj_list'));
+ }
+ $scsj_list = Db::name($this->table_name)->find($n_id);
+ //市场分类
+ $hylb=Db::name('type')->where('type_type',49)->select();
+ $this->assign('hylb', $hylb);
+ $this->assign('scsj_list', $scsj_list);
+ return $this->fetch('scsj/scsj_edit');
+ }
+ /**
+ * 编辑保存
+ */
+ public function scsj_runedit()
+ {
+ $data=input('post.');
+ $rst=Db::name('scsj')->update($data);
+ if($rst){
+ $this->success('修改成功',url('admin/Scsj/scsj_list'));
+ }else{
+ $this->error('修改失败',url('admin/Scsj/scsj_list'));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function scsj_del()
+ {
+ $n_id=input('n_id');
+ if (empty($n_id)){
+ $this->error('ID不存在',url('admin/Scsj/scsj_list'));
+ }
+ $rst=Db::name('scsj')->delete($n_id);
+ if($rst!==false){
+ $this->success('删除成功',url('admin/Scsj/scsj_list'));
+ }else{
+ $this->error('删除失败',url('admin/Scsj/scsj_list'));
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function scsj_alldel()
+ {
+ $p = input('p');
+ $ids = input('n_id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/Scsj/scsj_list'));
+ }
+ if(is_array($ids)){
+ $where = 'n_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'n_id='.$ids;
+ }
+ $rst=Db::name($this->table_name)->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/Scsj/scsj_list'));
+ }else{
+ $this -> error("删除失败!",url('admin/Scsj/scsj_list'));
+ }
+ }
+
+ /**
+ * 审核/取消审核
+ */
+ public function scsj_state()
+ {
+ $id=input('x');
+ $status=Db::name($this->table_name)->where(array('n_id'=>$id))->value('n_status');
+ if($status==1){
+ $statedata = array('n_status'=>0);
+ Db::name($this->table_name)->where(array('n_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('n_status'=>1);
+ Db::name($this->table_name)->where(array('n_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Sczcxy.php b/app/admin/controller/Sczcxy.php
new file mode 100644
index 0000000..f7ed814
--- /dev/null
+++ b/app/admin/controller/Sczcxy.php
@@ -0,0 +1,71 @@
+table_name='sczcxy';
+ $this->controller_name='Sczcxy';
+ parent::_initialize();
+ }
+ /**
+ * 政策行研列表
+ */
+ public function sczcxy_list()
+ {
+ $curr_menu= array([600,620]);
+ $this->assign('menus_curr',$curr_menu);
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function sczcxy_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function sczcxy_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function sczcxy_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function sczcxy_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function sczcxy_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function sczcxy_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Sms.php b/app/admin/controller/Sms.php
new file mode 100644
index 0000000..041046c
--- /dev/null
+++ b/app/admin/controller/Sms.php
@@ -0,0 +1,263 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use app\admin\model\Agency;
+
+class Sms extends Base
+{
+ /**
+ * 列表
+ */
+ public function index()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($kind)$map['sms_type']=$kind;
+ if($search_name){
+ $map['sms_content|sms_code']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('smslog')->where($map)->order('sms_id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ $types=['forget'=>'忘记密码','reg'=>'注册','activitys'=>'活动'];
+ $this->assign('types',$types);
+ return $this->fetch();
+ }
+ public function ajaxmem(){
+ $member_list =Db::name('member_list')->field("member_list_id,member_list_username,member_list_tel,member_list_nickname")->where(['user_status'=>1])->order('member_list_id desc')->paginate(60,false,['query'=>get_query()]);
+ return json($member_list);
+ }
+ /**
+ * 添加
+ */
+ public function add()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $tpls=db('smstpl')->where(['status'=>1])->select();
+ $tags=db('smstag')->where(['status'=>1])->select();
+ $this->assign('tpls',$tpls);
+ $this->assign('tags',$tags);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runadd()
+ {
+ $kind=input("kind");
+ $tels=input('sms_tel');
+ $tels=nl2br($tels);
+ $tels=explode("
", $tels);
+ // 启动事务
+ Db::startTrans();
+ $query=true;
+ try{
+ foreach ($tels as $teline){
+ $teline=trim($teline);
+ if($teline){
+ $teline=explode(";", $teline);
+ foreach ($teline as $tel){
+ $tel=trim($tel);
+ if($tel){
+ $data=[];
+ $data['kind']=$kind;
+ $data['sms_type']=$kind;
+ $data['sms_state']=input('sms_state',-1);
+ $data['sms_txt']=input('sms_txt');
+ $data['sms_tel']=$tel;
+ $data['sms_time']=time();
+ $res=Db::name('smslog')->insert($data);
+ if(!$res){
+ $query=false;
+ Db::rollback();
+ break;
+ }
+ }
+ }
+ }
+ }
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ }
+ if($query){
+ $this->success('添加成功',url('index'));
+ }else{
+ $this->error('添加失败',url('index'));
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('smslog')->find(input('id'));
+ if($list['sms_content']){
+ $list['sms_content']=json_decode($list['sms_content'],true);
+ }
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 修改
+ */
+ public function check()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $list=Db::name('smslog')->find(input('id'));
+ if($list['sms_content']){
+ $list['sms_content']=json_decode($list['sms_content'],true);
+ }
+ $this->assign('list',$list);
+
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedit()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+
+ $data=[];
+ $data['sms_id']=input('id');
+ $state=input('sms_state');
+ if($state!='')$data['sms_state']=$state;
+ $data['sms_txt']=input('sms_txt');
+ $data['sms_tel']=input('sms_tel');
+
+ $rst=Db::name('smslog')->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('index'));
+ }else{
+ $this->error('修改失败',url('index'));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function del()
+ {
+ $kind=input("kind");
+ $this->assign('kind',$kind);
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('index'));
+ }
+ $rst=Db::name('smslog')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('index'));
+ }else{
+ $this->error('删除失败',url('index'));
+ }
+ }
+ /**
+ * 列表
+ */
+ public function tag()
+ {
+ $search_name=input('search_name');
+ $this->assign('search_name',$search_name);
+ $map=array();
+ if($search_name){
+ $map['title']= array('like',"%".$search_name."%");
+ }
+ $admin_list=Db::name('smstag')->where($map)->order('id desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $page = $admin_list->render();
+ $this->assign('list',$admin_list);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /**
+ * 添加
+ */
+ public function addtag()
+ {
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function runaddtag()
+ {
+ $data=[];
+ $data['status']=input('status',-1);
+ $data['title']=input('title');
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+ $query=Db::name('smstag')->insert($data);
+ if($query){
+ $this->success('添加成功',url('tag'));
+ }else{
+ $this->error('添加失败',url('tag'));
+ }
+ }
+ /**
+ * 修改
+ */
+ public function edittag()
+ {
+ $list=Db::name('smstag')->find(input('id'));
+ if($list['infor']){
+ $list['infors']=explode(';',$list['infor']);
+ }
+ $this->assign('list',$list);
+ return $this->fetch();
+ }
+ /**
+ * 修改操作
+ */
+ public function runedittag()
+ {
+ $data=[];
+ $data['id']=input('id');
+ $state=input('status');
+ if($state!='')$data['status']=$state;
+ $data['title']=input('title');
+ $data['infor']=input('infor');
+
+ $rst=Db::name('smstag')->update($data);
+ if($rst!==false){
+ $this->success('修改成功',url('tag'));
+ }else{
+ $this->error('修改失败',url('tag'));
+ }
+ }
+ /**
+ * 删除
+ */
+ public function deltag()
+ {
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('tag'));
+ }
+ $rst=Db::name('smstag')->delete($admin_id);
+ if($rst!==false){
+ $this->success('删除成功',url('tag'));
+ }else{
+ $this->error('删除失败',url('tag'));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ssyyzx.php b/app/admin/controller/Ssyyzx.php
new file mode 100644
index 0000000..215c581
--- /dev/null
+++ b/app/admin/controller/Ssyyzx.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Ssyyzx extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='ssyyzx';
+ $this->controller_name='Ssyyzx';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function ssyyzx_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function ssyyzx_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function ssyyzx_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function ssyyzx_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function ssyyzx_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function ssyyzx_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function ssyyzx_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Sys.php b/app/admin/controller/Sys.php
new file mode 100644
index 0000000..9da315f
--- /dev/null
+++ b/app/admin/controller/Sys.php
@@ -0,0 +1,1636 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use app\admin\model\AuthRule;
+use app\admin\model\Options;
+use think\Db;
+use think\Cache;
+
+class Sys extends Base
+{
+ /**
+ * 站点设置
+ */
+ public function sys()
+ {
+ //主题
+ $tpls=Options::themes();
+ $this->assign('templates',$tpls);
+ $sys=Options::get_options('site_options',$this->lang);
+ $map=Options::map($this->lang);
+ $this->assign('map_lat',$map['map_lat']);
+ $this->assign('map_lng',$map['map_lng']);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 站点设置保存
+ */
+ public function runsys()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/sys'));
+ }else{
+ //自动更新
+ $update_check=input('update_check',0,'intval')?true:false;;
+ sys_config_setbykey('update_check',$update_check);
+ //极验验证
+ $geetest_on=input('geetest_on',0,'intval')?true:false;
+ $captcha_id=input('captcha_id','');
+ $private_key=input('private_key','');
+ if(empty($captcha_id) || empty($private_key)) $geetest_on=false;
+ sys_config_setbykey('geetest',['geetest_on'=>$geetest_on,'captcha_id'=>$captcha_id,'private_key'=>$private_key]);
+ if($geetest_on) sys_config_setbykey('url_route_on',true);
+ //logo图片
+ $checkpic=input('checkpic');
+ $oldcheckpic=input('oldcheckpic');
+ $options=input('post.options/a');
+ $img_url='';
+ if ($checkpic!=$oldcheckpic){
+ $file = request()->file('file0');
+ if(!empty($file)){
+ if(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->upload();
+ $error = $upload->getError();
+ if ($info) {
+ $img_url= config('storage.domain').$info[0]['key'];
+ }else{
+ $this->error($error,url('admin/Sys/sys'));//否则就是上传错误,显示错误原因
+ }
+ }else{
+ //本地
+ $validate=config('upload_validate');
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if($info) {
+ $img_url=config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime']=time();
+ $data['filesize']=$info->getSize();
+ $data['path']=$img_url;
+ Db::name('plug_files')->insert($data);
+ }else{
+ $this->error($file->getError(),url('admin/Sys/sys'));//否则就是上传错误,显示错误原因
+ }
+ }
+ $options['site_logo']=$img_url;
+ }
+ }else{
+ //原有图片
+ $options['site_logo']=input('oldcheckpicname');
+ }
+ //更新
+ $rst=Options::set_options($options,'site_options',$this->lang);
+ if($rst!==false){
+ cache('site_options_'.$this->lang, $options);
+ $this->success('站点设置保存成功',url('admin/Sys/sys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/sys'));
+ }
+ }
+ }
+ /**
+ * 多语言设置显示
+ */
+ public function langsys()
+ {
+ return $this->fetch();
+ }
+ /**
+ * 多语言设置保存
+ */
+ public function runlangsys()
+ {
+ $lang_switch_on=input('lang_switch_on',0,'intval')?true:false;
+ $default_lang=input('default_lang','');
+ sys_config_setbykey('lang_switch_on',$lang_switch_on);
+ sys_config_setbykey('default_lang',$default_lang);
+ cache::clear();
+ cookie('think_var', null);
+ $this->success('多语言设置成功',url('admin/Sys/langsys'));
+ }
+ /**
+ * 日志设置
+ */
+ public function logsys()
+ {
+ $log=config('log');
+ $log['level']=empty($log['level'])?join(',',['log', 'error', 'info', 'sql', 'notice', 'alert', 'debug']):join(',',$log['level']);
+ $this->assign('log',$log);
+ return $this->fetch();
+ }
+ /**
+ * 日志设置保存
+ */
+ public function runlogsys()
+ {
+ $log_level=input('log_level/a');
+ $log['clear_on']=input('clear_on',0,'intval')?true:false;
+ $log['timebf']=input('timebf',2592000,'intval');
+ $log['level']=(count($log_level)==7 || empty($log_level))?[]:$log_level;
+ sys_config_setbykey('log',$log);
+ cache::clear();
+ $this->success('日志设置成功',url('admin/Sys/logsys'));
+ }
+ /**
+ * URL美化
+ */
+ public function urlsetsys()
+ {
+ $routes=Db::name('route')->order('listorder')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $routes->render();
+ $this->assign('page',$show);
+ $this->assign('routes',$routes);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_urlsetsys');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /*
+ * 添加路由规则操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_runadd()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/urlsetsys'));
+ }
+ Db::name('route')->insert(input('post.'));
+ $p=input('p',1,'intval');
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('路由规则添加成功',url('admin/Sys/urlsetsys',array('p'=>$p)),1);
+
+ }
+ /*
+ * 修改路由规则操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_runedit()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/sys'));
+ }
+ $p=input('p',1,'intval');
+ $sl_data=array(
+ 'id'=>input('id'),
+ 'full_url'=>input('full_url'),
+ 'url'=>input('url'),
+ 'status'=>input('status'),
+ 'listorder'=>input('listorder'),
+ );
+ $rst=Db::name('route')->update($sl_data);
+ if($rst!==false){
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('路由规则修改成功',url('admin/Sys/urlsetsys',array('p'=>$p)));
+ }else{
+ $this->error('路由规则修改失败',url('admin/Sys/urlsetsys',array('p'=>$p)));
+ }
+ }
+ /*
+ * 路由规则修改返回值操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_edit()
+ {
+ $id=input('id');
+ $route=Db::name('route')->where(array('id'=>$id))->find();
+ $route['code']=1;
+ return json($route);
+ }
+ /*
+ * 路由规则排序
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/urlsetsys'));
+ }
+ $route=Db::name('route');
+ foreach (input('post.') as $id => $listorder){
+ $route->where(array('id' => $id ))->setField('listorder' , $listorder);
+ }
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('排序更新成功',url('admin/Sys/urlsetsys'));
+ }
+ /*
+ * 路由规则删除操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_del()
+ {
+ $rst=Db::name('route')->where(array('id'=>input('id')))->delete();
+ if($rst!==false){
+ $p=input('p',1,'intval');
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('路由规则删除成功',url('admin/Sys/urlsetsys',array('p'=>$p)));
+ }else{
+ $this->error('路由规则删除失败',url('admin/Sys/urlsetsys'));
+ }
+ }
+ /*
+ * 修改路由规则状态
+ * @author rainfer <81818832@qq.com>
+ */
+ public function route_state()
+ {
+ $id=input('x');
+ if (empty($id)){
+ $this->error('规则ID不存在',url('admin/Sys/urlsetsys'));
+ }
+ $status=Db::name('route')->where(array('id'=>$id))->value('status');//判断当前状态情况
+ if($status==1){
+ $statedata = array('status'=>0);
+ Db::name('route')->where(array('id'=>$id))->setField($statedata);
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name('route')->where(array('id'=>$id))->setField($statedata);
+ if(config('url_route_mode')=='2') Cache::rm('routes');
+ $this->success('状态开启');
+ }
+ }
+
+ /**
+ * URL设置显示
+ */
+ public function urlsys(){
+ return $this->fetch();
+ }
+ /*
+ * 路由规则设置
+ * @author rainfer <81818832@qq.com>
+ */
+ public function runurlsys()
+ {
+ $route_on=input('route_on',0,'intval')?true:false;
+ $route_must=input('route_must',0,'intval')?true:false;;
+ $complete_match=input('complete_match',0,'intval')?true:false;;
+ $html_suffix=input('html_suffix','');
+ $url_route_mode=input('url_route_mode','');
+ sys_config_setbykey('url_route_on',$route_on);
+ sys_config_setbykey('url_route_must',$route_must);
+ sys_config_setbykey('route_complete_match',$complete_match);
+ sys_config_setbykey('url_html_suffix',$html_suffix);
+ sys_config_setbykey('url_route_mode',$url_route_mode);
+ Cache::rm('routes');
+ $this->success('URL基本设置成功',url('admin/Sys/urlsetsys#basic'));
+ }
+ /**
+ * 发送邮件设置显示
+ */
+ public function emailsys()
+ {
+ $sys=Options::get_options('email_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 发送邮件设置保存
+ */
+ public function runemail()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/emailsys'));
+ }else{
+ $options=input('post.options/a');
+ $rst=Options::set_options($options,'email_options',$this->lang);
+ if($rst!==false){
+ cache("email_options",null);
+ $this->success('邮箱设置保存成功',url('admin/Sys/emailsys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/emailsys'));
+ }
+ }
+ }
+ /**
+ * 帐号激活设置显示
+ */
+ public function activesys()
+ {
+ $sys=Options::get_options('active_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 帐号激活设置保存
+ */
+ public function runactive()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/activesys'));
+ }else{
+ $options=input('post.options/a');
+ $options['email_tpl']=htmlspecialchars_decode($options['email_tpl']);
+ $rst=Options::set_options($options,'active_options',$this->lang);
+ if($rst!==false){
+ cache("active_options",null);
+ $this->success('帐号激活设置保存成功',url('admin/Sys/activesys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/activesys'));
+ }
+ }
+ }
+ /**
+ * 同意协议设置显示
+ */
+ public function agreesys()
+ {
+ $applytype=input('apply_type','');
+ $sys=Options::get_options('agree_options'.$applytype,$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 同意协议设置显示
+ */
+ public function tgagreesys()
+ {
+ $applytype=input('apply_type');
+ $sys=Options::get_options('tgagree_options'.$applytype,$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 同意协议设置保存
+ */
+ public function tgrunagree()
+ {
+ $applytype=input('apply_type');
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/tgagreesys',['apply_type'=>$applytype]));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'tgagree_options'.$applytype,$this->lang);
+ if($rst!==false){
+ cache("tgagree_options".$applytype.'_'.$this->lang,null);
+ $this->success('同意协议设置保存成功',url('admin/Sys/tgagreesys',['apply_type'=>$applytype]));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/tgagreesys',['apply_type'=>$applytype]));
+ }
+ }
+ }
+ /**
+ * 同意协议设置保存
+ */
+ public function runagree()
+ {
+ $applytype=input('apply_type');
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/agreesys',['apply_type'=>$applytype]));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+
+ $rst=Options::set_options($options,'agree_options'.$applytype,$this->lang);
+ if($rst!==false){
+ cache("agree_options".$applytype.'_'.$this->lang,null);
+ $this->success('同意协议设置保存成功',url('admin/Sys/agreesys',['apply_type'=>$applytype]));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/agreesys',['apply_type'=>$applytype]));
+ }
+ }
+ }
+ /**
+ * 初审意见设置显示
+ */
+ public function beginchecksys()
+ {
+ $sys=Options::get_options('begincheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ public function ddchecksys()
+ {
+ $sys=Options::get_options('ddcheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ public function reviewchecksys()
+ {
+ $sys=Options::get_options('reviewcheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ public function riskchecksys()
+ {
+ $sys=Options::get_options('riskcheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 初审协议设置保存
+ */
+ public function runbegincheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/beginchecksys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'begincheck_options',$this->lang);
+ if($rst!==false){
+ cache("begincheck_options",null);
+ $this->success('初审通知内容设置保存成功',url('admin/Sys/beginchecksys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/beginchecksys'));
+ }
+ }
+ }
+ public function runddcheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/ddchecksys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'ddcheck_options',$this->lang);
+ if($rst!==false){
+ cache("ddcheck_options",null);
+ $this->success('尽调通知内容设置保存成功',url('admin/Sys/ddchecksys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/ddchecksys'));
+ }
+ }
+ }
+ public function runreviewcheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/reviewchecksys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'reviewcheck_options',$this->lang);
+ if($rst!==false){
+ cache("reviewcheck_options",null);
+ $this->success('复审通知内容设置保存成功',url('admin/Sys/reviewchecksys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/reviewchecksys'));
+ }
+ }
+ }
+ public function runriskcheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/riskchecksys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'riskcheck_options',$this->lang);
+ if($rst!==false){
+ cache("riskcheck_options",null);
+ $this->success('风控审核通知内容设置保存成功',url('admin/Sys/riskchecksys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/riskchecksys'));
+ }
+ }
+ }
+ /**
+ * 挂牌上市缴费通知模板设置显示
+ */
+ public function feechecksys()
+ {
+ $sys=Options::get_options('feecheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 挂牌上市缴费通知模板设置保存
+ */
+ public function runfeecheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/feechecksys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'feecheck_options',$this->lang);
+ if($rst!==false){
+ cache("notice_options",null);
+ $this->success('挂牌上市缴费通知模板设置保存成功',url('admin/Sys/feechecksys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/feechecksys'));
+ }
+ }
+ }
+ /**
+ * 公告模板设置显示
+ */
+ public function noticesys()
+ {
+ $sys=Options::get_options('notice_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 公告模板设置保存
+ */
+ public function runnotice()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/noticesys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'notice_options',$this->lang);
+ if($rst!==false){
+ cache("notice_options".'_'.$this->lang,null);
+
+ $this->success('公告模板设置保存成功',url('admin/Sys/noticesys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/noticesys'));
+ }
+ }
+ }
+ /**
+ * 公告模板设置显示
+ */
+ public function gjnoticesys()
+ {
+ $sys=Options::get_options('gjnotice_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ public function xcnoticesys()
+ {
+ $sys=Options::get_options('xcnotice_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 公告模板设置显示
+ */
+ public function cunoticesys()
+ {
+ $sys=Options::get_options('cunotice_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 公告模板设置保存
+ */
+ public function runcunotice()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/cunoticesys'));
+ }else{
+
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'cunotice_options',$this->lang);
+ if($rst!==false){
+ cache("cunotice_options".'_'.$this->lang,null);
+
+ $this->success('公告模板设置保存成功',url('admin/Sys/cunoticesys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/cunoticesys'));
+ }
+ }
+ }
+ /**
+ * 公告模板设置保存
+ */
+ public function rungjnotice()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/gjnoticesys'));
+ }else{
+
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'gjnotice_options',$this->lang);
+ if($rst!==false){
+ cache("gjnotice_options".'_'.$this->lang,null);
+
+ $this->success('公告模板设置保存成功',url('admin/Sys/gjnoticesys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/gjnoticesys'));
+ }
+ }
+ }
+ public function runxcnotice()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/xcnoticesys'));
+ }else{
+
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'xcnotice_options',$this->lang);
+ if($rst!==false){
+ cache("xcnotice_options".'_'.$this->lang,null);
+
+ $this->success('公告模板设置保存成功',url('admin/Sys/xcnoticesys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/xcnoticesys'));
+ }
+ }
+ }
+ /**
+ * 特殊号码缴费通知12
+ */
+ public function tssys()
+ {
+ $sys=Options::get_options('tscheck_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+
+
+ /**
+ * 特殊号码缴费通知12
+ */
+ public function tssyscheck()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/tssys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'tscheck_options',$this->lang);
+ if($rst!==false){
+ cache("tscheck_options",null);
+ $this->success('缴费模板设置保存成功',url('admin/Sys/tssys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/tssys'));
+ }
+ }
+ }
+
+ /**
+ * 特殊号码缴费通知模板设置显示
+ */
+ public function numbersys()
+ {
+ $sys=Options::get_options('number_options',$this->lang);
+ $this->assign('sys',$sys);
+ return $this->fetch();
+ }
+ /**
+ * 特殊号码缴费通知模板设置保存
+ */
+ public function runnumber()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/numbersys'));
+ }else{
+ $options=input('post.options/a');
+ $options['content_tpl']=htmlspecialchars_decode($options['content_tpl']);
+ $rst=Options::set_options($options,'number_options',$this->lang);
+ if($rst!==false){
+ cache("notice_options",null);
+ $this->success('特殊号码缴费模板设置保存成功',url('admin/Sys/numbersys'));
+ }else{
+ $this->error('提交参数不正确',url('admin/Sys/numbersys'));
+ }
+ }
+ }
+ /**
+ * 短信设置
+ */
+ public function smssys()
+ {
+ $sms_ali=sys_config_get('alisms');
+ $this->assign('sms_ali',$sms_ali);
+ $sms_ym=sys_config_get('ymsms');
+ $this->assign('sms_ym',$sms_ym);
+ return $this->fetch();
+ }
+ /**
+ * 短信设置保存
+ */
+ public function runsmssys()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/smssys'));
+ }else{
+ $sms_type=input('sms_type',1,'intval');
+ $data = array(
+ 'ymsms' => array(
+ 'cdkey' => input('cdkey_ym'),
+ 'password' => input('password_ym'),
+ 'signname' => input('signname_ym'),
+ 'on' => false,
+ ),
+ 'alisms' => array(
+ 'app_key' => input('app_key_ali'),
+ 'app_secret' => input('app_secret_ali'),
+ 'signName' => input('signName_ali'),
+ 'TemplateCode' => input('TemplateCode_ali'),
+ 'on' => false,
+ )
+ );
+ if($sms_type==1){
+ $data['ymsms']['on']=true;
+ }else{
+ $data['alisms']['on']=true;
+ }
+ $rst=sys_config_setbyarr($data);
+ if($rst!==false){
+ Cache::clear();
+ $this->success('设置保存成功',url('admin/Sys/smssys'));
+ }else{
+ $this->error('设置保存失败',url('admin/Sys/smssys'));
+ }
+ }
+ }
+ /**
+ * 第三方登录设置
+ */
+ public function oauthsys()
+ {
+ $oauth_qq=sys_config_get('think_sdk_qq');
+ $oauth_sina=sys_config_get('think_sdk_sina');
+ $oauth_weixin=sys_config_get('think_sdk_weixin');
+ $oauth_wechat=sys_config_get('think_sdk_wechat');
+ $oauth_facebook=sys_config_get('think_sdk_facebook');
+ $oauth_google=sys_config_get('think_sdk_google');
+ $this->assign('oauth_qq',$oauth_qq);
+ $this->assign('oauth_sina',$oauth_sina);
+ $this->assign('oauth_wechat',$oauth_wechat);
+ $this->assign('oauth_weixin',$oauth_weixin);
+ $this->assign('oauth_facebook',$oauth_facebook);
+ $this->assign('oauth_google',$oauth_google);
+ return $this->fetch();
+ }
+ /**
+ * 第三方登录设置保存
+ */
+ public function runoauthsys()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/oauthsys'));
+ }else{
+ $host=get_host();
+ $data = array(
+ 'think_sdk_qq' => array(
+ 'app_key' => input('qq_appid'),
+ 'app_secret' => input('qq_appkey'),
+ 'display' => input('qq_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=qq'),
+ ),
+ 'think_sdk_weixin' => array(
+ 'app_key' => input('weixin_appid'),
+ 'app_secret' => input('weixin_appkey'),
+ 'display' => input('weixin_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=weixin'),
+ ),
+ 'think_sdk_wechat' => array(
+ 'app_key' => input('wechat_appid'),
+ 'app_secret' => input('wechat_appkey'),
+ 'display' => input('wechat_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=wechat'),
+ ),
+ 'think_sdk_google' => array(
+ 'app_key' => input('google_appid'),
+ 'app_secret' => input('google_appkey'),
+ 'display' => input('google_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=google'),
+ ),
+ 'think_sdk_facebook' => array(
+ 'app_key' => input('facebook_appid'),
+ 'app_secret' => input('facebook_appkey'),
+ 'display' => input('facebook_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=facebook'),
+ ),
+ 'think_sdk_sina' => array(
+ 'app_key' => input('sina_appid'),
+ 'app_secret' => input('sina_appkey'),
+ 'display' => input('sina_display',0,'intval')?true:false,
+ 'callback' => $host.url('home/Oauth/callback','type=sina'),
+ ),
+ );
+ $rst=sys_config_setbyarr($data);
+ if($rst){
+ Cache::clear();
+ $this->success('设置保存成功',url('admin/Sys/oauthsys'));
+ }else{
+ $this->error('设置保存失败',url('admin/Sys/oauthsys'));
+ }
+ }
+ }
+ /**
+ * 云存储设置
+ */
+ public function storagesys()
+ {
+ $storage=config('aliyun_oss');
+ $this->assign('storage',$storage);
+ return $this->fetch();
+ }
+ /**
+ * 云存储设置保存
+ */
+ public function runstorage()
+ {
+ $storage=array(
+ 'oss_open'=>input('oss_open',0)?true:false,
+ 'accesskey'=>input('accesskey',''),
+ 'secretkey'=>input('secretkey',''),
+ 'bucket'=>input('bucket',''),
+ 'endpoint'=>input('endpoint','')
+ );
+ $rst=sys_config_setbyarr(array('aliyun_oss'=>$storage));
+ if($rst){
+ Cache::clear();
+ $this->success('设置保存成功',url('admin/Sys/storagesys'));
+ }else{
+ $this->error('设置保存失败',url('admin/Sys/storagesys'));
+ }
+ }
+ /*
+ * 文章来源列表
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_list()
+ {
+ $source=Db::name('source')->order('source_order,source_id desc')->paginate(config('paginate.list_rows'));
+ $page = $source->render();
+ $this->assign('source',$source);
+ $this->assign('page',$page);
+ return $this->fetch();
+ }
+ /*
+ * 添加来源操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_runadd()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/source_list'));
+ }else{
+ $data=input('post.');
+ Db::name('source')->insert($data);
+ $this->success('来源添加成功',url('admin/Sys/source_list'));
+ }
+ }
+ /*
+ * 来源删除操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_del()
+ {
+ $p=input('p');
+ $rst=Db::name('source')->where(array('source_id'=>input('source_id')))->delete();
+ if($rst!==false){
+ $this->success('来源删除成功',url('admin/Sys/source_list',array('p' => $p)));
+ }else{
+ $this->error('来源删除失败',url('admin/Sys/source_list',array('p' => $p)));
+ }
+ }
+ /*
+ * 来源修改返回值操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_edit()
+ {
+ $source_id=input('source_id');
+ $source=Db::name('source')->where(array('source_id'=>$source_id))->find();
+ $sl_data['source_id']=$source['source_id'];
+ $sl_data['source_name']=$source['source_name'];
+ $sl_data['source_order']=$source['source_order'];
+ $sl_data['code']=1;
+ return json($sl_data);
+ }
+ /*
+ * 修改来源操作
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_runedit()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/source_list'));
+ }else{
+ $sl_data=array(
+ 'source_id'=>input('source_id'),
+ 'source_name'=>input('source_name'),
+ 'source_order'=>input('source_order'),
+ );
+ $rst=Db::name('source')->update($sl_data);
+ if($rst!==false){
+ $this->success('来源修改成功',url('admin/Sys/source_list'));
+ }else{
+ $this->error('来源修改失败',url('admin/Sys/source_list'));
+ }
+ }
+ }
+ /*
+ * 来源排序
+ * @author rainfer <81818832@qq.com>
+ */
+ public function source_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/source_list'));
+ }else{
+ foreach (input('post.') as $source_id => $source_order){
+ Db::name('source')->where(array('source_id' => $source_id ))->setField('source_order' , $source_order);
+ }
+ $this->success('排序更新成功',url('admin/Sys/source_list'));
+ }
+ }
+ /**
+ * 权限(后台菜单)列表
+ */
+ public function admin_rule_list()
+ {
+ $pid=input('pid',0);
+ $level=input('level',0);
+ $id_str=input('id','pid');
+ $admin_rule=Db::name('auth_rule')->where('pid',$pid)->order('sort')->select();
+ $admin_rule_all=Db::name('auth_rule')->order('sort')->select();
+ $arr = menu_left($admin_rule,'id','pid','─',$pid,$level,$level*20);
+ $arr_all = menu_left($admin_rule_all,'id','pid','─',0,$level,$level*20);
+ $this->assign('admin_rule',$arr);
+ $this->assign('admin_rule_all',$arr_all);
+ $this->assign('pid',$id_str);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_admin_rule_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 权限(后台菜单)添加
+ */
+ public function admin_rule_add()
+ {
+ $pid=input('pid',0);
+ //全部规则
+ $admin_rule_all=Db::name('auth_rule')->order('sort')->select();
+ $arr = menu_left($admin_rule_all);
+ $this->assign('admin_rule',$arr);
+ $this->assign('pid',$pid);
+ return $this->fetch();
+ }
+ /**
+ * 权限(后台菜单)添加操作
+ */
+ public function admin_rule_runadd()
+ {
+ if(!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/admin_rule_list'));
+ }else{
+ $pid=Db::name('auth_rule')->where(array('id'=>input('pid')))->field('level')->find();
+ $level=$pid['level']+1;
+ $name=input('name');
+ //$name=AuthRule::check_name($name,$level);
+ if($name){
+ $sldata=array(
+ 'name'=>$name,
+ 'title'=>input('title'),
+ 'status'=>input('status',0,'intval'),
+ 'sort'=>input('sort',50,'intval'),
+ 'pid'=>input('pid'),
+ 'notcheck'=>input('notcheck',0,'intval'),
+ 'addtime'=>time(),
+ 'css'=>input('css',''),
+ 'level'=>$level,
+ );
+ Db::name('auth_rule')->insert($sldata);
+ Cache::clear();
+ $this->success('权限添加成功',url('admin/Sys/admin_rule_list'),1);
+ }else{
+ $this->error('控制器或方法不存在,或提交格式不规范',url('admin/Sys/admin_rule_list'));
+ }
+ }
+ }
+ /**
+ * 权限(后台菜单)显示/隐藏
+ */
+ public function admin_rule_state()
+ {
+ $id=input('x');
+ $statusone=Db::name('auth_rule')->where(array('id'=>$id))->value('status');//判断当前状态情况
+ if($statusone==1){
+ $statedata = array('status'=>0);
+ Db::name('auth_rule')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name('auth_rule')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('状态开启');
+ }
+ }
+ /**
+ * 权限(后台菜单)检测/不检测
+ */
+ public function admin_rule_notcheck()
+ {
+ $id=input('x');
+ $statusone=Db::name('auth_rule')->where(array('id'=>$id))->value('notcheck');//判断当前状态情况
+ if($statusone==1){
+ $statedata = array('notcheck'=>0);
+ Db::name('auth_rule')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('检测');
+ }else{
+ $statedata = array('notcheck'=>1);
+ Db::name('auth_rule')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('不检测');
+ }
+ }
+ /**
+ * 权限(后台菜单)排序
+ */
+ public function admin_rule_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/admin_rule_list'));
+ }else{
+ foreach ($_POST as $id => $sort){
+ Db::name('auth_rule')->where(array('id' => $id ))->setField('sort' , $sort);
+ }
+ Cache::clear();
+ $this->success('排序更新成功',url('admin/Sys/admin_rule_list'));
+ }
+ }
+ /**
+ * 权限(后台菜单)编辑
+ */
+ public function admin_rule_edit()
+ {
+ //全部规则
+ $admin_rule_all=Db::name('auth_rule')->order('sort')->select();
+ $arr = menu_left($admin_rule_all);
+ $this->assign('admin_rule',$arr);
+ //待编辑规则
+ $admin_rule=Db::name('auth_rule')->where(array('id'=>input('id')))->find();
+ $this->assign('rule',$admin_rule);
+ return $this->fetch();
+ }
+ /**
+ * 权限(后台菜单)通过复制添加
+ */
+ public function admin_rule_copy()
+ {
+ //全部规则
+ $admin_rule_all=Db::name('auth_rule')->order('sort')->select();
+ $arr = menu_left($admin_rule_all);
+ $this->assign('admin_rule',$arr);
+ //待编辑规则
+ $admin_rule=Db::name('auth_rule')->where(array('id'=>input('id')))->find();
+ $this->assign('rule',$admin_rule);
+ return $this->fetch();
+ }
+ /**
+ * 权限(后台菜单)编辑操作
+ */
+ public function admin_rule_runedit()
+ {
+ if(!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Sys/admin_rule_list'));
+ }else{
+ $name=input('name','','');
+ $name=html_entity_decode($name);
+ $old_pid=input('old_pid');
+ $old_level=input('old_level',0,'intval');
+ $pid=input('pid');
+ $level_diff=0;
+ //判断是否更改了pid
+ if($pid!=$old_pid){
+ $level=Db::name('auth_rule')->where('id',$pid)->value('level')+1;
+ $level_diff=($level>$old_level)?($level-$old_level):($old_level-$level);
+ }else{
+ $level=$old_level;
+ }
+ //$name=AuthRule::check_name($name,$level);
+ if($name){
+ $sldata=array(
+ 'id'=>input('id',1,'intval'),
+ 'name'=>$name,
+ 'title'=>input('title'),
+ 'status'=>input('status',0,'intval'),
+ 'notcheck'=>input('notcheck',0,'intval'),
+ 'pid'=>input('pid',0,'intval'),
+ 'css'=>input('css'),
+ 'sort'=>input('sort'),
+ 'level'=>$level
+ );
+ $rst=Db::name('auth_rule')->update($sldata);
+ if($rst!==false){
+ if($pid!=$old_pid){
+ //更新子孙级菜单的level
+ $auth_rule=Db::name('auth_rule')->order('sort')->select();
+ $tree=new \Tree();
+ $tree->init($auth_rule,['parentid'=>'pid']);
+ $ids=$tree->get_childs($auth_rule,$sldata['id'],true,false);
+ if($ids){
+ if($level>$old_level){
+ Db::name('auth_rule')->where('id','in',$ids)->setInc('level',$level_diff);
+ }else{
+ Db::name('auth_rule')->where('id','in',$ids)->setDec('level',$level_diff);
+ }
+ }
+ }
+ Cache::clear();
+ $this->success('权限修改成功',url('admin/Sys/admin_rule_list'));
+ }else{
+ $this->error('权限修改失败',url('admin/Sys/admin_rule_list'));
+ }
+ }else{
+ $this->error('控制器或方法不存在,或提交格式不规范',url('admin/Sys/admin_rule_list'));
+ }
+ }
+ }
+ /**
+ * 权限(后台菜单)删除
+ */
+ public function admin_rule_del()
+ {
+ $pid=input('id');
+ $arrTree=get_rule_ids_child($pid);
+ if($arrTree){
+ $rst=Db::name('auth_rule')->where('id','in',$arrTree)->delete();
+ if($rst!==false){
+ Cache::clear();
+ $this->success('权限删除成功',url('admin/Sys/admin_rule_list'));
+ }else{
+ $this->error('权限删除失败',url('admin/Sys/admin_rule_list'));
+ }
+ }else{
+ $this->error('权限删除失败',url('admin/Sys/admin_rule_list'));
+ }
+ }
+ /*
+ * 数据备份显示
+ */
+ public function database($type = null)
+ {
+ if(empty($type)){
+ $type='export';
+ }
+ $title='';
+ $list=array();
+ switch ($type) {
+ /* 数据还原 */
+ case 'import':
+ //列出备份文件列表
+ $path=config('db_path');
+ if (!is_dir($path)) {
+ mkdir($path, 0755, true);
+ }
+ $path = realpath($path);
+ $flag = \FilesystemIterator::KEY_AS_FILENAME;
+ $glob = new \FilesystemIterator($path, $flag);
+
+ $list = array();
+ foreach ($glob as $name => $file) {
+ if(preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)){
+ $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
+
+ $date = "{$name[0]}-{$name[1]}-{$name[2]}";
+ $time = "{$name[3]}:{$name[4]}:{$name[5]}";
+ $part = $name[6];
+
+ if(isset($list["{$date} {$time}"])){
+ $info = $list["{$date} {$time}"];
+ $info['part'] = max($info['part'], $part);
+ $info['size'] = $info['size'] + $file->getSize();
+ } else {
+ $info['part'] = $part;
+ $info['size'] = $file->getSize();
+ }
+ $extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
+ $info['compress'] = ($extension === 'SQL') ? '-' : $extension;
+ $info['time'] = strtotime("{$date} {$time}");
+ $list["{$date} {$time}"] = $info;
+ }
+ }
+ $title = '数据还原';
+ break;
+
+ /* 数据备份 */
+ case 'export':
+ $list = Db::query('SHOW TABLE STATUS FROM '.config('database.database'));
+ $list = array_map('array_change_key_case', $list);
+ //过滤非本项目前缀的表
+ foreach($list as $k=>$v){
+ if(stripos($v['name'],strtolower(config('database.prefix')))!==0){
+ unset($list[$k]);
+ }
+ }
+ $title = '数据备份';
+ break;
+
+ default:
+ $this->error('参数错误!');
+ }
+
+ //渲染模板
+ $this->assign('meta_title', $title);
+ $this->assign('data_list', $list);
+ return $this->fetch($type);
+ }
+ /*
+ * 数据还原显示
+ */
+ public function import()
+ {
+ $path=config('db_path');
+ if (!is_dir($path)) {
+ mkdir($path, 0755, true);
+ }
+ $path = realpath($path);
+ $flag = \FilesystemIterator::KEY_AS_FILENAME;
+ $glob = new \FilesystemIterator($path,$flag);
+
+ $list = array();
+ foreach ($glob as $name => $file) {
+ if(preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql(?:\.gz)?$/', $name)){
+ $name = sscanf($name, '%4s%2s%2s-%2s%2s%2s-%d');
+
+ $date = "{$name[0]}-{$name[1]}-{$name[2]}";
+ $time = "{$name[3]}:{$name[4]}:{$name[5]}";
+ $part = $name[6];
+
+ if(isset($list["{$date} {$time}"])){
+ $info = $list["{$date} {$time}"];
+ $info['part'] = max($info['part'], $part);
+ $info['size'] = $info['size'] + $file->getSize();
+ } else {
+ $info['part'] = $part;
+ $info['size'] = $file->getSize();
+ }
+ $extension = strtoupper(pathinfo($file->getFilename(), PATHINFO_EXTENSION));
+ $info['compress'] = ($extension === 'SQL') ? '-' : $extension;
+ $info['time'] = strtotime("{$date} {$time}");
+
+ $list["{$date} {$time}"] = $info;
+ }
+ }
+ //渲染模板
+ $this->assign('data_list', $list);
+ return $this->fetch();
+ }
+ /**
+ * 优化表
+ * @param String $tables 表名
+ * @author rainfer <81818832@qq.com>
+ */
+ public function optimize($tables = null)
+ {
+ if($tables) {
+ if(is_array($tables)){
+ $tables = implode('`,`', $tables);
+ $list = Db::query("OPTIMIZE TABLE `{$tables}`");
+ if($list){
+ $this->success("数据表优化完成!");
+ } else {
+ $this->error("数据表优化出错请重试!");
+ }
+ } else {
+ $list = Db::query("OPTIMIZE TABLE `{$tables}`");
+ if($list){
+ $this->success("数据表'{$tables}'优化完成!");
+ } else {
+ $this->error("数据表'{$tables}'优化出错请重试!");
+ }
+ }
+ } else {
+ $this->error("请指定要优化的表!");
+ }
+ }
+ /**
+ * 修复表
+ * @param String $tables 表名
+ * @author rainfer <81818832@qq.com>
+ */
+ public function repair($tables = null)
+ {
+ if($tables) {
+ if(is_array($tables)){
+ $tables = implode('`,`', $tables);
+ $list = Db::query("REPAIR TABLE `{$tables}`");
+ if($list){
+ $this->success("数据表修复完成!");
+ } else {
+ $this->error("数据表修复出错请重试!");
+ }
+ } else {
+ $list = Db::query("REPAIR TABLE `{$tables}`");
+ if($list){
+ $this->success("数据表'{$tables}'修复完成!");
+ } else {
+ $this->error("数据表'{$tables}'修复出错请重试!");
+ }
+ }
+ } else {
+ $this->error("请指定要修复的表!");
+ }
+ }
+ /**
+ * 备份单表
+ * @param String $table 不含前缀表名
+ * @author rainfer <81818832@qq.com>
+ */
+ public function exportsql($table = null)
+ {
+ if($table){
+ if(stripos($table,config('database.prefix'))==0){
+ //含前缀的表,去除表前缀
+ $table=str_replace(config('database.prefix'),"",$table);
+ }
+ if (!db_is_valid_table_name($table)) {
+ $this->error("不存在表" . ' ' . $table);
+ }
+ force_download_content(date('Ymd') . '_' . config('database.prefix') . $table . '.sql', db_get_insert_sqls($table));
+ }else{
+ $this->error('未指定需备份的表');
+ }
+ }
+ /**
+ * 删除备份文件
+ * @param Integer $time 备份时间
+ * @author rainfer <81818832@qq.com>
+ */
+ public function del($time = 0)
+ {
+ if($time){
+ $name = date('Ymd-His', $time) . '-*.sql*';
+ $path = realpath(config('db_path')) . DS . $name;
+ array_map("unlink", glob($path));
+ if(count(glob($path))){
+ $this->error('备份文件删除失败,请检查权限!',url('admin/Sys/import'));
+ } else {
+ $this->success('备份文件删除成功!',url('admin/Sys/import'));
+ }
+ } else {
+ $this->error('参数错误!',url('admin/Sys/import'));
+ }
+ }
+ /*
+ * 数据还原
+ */
+ public function restore($time = 0, $part = null, $start = null)
+ {
+ //读取备份配置
+ $config = array(
+ 'path' => realpath(config('db_path')) . DS,
+ 'part' => config('db_part'),
+ 'compress' => config('db_compress'),
+ 'level' => config('db_level'),
+ );
+ if(is_numeric($time) && is_null($part) && is_null($start)){ //初始化
+ //获取备份文件信息
+ $name = date('Ymd-His', $time) . '-*.sql*';
+ $path = realpath(config('db_path')) . DS . $name;
+ $files = glob($path);
+ $list = array();
+ foreach($files as $name){
+ $basename = basename($name);
+ $match = sscanf($basename, '%4s%2s%2s-%2s%2s%2s-%d');
+ $gz = preg_match('/^\d{8,8}-\d{6,6}-\d+\.sql.gz$/', $basename);
+ $list[$match[6]] = array($match[6], $name, $gz);
+ }
+ ksort($list);
+ //检测文件正确性
+ $last = end($list);
+ if(count($list) === $last[0]){
+ session('backup_list', $list); //缓存备份列表
+ $this->restore(0,1,0);
+ } else {
+ $this->error('备份文件可能已经损坏,请检查!');
+ }
+ } elseif(is_numeric($part) && is_numeric($start)) {
+ $list = session('backup_list');
+ $db = new \Database($list[$part],$config);
+ $start = $db->import($start);
+ if(false === $start){
+ $this->error('还原数据出错!');
+ } elseif(0 === $start) { //下一卷
+ if(isset($list[++$part])){
+ //$data = array('part' => $part, 'start' => 0);
+ $this->restore(0,$part,0);
+ } else {
+ session('backup_list', null);
+ $this->success('还原完成!',url('admin/Sys/import'));
+ }
+ } else {
+ $data = array('part' => $part, 'start' => $start[0]);
+ if($start[1]){
+ $this->restore(0,$part, $start[0]);
+ } else {
+ $data['gz'] = 1;
+ $this->restore(0,$part, $start[0]);
+ }
+ }
+ } else {
+ $this->error('参数错误!');
+ }
+ }
+ /*
+ * 数据备份
+ */
+ public function export($tables = null, $id = null, $start = null)
+ {
+ if(request()->isPost() && !empty($tables) && is_array($tables)){ //初始化
+ //读取备份配置
+ $config = array(
+ 'path' => realpath(config('db_path')) . DS,
+ 'part' => config('db_part'),
+ 'compress' => config('db_compress'),
+ 'level' => config('db_level'),
+ );
+ //检查是否有正在执行的任务
+ $lock = "{$config['path']}backup.lock";
+ if(is_file($lock)){
+ $this->error('检测到有一个备份任务正在执行,请稍后再试!');
+ } else {
+ //创建锁文件
+ file_put_contents($lock, time());
+ }
+ //检查备份目录是否可写
+ is_writeable($config['path']) || $this->error('备份目录不存在或不可写,请检查后重试!');
+ session('backup_config', $config);
+ //生成备份文件信息
+ $file = array(
+ 'name' => date('Ymd-His', time()),
+ 'part' => 1,
+ );
+ session('backup_file', $file);
+ //缓存要备份的表
+ session('backup_tables', $tables);
+ //创建备份文件
+ $Database = new \Database($file, $config);
+ if(false !== $Database->create()){
+ $tab = array('id' => 0, 'start' => 0);
+ return json(array('code'=>1,'tab' => $tab,'tables' => $tables,'msg'=>'初始化成功!'));
+ } else {
+ $this->error('初始化失败,备份文件创建失败!');
+ }
+ } elseif (request()->isGet() && is_numeric($id) && is_numeric($start)) { //备份数据
+ $tables = session('backup_tables');
+ //备份指定表
+ $Database = new \Database(session('backup_file'), session('backup_config'));
+ $start = $Database->backup($tables[$id], $start);
+ if(false === $start){ //出错
+ $this->error('备份出错!');
+ } elseif (0 === $start) { //下一表
+ if(isset($tables[++$id])){
+ $tab = array('id' => $id, 'start' => 0);
+ return json(array('code'=>1,'tab' => $tab,'msg'=>'备份完成!'));
+ } else { //备份完成,清空缓存
+ unlink(session('backup_config.path') . 'backup.lock');
+ session('backup_tables', null);
+ session('backup_file', null);
+ session('backup_config', null);
+ return json(array('code'=>1,'msg'=>'备份完成!'));
+ }
+ } else {
+ $tab = array('id' => $id, 'start' => $start[0]);
+ $rate = floor(100 * ($start[0] / $start[1]));
+ return json(array('code'=>1,'tab' => $tab,'msg'=>"正在备份...({$rate}%)"));
+ }
+ } else { //出错
+ $this->error('参数错误!');
+ }
+ }
+ /*
+ * 清理缓存
+ */
+ public function clear()
+ {
+ Cache::clear();
+ $this->success ('清理缓存成功');
+ }
+ public function filter_add(){
+ return $this->fetch();
+ }
+ public function filter_edit(){
+ $list=Db::name('wordfilter')->find(input('id'));
+ $this->assign('list',$list);
+ return $this->fetch();
+ }
+ /**
+ * 添加操作
+ */
+ public function filter_runadd()
+ {
+ $title=input('title','','trim');
+ $count=Db::name('wordfilter')->where(['title'=>$title])->count();
+ if($count){
+ $this->error('此敏感词已存在');
+ }
+ $data=[];
+ $data['title']=$title;
+ $data['status']=input('status',0);
+ $data['infor']=input('infor');
+ $data['create_date']=time();
+ $res=Db::name('wordfilter')->insert($data);
+ if($res){
+ $this->persit();
+ $this->success('添加成功',url('filter'));
+ }else{
+ $this->error('添加失败',url('filter'));
+ }
+ }
+ /**
+ * 修改操作
+ */
+ public function filter_runedit()
+ {
+ $title=input('title','','trim');
+ $id=input('id');
+ $count=Db::name('wordfilter')->where(['title'=>$title,'id'=>['neq',$id]])->count();
+ if($count){
+ $this->error('此敏感词已存在');
+ }
+
+ $data=[];
+ $data['id']=$id;
+ $state=input('status');
+ if($state!='')$data['status']=$state;
+ $data['title']=$title;
+ $data['infor']=input('infor');
+
+ $rst=Db::name('wordfilter')->update($data);
+ if($rst!==false){
+ $this->persit();
+ $this->success('修改成功',url('filter'));
+ }else{
+ $this->error('修改失败',url('filter'));
+ }
+ }
+ /**
+ * 敏感词管理
+ * @return mixed|string
+ */
+ public function filter(){
+ $list=Db::name('wordfilter')->where([])->order('create_date desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show=$list->render();
+
+ $this->assign('list',$list);
+ $this->assign('page',$show);
+ return $this->fetch();
+ }
+ /**
+ * 删除
+ */
+ public function filter_del()
+ {
+ $admin_id=input('id');
+ if (empty($admin_id)){
+ $this->error('ID不存在',url('index'));
+ }
+ $rst=Db::name('wordfilter')->delete($admin_id);
+ if($rst!==false){
+ $this->persit();
+ $this->success('删除成功',url('filter'));
+ }else{
+ $this->error('删除失败',url('filter'));
+ }
+ }
+ /**
+ * 权限(后台菜单)显示/隐藏
+ */
+ public function filter_state()
+ {
+ $id=input('x');
+ $statusone=Db::name('wordfilter')->where(array('id'=>$id))->value('status');//判断当前状态情况
+ $this->persit();
+ if($statusone==1){
+ $statedata = array('status'=>0);
+ Db::name('wordfilter')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('状态禁止');
+ }else{
+ $statedata = array('status'=>1);
+ Db::name('wordfilter')->where(array('id'=>$id))->setField($statedata);
+ Cache::clear();
+ $this->success('状态开启');
+ }
+ }
+ protected function persit(){
+ $list=Db::name('wordfilter')->where(array('status'=>1))->select();
+
+ $html="";
+ $path =ROOT_PATH.'app/extra/';
+ $url=$path.'filters.php';
+ file_put_contents($url, $html);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Tjjg.php b/app/admin/controller/Tjjg.php
new file mode 100644
index 0000000..6fd88c6
--- /dev/null
+++ b/app/admin/controller/Tjjg.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Tjjg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='tjjg';
+ $this->controller_name='Tjjg';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function tjjg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function tjjg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function tjjg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function tjjg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function tjjg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function tjjg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function tjjg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Type.php b/app/admin/controller/Type.php
new file mode 100644
index 0000000..f4cdab5
--- /dev/null
+++ b/app/admin/controller/Type.php
@@ -0,0 +1,425 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+
+class Type extends Base
+{
+ /**
+ * 列表
+ */
+ public function type_list()
+ {
+ $where=[];
+ $type_type=input('type_type',0,'intval');
+ if($type_type){
+ $where['type_type']=$type_type;
+ }
+ $lists=Db::name('type')->where($where)->order('type_type,type_order')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $lists->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('type_type',$type_type);
+ $this->assign('types',config('type'));
+ $this->assign('lists',$lists);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_type_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function type_add()
+ {
+ if (!request()->isAjax()){
+ $this->assign('types',config('type'));
+ return $this->fetch();
+ }else{
+ $type_type=input('type_type',0,'intval');
+ $type_id=input('type_id',0,'intval');
+ $type_name=input('type_name','');
+ //$rst=Db::name('type')->where('type_type',$type_type)->where('type_id='.$type_id.' or type_name=\''.$type_name.'\'')->find();
+ $rst=Db::name('type')->where('type_type',$type_type)->where('type_name=\''.$type_name.'\'')->find();
+
+ if($rst){
+ $this->error('存在相同的分类ID或分类名称',url('admin/Type/type_list'));
+ }else{
+ //查找对应类型,并自增typeid
+ $find=Db::name('type')->where('type_type',$type_type)->order('type_id desc')->find();
+ if($find){
+ $type_id=$find['type_id']+1;
+ }else{
+ $type_id=1;
+ }
+
+ $sl_data=array(
+ 'type_name'=>$type_name,
+ 'type_id'=>$type_id,
+ 'type_type'=>$type_type,
+ 'type_status'=>input('type_status',0),
+ 'type_order'=>input('type_order',50,'intval')
+ );
+ //下载类型10 公告类型11 要闻类型12 你问我答13 文化四板行业15 这些需要修改auth_rule
+ if(in_array($type_type,[10,11,12,13,15])){
+ switch ($type_type) {
+ case 10:
+ $pid=141;
+ $name='admin/Download/download';
+ $level=3;
+ break;
+ case 11:
+ $pid=47;
+ $name='admin/Bsgg/bsgg';
+ $level=2;
+ break;
+ case 12:
+ $pid=72;
+ $name='admin/Bsyw/bsyw';
+ $level=2;
+ break;
+ case 13:
+ $pid=97;
+ $name='admin/Nwwd/nwwd';
+ $level=2;
+ break;
+ case 15:
+ $pid=230;
+ $name='admin/Culture/culture';
+ $level=3;
+ break;
+ }
+ // 启动事务
+ Db::startTrans();
+ try{
+ $id=Db::name('type')->insertGetId($sl_data);
+ $last=Db::name('auth_rule')->where(['pid'=>$pid])->order('sort desc')->find();
+ $data=[
+ 'name'=>$name.'_list?cid='.$type_id,
+ 'title'=>$type_name,
+ 'type'=>1,
+ 'status'=>1,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$pid,
+ 'level'=>$level,
+ 'sort'=>$last['sort']+10,
+ 'addtime'=>time()
+ ];
+ $rule_id=Db::name('auth_rule')->insertGetId($data);
+ //子菜单
+ $data = [
+ [
+ 'name'=>$name.'_edit?cid='.$type_id,
+ 'title'=>'编辑',
+ 'type'=>1,
+ 'status'=>0,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$rule_id,
+ 'level'=>$level+1,
+ 'sort'=>10,
+ 'addtime'=>time()
+ ],
+ [
+ 'name'=>$name.'_add?cid='.$type_id,
+ 'title'=>'增加',
+ 'type'=>1,
+ 'status'=>0,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$rule_id,
+ 'level'=>$level+1,
+ 'sort'=>20,
+ 'addtime'=>time()
+ ],
+ [
+ 'name'=>$name.'_order?cid='.$type_id,
+ 'title'=>'排序',
+ 'type'=>1,
+ 'status'=>0,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$rule_id,
+ 'level'=>$level+1,
+ 'sort'=>30,
+ 'addtime'=>time()
+ ],
+ [
+ 'name'=>$name.'_del?cid='.$type_id,
+ 'title'=>'删除',
+ 'type'=>1,
+ 'status'=>0,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$rule_id,
+ 'level'=>$level+1,
+ 'sort'=>40,
+ 'addtime'=>time()
+ ],
+ [
+ 'name'=>$name.'_alldel?cid='.$type_id,
+ 'title'=>'全选删除',
+ 'type'=>1,
+ 'status'=>0,
+ 'notcheck'=>0,
+ 'css'=>'',
+ 'condition'=>'',
+ 'pid'=>$rule_id,
+ 'level'=>$level+1,
+ 'sort'=>50,
+ 'addtime'=>time()
+ ]
+ ];
+ Db::name('auth_rule')->insertAll($data);
+ cache('menus_admin_'.session('admin_auth.aid'),null);
+ //提交事务
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ $this->error('添加失败',url('admin/Type/type_list'));
+ }
+ $this->success('添加成功',url('admin/Type/type_list'));
+ }else{
+ $rst=Db::name('type')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Type/type_list'));
+ }else{
+ $this->error('添加失败',url('admin/Type/type_list'));
+ }
+ }
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function type_edit()
+ {
+ if (!request()->isAjax()) {
+ $id = input('id');
+ if (empty($id)) {
+ $this->error('参数错误', url('admin/Type/type_list'));
+ }
+ $list = Db::name('type')->find($id);
+ $this->assign('list', $list);
+ $this->assign('types',config('type'));
+ return $this->fetch();
+ }else{
+ $id=input('id',0,'intval');
+ $old=Db::name('type')->find($id);
+ $type_type=$old['type_type'];
+ $type_id=input('type_id',0,'intval');
+ $type_name=input('type_name','');
+ $rst=Db::name('type')->where('id','neq',$id)->where('type_type',$type_type)->where('type_id='.$type_id.' or type_name=\''.$type_name.'\'')->find();
+ if($rst){
+ $this->error('存在相同的分类ID或分类名称',url('admin/Type/type_list'));
+ }else{
+ $sl_data=array(
+ 'id'=>$id,
+ 'type_name'=>$type_name,
+ 'type_type'=>$type_type,
+ 'type_status'=>input('type_status',0),
+ 'type_order'=>input('type_order',50,'intval')
+ );
+ //下载类型10 公告类型11 要闻类型12 你问我答13 文化四板行业15 这些需要修改auth_rule
+ if(in_array($type_type,[10,11,12,13,15])){
+ if($old['type_id']!=$type_id || $old['type_name']!=$type_name){
+ //需要更新auth_rule
+ switch ($type_type) {
+ case 10:
+ $pid=141;
+ $name='admin/Download/download';
+ $level=3;
+ break;
+ case 11:
+ $pid=47;
+ $name='admin/Bsgg/bsgg';
+ $level=2;
+ break;
+ case 12:
+ $pid=72;
+ $name='admin/Bsyw/bsyw';
+ $level=2;
+ break;
+ case 13:
+ $pid=97;
+ $name='admin/Nwwd/nwwd';
+ $level=2;
+ break;
+ case 15:
+ $pid=230;
+ $name='admin/Culture/culture';
+ $level=3;
+ break;
+ }
+ Db::startTrans();
+ try{
+ Db::name('type')->update($sl_data);
+ Db::name('auth_rule')->where(['pid'=>$pid,'name'=>$name.'_list?cid='.$old['type_id']])->update(['name'=>$name.'_list?cid='.$type_id,'title'=>$type_name]);
+ cache('menus_admin_'.session('admin_auth.aid'),null);
+ // 提交事务
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ $this->error('修改失败',url('admin/Type/type_list'));
+ }
+ $this->success('修改成功',url('admin/Type/type_list'));
+ }else{
+ //不需更新auth_rule
+ $rst=Db::name('type')->update($sl_data);
+ if($rst){
+ $this->success('修改成功',url('admin/Type/type_list'));
+ }else{
+ $this->error('修改失败',url('admin/Type/type_list'));
+ }
+ }
+ }else{
+ $rst=Db::name('type')->update($sl_data);
+ if($rst){
+ $this->success('修改成功',url('admin/Type/type_list'));
+ }else{
+ $this->error('修改失败',url('admin/Type/type_list'));
+ }
+ }
+ }
+ }
+ }
+ /**
+ * 排序
+ */
+ public function type_order()
+ {
+ if (!request()->isAjax()){
+ $this->error('提交方式不正确',url('admin/Type/type_list'));
+ }else{
+ foreach (input('post.') as $id => $type_order){
+ Db::name('type')->update(['id'=>$id,'type_order'=>$type_order]);
+ }
+ $this->success('排序更新成功',url('admin/Type/type_list'));
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function type_del()
+ {
+ $p=input('p');
+ $id=input('id',0,'intval');
+ $rst=$this->_type_del($id);
+ if($rst){
+ cache('menus_admin_'.session('admin_auth.aid'),null);
+ $this->success('删除成功',url('admin/Type/type_list',array('p'=>$p)));
+ }else{
+ $this -> error("删除失败!",url('admin/Type/type_list',array('p'=>$p)));
+ }
+ }
+ /**
+ * 删除(单个)
+ * @param int $id
+ * @return boolean
+ */
+ private function _type_del($id)
+ {
+ $old=Db::name('type')->find($id);
+ //下载类型10 公告类型11 要闻类型12 你问我答13 文化四板行业15 这些需要修改auth_rule
+ if(in_array($old['type_type'],[10,11,12,13,15])){
+ switch ($old['type_type']) {
+ case 10:
+ $pid=141;
+ $name='admin/Download/download';
+ break;
+ case 11:
+ $pid=47;
+ $name='admin/Bsgg/bsgg';
+ break;
+ case 12:
+ $pid=72;
+ $name='admin/Bsyw/bsyw';
+ break;
+ case 13:
+ $pid=97;
+ $name='admin/Nwwd/nwwd';
+ break;
+ case 15:
+ $pid=230;
+ $name='admin/Culture/culture';
+ break;
+ }
+ Db::startTrans();
+ try{
+ $rule=Db::name('auth_rule')->where(['pid'=>$pid,'name'=>$name.'_list?cid='.$old['type_id']])->find();
+ $ids=get_rule_ids_child($rule['id']);
+ if($ids){
+ Db::name('auth_rule')->where('id','in',$ids)->delete();
+ }
+ Db::name('type')->delete($id);
+ // 提交事务
+ Db::commit();
+ } catch (\Exception $e) {
+ // 回滚事务
+ Db::rollback();
+ return false;
+ }
+ return true;
+ }else{
+ $rst=Db::name('type')->delete($id);
+ if($rst!==false){
+ return true;
+ }else{
+ return false;
+ }
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function type_state()
+ {
+ $id=input('x');
+ $status=Db::name('type')->where(array('type_id'=>$id))->value('type_status');
+ if($status==1){
+ $statedata = array('types_status'=>0);
+ Db::name('type')->where(array('type_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('type_status'=>1);
+ Db::name('type')->where(array('type_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function type_alldel()
+ {
+ $p = input('p');
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请选择待删除数据",url('admin/Type/type_list',array('p'=>$p)));
+ }
+ if(!is_array($ids)){
+ $ids=(array)$ids;
+ }
+ foreach ($ids as $id){
+ $this->_type_del($id);
+ }
+ cache('menus_admin_'.session('admin_auth.aid'),null);
+ $this->success("删除成功",url('admin/Type/type_list',array('p'=>$p)));
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ueditor.php b/app/admin/controller/Ueditor.php
new file mode 100644
index 0000000..4a4664d
--- /dev/null
+++ b/app/admin/controller/Ueditor.php
@@ -0,0 +1,511 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use app\common\controller\Common;
+use think\Db;
+
+class Ueditor extends Common
+{
+ protected $config;
+ protected $type;
+ protected function _initialize()
+ {
+ parent::_initialize();
+ $adminid=session('admin_auth.aid');
+ $userid=session('hid');
+ if(empty($adminid) && empty($userid)){
+ exit("非法上传!");
+ }
+ }
+ /**
+ * 上传
+ */
+ public function upload()
+ {
+ $this->type=input('edit_type','');
+ date_default_timezone_set("Asia/chongqing");
+ error_reporting(E_ERROR);
+ header("Content-Type: text/html; charset=utf-8");
+ $CONFIG = json_decode(preg_replace("/\/\*[\s\S]+?\*\//", "", file_get_contents("./public/ueditor/config.json")), true);
+ $storage_domain=config('storage.domain');
+ $config_qiniu=array(
+ "imageUrlPrefix"=> $storage_domain, /* 图片访问路径前缀 */
+ "scrawlUrlPrefix" => $storage_domain, /* 图片访问路径前缀 */
+ "snapscreenUrlPrefix" => $storage_domain, /* 图片访问路径前缀 */
+ "catcherUrlPrefix" => $storage_domain, /* 图片访问路径前缀 */
+ "fileUrlPrefix" => $storage_domain, /* 文件访问路径前缀 */
+ "imageManagerUrlPrefix" => $storage_domain, /* 图片访问路径前缀 */
+ );
+ if(config('storage.storage_open') && $this->type!='mats'){
+ $CONFIG=array_merge($CONFIG,$config_qiniu);
+ }
+ $this->config=$CONFIG;
+ $action = input('action');
+ switch ($action) {
+ case 'config':
+ $result = json_encode($CONFIG);
+ break;
+
+ /* 上传图片 */
+ case 'uploadimage':
+ $result = $this->_ueditor_upload();
+ break;
+ /* 上传涂鸦 */
+ case 'uploadscrawl':
+ $result = $this->_ueditor_upload_scrawl();
+ break;
+ /* 上传视频 */
+ case 'uploadvideo':
+ $result = $this->_ueditor_upload(array('maxSize' => 1073741824,/*1G*/'exts'=>array('mp4', 'avi', 'wmv','rm','rmvb','mkv')));
+ break;
+ /* 上传文件 */
+ case 'uploadfile':
+ $result = $this->_ueditor_upload(array('exts'=>array('jpg', 'gif', 'png', 'jpeg','txt','pdf','doc','docx','xls','xlsx','zip','rar','ppt','pptx',)));
+ break;
+
+ /* 列出图片 */
+ case 'listimage':
+ /* 列出文件 */
+ case 'listfile':
+ $result = $this->_ueditor_list($action);
+ break;
+ /* 抓取远程文件 */
+ case 'catchimage':
+ $result = $this->_ueditor_upload_catch();
+ break;
+
+ default:
+ $result = json_encode(array('state'=> '请求地址出错'));
+ break;
+ }
+
+ /* 输出结果 */
+ if (isset($_GET["callback"]) && false ) {
+ if (preg_match("/^[\w_]+$/", $_GET["callback"])) {
+ echo htmlspecialchars($_GET["callback"]) . '(' . $result . ')';
+ } else {
+ echo json_encode(array(
+ 'state'=> 'callback参数不合法'
+ ));
+ }
+ } else {
+ exit($result) ;
+ }
+ }
+ private function _ueditor_list($action)
+ {
+ /* 判断类型 */
+ switch ($action) {
+ /* 列出文件 */
+ case 'listfile':
+ $allowFiles = $this->config['fileManagerAllowFiles'];
+ $listSize = $this->config['fileManagerListSize'];
+ $prefix='file/';
+ break;
+ /* 列出图片 */
+ case 'listimage':
+ default:
+ $allowFiles = $this->config['imageManagerAllowFiles'];
+ $listSize = $this->config['imageManagerListSize'];
+ $prefix='image/';
+ }
+ $allowFiles = substr(str_replace(".", "|", join("", $allowFiles)), 1);
+ /* 获取参数 */
+ $size = isset($_GET['size']) ? htmlspecialchars($_GET['size']) : $listSize;
+ $start = isset($_GET['start']) ? htmlspecialchars($_GET['start']) : 0;
+ $end = intval($start) + intval($size);
+ if($this->type=='mats'){
+ //微信公众平台图片列表
+ $files=Db::name('we_pic')->field('mtime,url')->select();
+ if(empty($files)){
+ return json_encode(array(
+ "state" => "no match file",
+ "list" => array(),
+ "start" => $start,
+ "total" => count($files)
+ ));
+ }
+ /* 获取指定范围的列表 */
+ $len = count($files);
+ for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
+ $list[] = $files[$i];
+ }
+ }elseif(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $files = $upload->listfile($prefix);
+ if (!count($files)) {
+ return json_encode(array(
+ "state" => "no match file",
+ "list" => array(),
+ "start" => $start,
+ "total" => count($files)
+ ));
+ }
+ /* 获取指定范围的列表 */
+ $len = count($files);
+ for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
+ $tmp['url']= $files[$i]['key'];
+ $tmp['mtime']= $files[$i]['putTime'];
+ $list[]=$tmp;
+ }
+ }else{
+ /* 获取文件列表 */
+ $path = './data/upload/';
+ $files = $this->getfiles($path, $allowFiles);
+ if (!count($files)) {
+ return json_encode(array(
+ "state" => "no match file",
+ "list" => array(),
+ "start" => $start,
+ "total" => count($files)
+ ));
+ }
+ /* 获取指定范围的列表 */
+ $len = count($files);
+ for ($i = min($end, $len) - 1, $list = array(); $i < $len && $i >= 0 && $i >= $start; $i--){
+ $list[] = $files[$i];
+ }
+ }
+ /* 返回数据 */
+ $result = json_encode(array(
+ "state" => "SUCCESS",
+ "list" => $list,
+ "start" => $start,
+ "total" => count($files)
+ ));
+ return $result;
+ }
+ /**
+ * 遍历获取目录下的指定类型的文件
+ * @author rainfer <81818832@qq.com>
+ * @param string $path
+ * @param string $allowFiles
+ * @param array $files
+ * @return array
+ */
+ private function getfiles($path, $allowFiles, &$files = array())
+ {
+ if (!is_dir($path)) return null;
+ if(substr($path, strlen($path) - 1) != '/') $path .= '/';
+ $handle = opendir($path);
+ while (false !== ($file = readdir($handle))) {
+ if ($file != '.' && $file != '..') {
+ $path2 = $path . $file;
+ if (is_dir($path2)) {
+ $this->getfiles($path2, $allowFiles, $files);
+ } else {
+ if (preg_match("/\.(".$allowFiles.")$/i", $file)) {
+ $files[] = array(
+ 'url'=> __ROOT__.substr($path2,1),
+ 'mtime'=> filemtime($path2)
+ );
+ }
+ }
+ }
+ }
+ return $files;
+ }
+ //上传
+ private function _ueditor_upload($config=array())
+ {
+ $title = '';
+ $url='';
+ if(!empty($config)){
+ $this->config=array_merge($this->config,$config);;
+ }
+ if($this->type=='mats'){
+ $file = request()->file('upfile');
+ if($file){
+ $validate=array(
+ 'size'=>5024*1024 ,// 设置附件上传大小1M
+ 'ext'=>array('jpg', 'png', 'gif'),
+ );
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if($info) {
+ $imgurl=ROOT_PATH.config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //上传微信
+ $wechat=controller('wechat/WeBase');
+ $material = $wechat->app->material;
+ $result = $material->uploadArticleImage($imgurl);
+ $url = $result->url;
+ if(!empty($url)){
+ $data['mtime']=time();
+ $data['url']=$url;
+ Db::name('we_pic')->insert($data);
+ $title =$info->getFilename();
+ $state = 'SUCCESS';
+ }else{
+ $state ='上传微信平台失败';
+ }
+ $file = null;
+ @unlink($imgurl);
+ }else{
+ $state = $file->getError();
+ }
+ }else{
+ $state = '未接收到文件';
+ }
+ }elseif(config('storage.storage_open')){
+ //七牛云存储
+ $upload = \Qiniu::instance();
+ $info = $upload->upload();
+ $error = $upload->getError();
+ if ($info) {
+ $state = 'SUCCESS';
+ $url= $info[0]['key'];
+ $title =$info[0]['name'];
+ }else{
+ $state = $error;
+ }
+ }else{
+ //本地上传
+ $file = request()->file('upfile');
+ if($file){
+ $validate=array(
+ 'size'=>3145728 ,// 设置附件上传大小
+ //'ext'=>array('jpg', 'gif', 'png', 'jpeg'),
+ );
+ $info = $file->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if($info) {
+ $img_url=config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入本地文件数据库
+ $data['uptime']=time();
+ $data['filesize']=$info->getSize();
+ $data['path']=$img_url;
+ Db::name('plug_files')->insert($data);
+ $title =$info->getFilename();
+ $state = 'SUCCESS';
+ $url= __ROOT__.$img_url;
+ }else{
+ $state = $file->getError();
+ }
+ }else{
+ $state = '未接收到文件';
+ }
+ }
+ $response=array(
+ "state" => $state,
+ "url" => $url,
+ "title" => $title,
+ "original" =>$title,
+ );
+ return json_encode($response);
+ }
+ //涂鸦
+ private function _ueditor_upload_scrawl()
+ {
+ $data = input('post.' . $this->config ['scrawlFieldName']);
+ $url='';
+ $title = '';
+ $oriName = '';
+ if (empty ($data)) {
+ $state= 'Scrawl Data Empty!';
+ } else {
+ if($this->type=='mats'){
+ //本地存储
+ $img = base64_decode($data);
+ if(strlen($img)>1024*1024){
+ $state ='文件超过1M';
+ }else{
+ $savepath = save_storage_content('png', $img);
+ //上传微信
+ $wechat=controller('wechat/WeBase');
+ $material = $wechat->app->material;
+ $result = $material->uploadArticleImage(ROOT_PATH.$savepath);
+ $url = $result->url;
+ if(!empty($url)){
+ $sldata['mtime']=time();
+ $sldata['url']=$url;
+ Db::name('we_pic')->insert($sldata);
+ $state = 'SUCCESS';
+ }else{
+ $state ='上传微信平台失败';
+ }
+ @unlink(ROOT_PATH.$savepath);
+ }
+ }elseif(config('storage.storage_open')){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->uploadOne('data:image/png;base64,'.$data,"image/");
+ $error = $upload->getError();
+ if ($info) {
+ $state = 'SUCCESS';
+ $url= $info['key'];
+ $title =$info['name'];
+ }else{
+ $state = $error;
+ }
+ }else{
+ //本地存储
+ $img = base64_decode($data);
+ $savepath = save_storage_content('png', $img);
+ if ($savepath) {
+ $state = 'SUCCESS';
+ $url = __ROOT__.'/'.$savepath;
+ //写入数据库
+ $file['uptime']=time();
+ $file['filesize']=strlen($img);
+ $file['path']='/'.$savepath;
+ Db::name('plug_files')->insert($file);
+ } else {
+ $state = 'Save scrawl file error!';
+ }
+ }
+ }
+ $response=array(
+ "state" => $state,
+ "url" => $url,
+ "title" => $title,
+ "original" =>$oriName ,
+ );
+ return json_encode($response);
+ }
+ //抓取远程文件
+ private function _ueditor_upload_catch()
+ {
+ set_time_limit(0);
+ $sret = array(
+ 'state' => '',
+ 'list' => null
+ );
+ $savelist = array();
+ $flist = input('post.' . $this->config ['catcherFieldName'].'/a');
+ if (empty ($flist)) {
+ $sret ['state'] = 'ERROR';
+ } else {
+ $sret ['state'] = 'SUCCESS';
+ foreach ($flist as $f) {
+ if (preg_match('/^(http|ftp|https):\\/\\//i', $f)) {
+ $ext = strtolower(pathinfo($f, PATHINFO_EXTENSION));
+ if (in_array('.' . $ext, $this->config ['catcherAllowFiles'])) {
+ if ($img = file_get_contents($f)) {
+ if($this->type=='mats' && in_array($ext,array('jpg','png')) && strlen($img)<1024*1024){
+ //本地
+ $savepath = save_storage_content($ext, $img);
+ if ($savepath) {
+ //上传微信
+ $wechat=controller('wechat/WeBase');
+ $material = $wechat->app->material;
+ $result = $material->uploadArticleImage(ROOT_PATH.$savepath);
+ $url = $result->url;
+ if(!empty($url)){
+ $sldata['mtime']=time();
+ $sldata['url']=$url;
+ Db::name('we_pic')->insert($sldata);
+ $savelist [] = array(
+ 'state' => 'SUCCESS',
+ 'url' => $url,
+ 'size' => strlen($img),
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f)
+ );
+ }else{
+ $savelist [] = array(
+ 'state' => 'Save remote file error!',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ @unlink(ROOT_PATH.$savepath);
+ } else {
+ $savelist [] = array(
+ 'state' => 'Save remote file error!',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ }elseif(config('storage.storage_open') && stripos($f,config('storage.domain'))===false){
+ //七牛
+ $upload = \Qiniu::instance();
+ $info = $upload->uploadcatch($f,'','',$ext);
+ if ($info) {
+ $savelist [] = array(
+ 'state' => 'SUCCESS',
+ 'url' => $info[0]['key'],
+ 'size' => 0,
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f)
+ );
+ }else{
+ $savelist [] = array(
+ 'state' => 'Save remote file error!',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ }else{
+ //本地
+ $savepath = save_storage_content($ext, $img);
+ if ($savepath) {
+ $savelist [] = array(
+ 'state' => 'SUCCESS',
+ 'url' => __ROOT__.'/'.$savepath,
+ 'size' => strlen($img),
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f)
+ );
+ //写入数据库
+ $data['uptime']=time();
+ $data['filesize']=strlen($img);
+ $data['path']='/'.$savepath;
+ Db::name('plug_files')->insert($data);
+ } else {
+ $savelist [] = array(
+ 'state' => 'Save remote file error!',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ }
+ } else {
+ $savelist [] = array(
+ 'state' => 'Get remote file error',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ } else {
+ $sret ['state'] = 'File ext not allowed';
+ }
+ } else {
+ $savelist [] = array(
+ 'state' => 'not remote image',
+ 'url' => '',
+ 'size' => '',
+ 'title' => '',
+ 'original' => '',
+ 'source' => htmlspecialchars($f),
+ );
+ }
+ }
+ $sret ['list'] = $savelist;
+ }
+ return json_encode($sret);
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Video.php b/app/admin/controller/Video.php
new file mode 100644
index 0000000..c2632a2
--- /dev/null
+++ b/app/admin/controller/Video.php
@@ -0,0 +1,345 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use OSS\OssClient;
+use OSS\Core\OssException;
+
+class Video extends Base
+{
+ /**
+ * 宣传片列表
+ */
+ public function video_list()
+ {
+ $vd_cid=input('cid',0,'intval');
+ $where['type_type']=16;
+ if($vd_cid){
+ $where['vd_cid']=$vd_cid;
+ }
+ $videos=Db::name('video')->alias('a')
+ ->join(config('database.prefix').'type b','a.vd_cid=b.type_id')
+ ->where($where)->order('vd_order,vd_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+ $show = $videos->render();
+ $show=preg_replace("(]*page[=|/](\d+).+?>(.+?)<\/a>)","$2",$show);
+ $this->assign('page',$show);
+ $this->assign('videos',$videos);
+ $this->assign('vd_cid',$vd_cid);
+ $vd_cids=Db::name('type')->where('type_type',16)->order('type_order')->select();
+ $this->assign('vd_cids',$vd_cids);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_video_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /**
+ * 添加显示
+ */
+ public function video_add()
+ {
+ $vd_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ $vd_cids=Db::name('type')->where('type_type',16)->order('type_order')->select();
+ $this->assign('vd_cids',$vd_cids);
+ $this->assign('vd_cid',$vd_cid);
+ return $this->fetch();
+ }else{
+ //上传图片部分
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if ($file) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ //视频(使用oss)
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ if(config('aliyun_oss.oss_open')){
+ $config=config('aliyun_oss');
+ $oss=new \OSS\OssClient($config['accesskey'],$config['secretkey'],$config['endpoint'],true);
+ foreach ($files as $file) {
+ $fileinfo=$file->getInfo();
+ $filename=$fileinfo['name'];
+ $path=$fileinfo['tmp_name'];
+ try{
+ $oss->uploadFile($config['bucket'],$filename,$path);
+ } catch(OssException $e) {
+ $this->error($e->getMessage(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ $file_url = $config['endpoint'].'/'.$filename;
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $fileinfo['size'];
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ }
+ }else{
+ $validate = config('upload_validate');
+ foreach ($files as $file) {
+ $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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ }
+ $file_path=request()->post('file_path');
+ if(empty($fileall_url)&&$file_path){
+ $fileall_url=$file_path;
+ }
+ $sl_data=array(
+ 'vd_name'=>input('vd_name'),
+ 'vd_img'=>$img_one,//封面图片路径
+ 'vd_status'=>input('vd_status',0),
+ 'vd_content'=>htmlspecialchars_decode(input('vd_content')),
+ 'vd_uid'=>session('admin_auth.aid'),
+ 'vd_time'=>time(),
+ 'vd_order'=>input('vd_order',50,'intval'),
+ 'vd_video'=>$fileall_url,
+ 'vd_cid'=>$vd_cid
+ );
+ $rst=Db::name('video')->insert($sl_data);
+ if($rst){
+ $this->success('添加成功',url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }else{
+ $this->error('添加失败',url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }
+ }
+ }
+ /**
+ * 编辑显示
+ */
+ public function video_edit()
+ {
+ $vd_cid=input('cid',0,'intval');
+ if (!request()->isAjax()) {
+ $vd_id = input('vd_id');
+ if (empty($vd_id)) {
+ if($vd_cid){
+ $this->error('参数错误', url('admin/Link/link_list',['cid'=>$vd_cid]));
+ }else{
+ $this->error('参数错误', url('admin/Link/link_list'));
+ }
+ }
+ $video_list = Db::name('video')->find($vd_id);
+ $this->assign('video_list', $video_list);
+ $vd_cids=Db::name('type')->where('type_type',16)->order('type_order')->select();
+ $this->assign('vd_cids',$vd_cids);
+ $this->assign('vd_cid',$video_list['vd_cid']);
+ return $this->fetch();
+ }else{
+ $img_one='';
+ $file = request()->file('pic_one');
+ $validate = config('upload_validate');
+ //单图
+ if (!empty($file)) {
+ $info = $file[0]->validate($validate)->rule('uniqid')->move(ROOT_PATH . config('upload_path') . DS . date('Y-m-d'));
+ if ($info) {
+ $img_url = config('upload_path'). '/' . date('Y-m-d') . '/' . $info->getFilename();
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $img_url;
+ Db::name('plug_files')->insert($data);
+ $img_one = $img_url;
+ } else {
+ $this->error($file->getError(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ //视频
+ $files = request()->file('file_all');
+ $fileall_url='';
+ if($files){
+ if(config('aliyun_oss.oss_open')){
+ $config=config('aliyun_oss');
+ $oss=new \OSS\OssClient($config['accesskey'],$config['secretkey'],$config['endpoint'],true);
+ foreach ($files as $file) {
+ $fileinfo=$file->getInfo();
+ $filename=$fileinfo['name'];
+ $path=$fileinfo['tmp_name'];
+ try{
+ $oss->uploadFile($config['bucket'],$filename,$path);
+ } catch(OssException $e) {
+ $this->error($e->getMessage(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ $file_url = $config['endpoint'].'/'.$filename;
+ //写入数据库
+ $data['uptime'] = time();
+ $data['filesize'] = $fileinfo['size'];
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ }
+ }else{
+ $validate = config('upload_validate');
+ foreach ($files as $file) {
+ $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['uptime'] = time();
+ $data['filesize'] = $info->getSize();
+ $data['path'] = $file_url;
+ Db::name('plug_files')->insert($data);
+ $fileall_url = $file_url;
+ } else {
+ $this->error($file->getError(), url('admin/Video/video_list',['cid'=>$vd_cid]));//否则就是上传错误,显示错误原因
+ }
+ }
+ }
+ }
+ $file_path=request()->post('file_path');
+ if(empty($fileall_url)&&$file_path){
+ $fileall_url=$file_path;
+ }
+ $sl_data=array(
+ 'vd_id'=>input('vd_id'),
+ 'vd_name'=>input('vd_name'),
+ 'vd_status'=>input('vd_status',0),
+ 'vd_content'=>htmlspecialchars_decode(input('vd_content')),
+ 'vd_order'=>input('vd_order',50,'intval'),
+ 'vd_cid'=>$vd_cid
+ );
+ //图片字段处理
+ if(!empty($img_one)){
+ $sl_data['vd_img']=$img_one;
+ }
+ if(!empty($fileall_url)){
+ $sl_data['vd_video']=$fileall_url;
+ }
+ $rst=Db::name('video')->update($sl_data);
+ if($rst!==false){
+ $this->success('修改成功',url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }else{
+ $this->error('修改失败',url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }
+ }
+ }
+ /**
+ * 排序
+ */
+ public function video_order()
+ {
+ $vd_cid=input('cid',0,'intval');
+ if (!request()->isAjax()){
+ if($vd_cid){
+ $this->error('提交方式不正确', url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }else{
+ $this->error('提交方式不正确', url('admin/Video/video_list'));
+ }
+ }else{
+ foreach (input('post.') as $vd_id => $vd_order){
+ Db::name('video')->update(['vd_id'=>$vd_id,'vd_order'=>$vd_order]);
+ }
+ if($vd_cid){
+ $this->success('排序更新成功',url('admin/Video/video_list',['cid'=>$vd_cid]));
+ }else{
+ $this->success('排序更新成功',url('admin/Video/video_list'));
+ }
+ }
+ }
+ /**
+ * 删除(单个)
+ */
+ public function video_del()
+ {
+ $p=input('p');
+ $rst=Db::name('video')->delete(input('vd_id'));
+ $vd_cid=input('cid',0,'intval');
+ if($rst!==false){
+ if($vd_cid){
+ $this->success('删除成功',url('admin/Video/video_list',array('p'=>$p,'cid'=>$vd_cid)));
+ }else{
+ $this->success('删除成功',url('admin/Video/video_list',array('p'=>$p)));
+ }
+ }else{
+ if($vd_cid){
+ $this -> error("删除失败!",url('admin/Video/video_list',array('p'=>$p,'cid'=>$vd_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Video/video_list',array('p'=>$p)));
+ }
+ }
+ }
+ /**
+ * 删除(全选)
+ */
+ public function video_alldel()
+ {
+ $p = input('p');
+ $ids = input('vd_id/a');
+ $vd_cid=input('cid',0,'intval');
+ if(empty($ids)){
+ if($vd_cid){
+ $this -> error("请选择待删除数据",url('admin/Video/video_list',array('p'=>$p,'cid'=>$vd_cid)));
+ }else{
+ $this -> error("请选择待删除数据",url('admin/Video/video_list',array('p'=>$p)));
+ }
+ }
+ if(is_array($ids)){
+ $where = 'vd_id in('.implode(',',$ids).')';
+ }else{
+ $where = 'vd_id='.$ids;
+ }
+ $rst=Db::name('video')->where($where)->delete();
+ if($rst!==false){
+ if($vd_cid){
+ $this->success("删除成功",url('admin/Video/video_list',array('p'=>$p,'cid'=>$vd_cid)));
+ }else{
+ $this->success("删除成功",url('admin/Video/video_list',array('p'=>$p)));
+ }
+ }else{
+ if($vd_cid){
+ $this -> error("删除失败!",url('admin/Video/video_list',array('p'=>$p,'cid'=>$vd_cid)));
+ }else{
+ $this -> error("删除失败!",url('admin/Video/video_list',array('p'=>$p)));
+ }
+ }
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function video_state()
+ {
+ $id=input('x');
+ $status=Db::name('video')->where(array('vd_id'=>$id))->value('vd_status');
+ if($status==1){
+ $statedata = array('vd_status'=>0);
+ Db::name('video')->where(array('vd_id'=>$id))->setField($statedata);
+ $this->success('未审');
+ }else{
+ $statedata = array('vd_status'=>1);
+ Db::name('video')->where(array('vd_id'=>$id))->setField($statedata);
+ $this->success('已审');
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/WebLog.php b/app/admin/controller/WebLog.php
new file mode 100644
index 0000000..2c321ed
--- /dev/null
+++ b/app/admin/controller/WebLog.php
@@ -0,0 +1,213 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+use think\Db;
+use think\Cache;
+
+class WebLog extends Base
+{
+ /*
+ * 网站日志列表
+ */
+ public function weblog_list()
+ {
+ $methods=['GET','POST','PUT','DELETE','HEAD','PATCH','OPTIONS','Ajax','Pjax'];
+ $request_module=input('request_module','');
+ $controllers=array();
+ $controllers_arr=array();
+ if($request_module){
+ $controllers_arr=\ReadClass::readDir(APP_PATH . $request_module. DS .'controller');
+ $controllers=array_keys($controllers_arr);
+ }
+ $request_controller=input('request_controller','');
+ $actions=array();
+ if($request_module && $request_controller){
+ $actions=$controllers_arr[$request_controller];
+ $actions=array_map('array_shift',$actions['method']);
+ }
+ $request_action=input('request_action','');
+ $request_method=input('request_method','');
+ //组成where
+ $where=array();
+ $join = [
+ [config('database.prefix').'member_list b','b.member_list_id=a.uid', 'LEFT']
+ ];
+ if($request_module){
+ $where['module']=$request_module;
+ }
+ if($request_controller){
+ $where['controller']=$request_controller;
+ }
+ if($request_action){
+ $where['action']=$request_action;
+ }
+ if($request_method){
+ $where['method']=$request_method;
+ }
+ $weblog_list=Db::name('web_log')->where($where)
+ ->order('otime desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
+
+ $show=$weblog_list->render();
+ if($weblog_list){
+ $weblog_list=$weblog_list->toArray();
+ $weblog_list=$weblog_list['data'];
+ foreach ($weblog_list as &$row){
+ $utype=$row['type'];
+ $uid=$row['uid'];
+ $name='';
+ if($utype==2){
+ $user=Db::name('admin')->where(['admin_id'=>$uid])->find();
+ if($user){
+ $name=$user['admin_username'];
+ }
+ }else{
+ $user=Db::name('member_list')->where(['member_list_id'=>$uid])->find();
+ if($user){
+ $name=$user['member_list_username'];
+ }
+ }
+ $row['member_list_id']=$uid;
+ $row['member_list_username']=$name;
+ }
+ }
+ $this->assign('weblog_list',$weblog_list);
+ $this->assign('page',$show);
+ $this->assign('request_module',$request_module);
+ $this->assign('request_controller',$request_controller);
+ $this->assign('request_action',$request_action);
+ $this->assign('request_method',$request_method);
+ $this->assign('controllers',$controllers);
+ $this->assign('actions',$actions);
+ $this->assign('methods',$methods);
+ if(request()->isAjax()){
+ return $this->fetch('ajax_weblog_list');
+ }else{
+ return $this->fetch();
+ }
+ }
+ /*
+ * 网站日志删除
+ */
+ public function weblog_del()
+ {
+ $rst=Db::name('web_log')->delete(input('id'));
+ if($rst!==false){
+ $this->success('删除成功',url('admin/WebLog/weblog_list'));
+ }else{
+ $this -> error("删除失败",url('admin/WebLog/weblog_list'));
+ }
+ }
+ /*
+ * 网站日志全选删除
+ */
+ public function weblog_alldel()
+ {
+ $ids = input('id/a');
+ if(empty($ids)){
+ $this -> error("请至少选择一行",url('admin/WebLog/weblog_list'));
+ }
+ if(is_array($ids)){
+ $where = 'id in('.implode(',',$ids).')';
+ }else{
+ $where = 'id='.$ids;
+ }
+ $rst=Db::name('web_log')->where($where)->delete();
+ if($rst!==false){
+ $this->success("删除成功",url('admin/WebLog/weblog_list'));
+ }else{
+ $this -> error("删除失败",url('admin/WebLog/weblog_list'));
+ }
+ }
+ /*
+ * 网站日志清空
+ */
+ public function weblog_drop()
+ {
+ $rst=Db::name('web_log')->where('id','gt',0)->delete();
+ if($rst!==false){
+ $this->success('清空成功',url('admin/WebLog/weblog_list'));
+ }else{
+ $this -> error("清空失败",url('admin/WebLog/weblog_list'));
+ }
+ }
+
+ /*
+ * 网站日志设置显示
+ */
+ public function weblog_setting()
+ {
+ $web_log=config('web_log');
+ //模块
+ $web_log['not_log_module']=(isset($web_log['not_log_module']) && $web_log['not_log_module'])?join(',',$web_log['not_log_module']):'';
+ $web_log['not_log_controller']=(isset($web_log['not_log_controller']) && $web_log['not_log_controller'])?join(',',$web_log['not_log_controller']):'';
+ $web_log['not_log_action']=(isset($web_log['not_log_action']) && $web_log['not_log_action'])?join(',',$web_log['not_log_action']):'';
+ $web_log['not_log_data']=(isset($web_log['not_log_data']) && $web_log['not_log_data'])?join(',',$web_log['not_log_data']):'';
+ $web_log['not_log_request_method']=(isset($web_log['not_log_request_method']) && $web_log['not_log_request_method'])?join(',',$web_log['not_log_request_method']):'';
+ //控制器 模块
+ $controllers=array();
+ $actions=array();
+ $modules=['home','admin'];
+ foreach($modules as $module){
+ $arr=cache('controllers_'.$module);
+ if(empty($arr)){
+ $arr=\ReadClass::readDir(APP_PATH . $module. DS .'controller');
+ cache('controllers'.'_'.$module,$arr);
+ }
+ if($arr){
+ foreach($arr as $key=>$v){
+ $controllers[$module][]=$module.'/'.$key;
+ $actions[$module.'/'.$key]=array_map('array_shift',$v['method']);
+ }
+ }
+ }
+ $methods=['GET','POST','PUT','DELETE','HEAD','PATCH','OPTIONS','Ajax','Pjax'];
+ $this->assign('methods',$methods);
+ $this->assign('actions',$actions);
+ $this->assign('modules',$modules);
+ $this->assign('controllers',$controllers);
+ $this->assign('web_log',$web_log);
+ return $this->fetch();
+ }
+ /*
+ * 网站日志设置保存
+ */
+ public function weblog_runset()
+ {
+ $weblog_on=input('weblog_on',0,'intval')?true:false;
+ //设置tags
+ $configs=include APP_PATH.'tags.php';
+ $module_init=$configs['module_init'];
+ if($weblog_on){
+ if(!in_array('app\\common\\behavior\\WebLog',$module_init)){
+ $module_init[]='app\\common\\behavior\\WebLog';
+ }
+ }else{
+ $key = array_search('app\\common\\behavior\\WebLog', $module_init);
+ if($key!==false){
+ unset($module_init[$key]);
+ }
+ }
+ $configs=array_merge($configs,['module_init'=>$module_init]);
+ file_put_contents(APP_PATH.'tags.php', "success('设置保存成功',url('admin/WebLog/weblog_setting'));
+ }else{
+ $this->error('设置保存失败',url('admin/WebLog/weblog_setting'));
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Whjrfwzx.php b/app/admin/controller/Whjrfwzx.php
new file mode 100644
index 0000000..47ae581
--- /dev/null
+++ b/app/admin/controller/Whjrfwzx.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Whjrfwzx extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='whjrfwzx';
+ $this->controller_name='Whjrfwzx';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function whjrfwzx_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function whjrfwzx_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function whjrfwzx_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function whjrfwzx_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function whjrfwzx_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function whjrfwzx_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function whjrfwzx_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Whsb.php b/app/admin/controller/Whsb.php
new file mode 100644
index 0000000..bae098a
--- /dev/null
+++ b/app/admin/controller/Whsb.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Whsb extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='whsb';
+ $this->controller_name='Whsb';
+ $this->has_imgs=false;
+ $this->has_img=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 栏目列表
+ */
+ public function whsb_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function whsb_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function whsb_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function whsb_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function whsb_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function whsb_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function whsb_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Whsbhd.php b/app/admin/controller/Whsbhd.php
new file mode 100644
index 0000000..d096798
--- /dev/null
+++ b/app/admin/controller/Whsbhd.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Whsbhd extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='bshd';
+ $this->controller_name='Whsbhd';
+ $this->has_imgs=false;
+ $this->has_img=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 栏目列表
+ */
+ public function bshd_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function bshd_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function bshd_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function bshd_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function bshd_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function bshd_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function bshd_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ypnew.php b/app/admin/controller/Ypnew.php
new file mode 100644
index 0000000..7b98144
--- /dev/null
+++ b/app/admin/controller/Ypnew.php
@@ -0,0 +1,72 @@
+table_name='zgwhjf_ypnew';
+ $this->controller_name='Ypnew';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zgwhjf_ypnew_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zgwhjf_ypnew_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zgwhjf_ypnew_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zgwhjf_ypnew_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zgwhjf_ypnew_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zgwhjf_ypnew_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zgwhjf_ypnew_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Ysjyhnew.php b/app/admin/controller/Ysjyhnew.php
new file mode 100644
index 0000000..dcf7abc
--- /dev/null
+++ b/app/admin/controller/Ysjyhnew.php
@@ -0,0 +1,72 @@
+table_name='zgwhjf_ysjyhnew';
+ $this->controller_name='Ysjyhnew';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zgwhjf_ysjyhnew_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zgwhjf_ysjyhnew_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zgwhjf_ysjyhnew_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zgwhjf_ysjyhnew_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zgwhjf_ysjyhnew_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zgwhjf_ysjyhnew_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zgwhjf_ysjyhnew_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zbxstgzx.php b/app/admin/controller/Zbxstgzx.php
new file mode 100644
index 0000000..92b222a
--- /dev/null
+++ b/app/admin/controller/Zbxstgzx.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Zbxstgzx extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zbxstgzx';
+ $this->controller_name='Zbxstgzx';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zbxstgzx_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zbxstgzx_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zbxstgzx_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zbxstgzx_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zbxstgzx_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zbxstgzx_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zbxstgzx_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zbzq.php b/app/admin/controller/Zbzq.php
new file mode 100644
index 0000000..ff4dddb
--- /dev/null
+++ b/app/admin/controller/Zbzq.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Zbzq extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zbzq';
+ $this->controller_name='Zbzq';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zbzq_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zbzq_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zbzq_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zbzq_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zbzq_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zbzq_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zbzq_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zcfg.php b/app/admin/controller/Zcfg.php
new file mode 100644
index 0000000..bc19087
--- /dev/null
+++ b/app/admin/controller/Zcfg.php
@@ -0,0 +1,68 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Zcfg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zcfg';
+ $this->controller_name='Zcfg';
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function zcfg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zcfg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zcfg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zcfg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zcfg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zcfg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zcfg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zcfwjg.php b/app/admin/controller/Zcfwjg.php
new file mode 100644
index 0000000..6cdd4b6
--- /dev/null
+++ b/app/admin/controller/Zcfwjg.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Zcfwjg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zcfwjg';
+ $this->controller_name='Zcfwjg';
+ $this->has_img=false;
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 列表
+ */
+ public function zcfwjg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zcfwjg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zcfwjg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zcfwjg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zcfwjg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zcfwjg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zcfwjg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zjtd.php b/app/admin/controller/Zjtd.php
new file mode 100644
index 0000000..d2e0679
--- /dev/null
+++ b/app/admin/controller/Zjtd.php
@@ -0,0 +1,71 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+
+class Zjtd extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zjtd';
+ $this->controller_name='Zjtd';
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function zjtd_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zjtd_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zjtd_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zjtd_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zjtd_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zjtd_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zjtd_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/controller/Zzjg.php b/app/admin/controller/Zzjg.php
new file mode 100644
index 0000000..9682478
--- /dev/null
+++ b/app/admin/controller/Zzjg.php
@@ -0,0 +1,70 @@
+
+// +----------------------------------------------------------------------
+namespace app\admin\controller;
+
+class Zzjg extends News
+{
+ public function _initialize()
+ {
+ $this->table_name='zzjg';
+ $this->controller_name='Zzjg';
+ $this->has_imgs=false;
+ $this->has_source=false;
+ parent::_initialize();
+ }
+ /**
+ * 公告列表
+ */
+ public function zzjg_list()
+ {
+ return $this->news_list();
+ }
+ /**
+ * 添加显示
+ */
+ public function zzjg_add()
+ {
+ return $this->news_add();
+ }
+ /**
+ * 编辑显示
+ */
+ public function zzjg_edit()
+ {
+ return $this->news_edit();
+ }
+ /**
+ * 排序
+ */
+ public function zzjg_order()
+ {
+ return $this->news_order();
+ }
+ /**
+ * 删除(单个)
+ */
+ public function zzjg_del()
+ {
+ return $this->news_del();
+ }
+ /**
+ * 删除(全选)
+ */
+ public function zzjg_alldel()
+ {
+ return $this->news_alldel();
+ }
+ /**
+ * 审核/取消审核
+ */
+ public function zzjg_state()
+ {
+ return $this->news_state();
+ }
+}
\ No newline at end of file
diff --git a/app/admin/model/Admin.php b/app/admin/model/Admin.php
new file mode 100644
index 0000000..0ef28c4
--- /dev/null
+++ b/app/admin/model/Admin.php
@@ -0,0 +1,210 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use app\admin\model\MemberList;
+use think\Model;
+use think\Db;
+
+/**
+ * 后台用户模型
+ * @package app\admin\model
+ */
+class Admin extends Model
+{
+
+ protected $autoWriteTimestamp = true;
+ protected $createTime = 'admin_addtime';
+ protected $updateTime = false;
+ /**
+ * 用户登录
+ * @param string $username 用户名
+ * @param string $password 密码
+ * @param bool $rememberme 记住登录
+ * @return bool|mixed
+ */
+ public function login($username = '', $password = '', $rememberme = false)
+ {
+ $username = trim($username);
+ $password = trim($password);
+ $map['admin_username']=$username;
+ $map['admin_open']=1;
+ $user = self::get($map);
+ if (!$user) {
+ $this->error = '用户不存在或被禁用!';
+ } else {
+ if (encrypt_password($password,$user['admin_pwd_salt'])!==$user['admin_pwd']) {
+ $this->error = '密码错误!';
+ } else {
+ $aid = $user['admin_id'];
+ // 更新登录信息
+ $user['admin_last_ip'] = request()->ip();
+ $user['admin_last_time'] = time();
+ $user['admin_hits'] = $user['admin_hits']+1;
+ if ($user->save()) {
+ // 自动登录
+ $this->auto_login(self::get($aid), $rememberme);
+ }
+ return $aid;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 自动登录
+ * @param mixed $user 用户对象
+ * @param bool $rememberme 是否记住登录,默认7天
+ */
+ public function auto_login($user, $rememberme = false)
+ {
+ $avatar= $user->admin_avatar;
+ if(!file_exists($avatar))$avatar='/public/img/headicon.png';
+ // 记录登录
+ $auth = array(
+ 'aid' => $user->admin_id,
+ 'role' => '',
+ 'admin_avatar' => $avatar,
+ 'admin_last_change_pwd_time' => $user->admin_changepwd,
+ 'admin_realname' => $user->admin_realname,
+ 'admin_username' => $user->admin_username,
+ 'member_id' => $user->member_id,
+ 'admin_last_ip' => $user->admin_last_ip,
+ 'admin_last_time' => $user->admin_last_time
+ );
+ $access=db('auth_group_access')->where(['uid'=>$auth['aid']])->order('group_id asc')->find();
+ if($access)$auth['role']=$access['group_id'];
+ session('admin_auth', $auth);
+ session('admin_auth_sign', data_signature($auth));
+
+ // 记住登录
+ if ($rememberme) {
+ $signin_token = $user->admin_username.$user->admin_id.$user->admin_last_time;
+ cookie('aid', $user->admin_id, 24 * 3600 * 7);
+ cookie('signin_token', data_signature($signin_token), 24 * 3600 * 7);
+ }
+ }
+
+ /**
+ * 判断是否登录
+ * @return int 0或用户id
+ */
+ public function is_login()
+ {
+ $user = session('admin_auth');
+ if (empty($user)) {
+ if (cookie('?aid') && cookie('?signin_token')) {
+ $user = $this::get(cookie('aid'));
+ if ($user) {
+ $signin_token = data_signature($user['admin_username'].$user['admin_id'].$user['admin_last_time']);
+ if (cookie('signin_token') == $signin_token) {
+ $this->auto_login($user, true);
+ return $user['admin_id'];
+ }
+ }
+ };
+ return 0;
+ }else{
+ return session('admin_auth_sign') == data_signature($user) ? $user['aid'] : 0;
+ }
+ }
+ /**
+ * 增加管理员
+ */
+ public static function add($admin_username,$admin_pwd_salt='',$admin_pwd,$admin_email='',$admin_tel='',$admin_open=0,$admin_realname='',$group_id=1)
+ {
+ $admin_pwd_salt=$admin_pwd_salt?:random(10);
+ $sldata=array(
+ 'admin_username'=>$admin_username,
+ 'admin_pwd_salt' => $admin_pwd_salt,
+ 'admin_pwd'=>encrypt_password($admin_pwd,$admin_pwd_salt),
+ 'admin_email'=>$admin_email,
+ 'admin_tel'=>$admin_tel,
+ 'admin_open'=>$admin_open,
+ 'admin_realname'=>$admin_realname,
+ 'admin_ip'=>request()->ip(),
+ 'admin_addtime'=>time(),
+ 'admin_changepwd'=>time(),
+ );
+ $admin=self::create($sldata);
+ if($admin){
+ //添加管理组
+ $admin_id=$admin['admin_id'];
+ $accdata=array(
+ 'uid'=>$admin_id,
+ 'group_id'=>$group_id,
+ );
+ Db::name('auth_group_access')->insert($accdata);
+ return $admin_id;
+ }else{
+ return 0;
+ }
+ }
+ /**
+ * 修改管理员
+ * @param array
+ * @return bool
+ */
+ public static function edit($data)
+ {
+ $admin=self::get($data['admin_id'])->toArray();
+ $admin['admin_username']=$data['admin_username'];
+ $admin['admin_email']=$data['admin_email'];
+ $admin['admin_tel']=$data['admin_tel'];
+ $admin['admin_realname']=$data['admin_realname'];
+ $admin['admin_open']=isset($data['admin_open'])?$data['admin_open']:0;
+ if($data['admin_pwd']){
+ $admin['admin_pwd_salt']=random(10);
+ $admin['admin_pwd']=encrypt_password($data['admin_pwd'],$admin['admin_pwd_salt']);
+ $admin['admin_changepwd']=time();
+ }
+ $rst=self::where('admin_id',$data['admin_id'])->update($admin);
+ if($rst!==false){
+ $access=Db::name('auth_group_access')->where('uid',$data['admin_id'])->find();
+ if($access){
+ //修改
+ if($access['group_id']!=$data['group_id']){
+ Db::name('auth_group_access')->where('uid',$data['admin_id'])->setField('group_id',$data['group_id']);
+ }
+ }else{
+ //增加
+ $access['uid']=$data['admin_id'];
+ $access['group_id']=$data['group_id'];
+ Db::name('auth_group_access')->insert($access);
+ }
+ return true;
+ }else{
+ return false;
+ }
+ }
+ /**
+ * 修改管理员
+ * @param array
+ * @return bool
+ */
+ public static function avatar_edit($data)
+ {
+ $admin=self::get($data['admin_id'])->toArray();
+ $admin['admin_email']=$data['admin_email'];
+ $admin['admin_tel']=$data['admin_tel'];
+ $admin['admin_realname']=$data['admin_realname'];
+ if($data['admin_pwd']){
+ $admin['admin_pwd_salt']=random(10);
+ $admin['admin_pwd']=encrypt_password($data['admin_pwd'],$admin['admin_pwd_salt']);
+ $admin['admin_changepwd']=time();
+ }
+ $rst=self::where('admin_id',$data['admin_id'])->update($admin);
+ if($rst!==false){
+ return true;
+ }else{
+ return false;
+ }
+ }
+}
diff --git a/app/admin/model/Asklog.php b/app/admin/model/Asklog.php
new file mode 100644
index 0000000..623fd93
--- /dev/null
+++ b/app/admin/model/Asklog.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Asklog extends Model
+{
+
+}
diff --git a/app/admin/model/AuthRule.php b/app/admin/model/AuthRule.php
new file mode 100644
index 0000000..45791d7
--- /dev/null
+++ b/app/admin/model/AuthRule.php
@@ -0,0 +1,270 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+use app\admin\controller\Auth;
+
+/**
+ * 后台菜单模型
+ * @package app\admin\model
+ */
+class AuthRule extends Model
+{
+ protected $not_check_id=[1];//不检测权限的管理员id
+ protected $not_check_url=['admin/Index/index','admin/Sys/clear','admin/Index/lang'];//不检测权限的url
+
+ /**
+ * 获取所有父节点id(含自身)
+ * @param int $id 节点id
+ * @return array
+ */
+ public function get_admin_parents($id =0)
+ {
+ $id=$id?:$this->get_url_id('',1);
+ if(empty($id)) return [];
+ $lists=self::order('level desc,sort')->column('pid','id');
+ $ids = [];
+ while (isset($lists[$id]) && $lists[$id] !=0){
+ $ids[]=$id;
+ $id=$lists[$id];
+ }
+ if(isset($lists[$id]) && $lists[$id]==0) $ids[]=$id;
+ return array_reverse($ids);
+ }
+ /**
+ * 获取当前节点及父节点下菜单(仅显示状态)
+ * @param int $id 节点id
+ * @return array|mixed
+ */
+ public function get_admin_parent_menus(&$id)
+ {
+ $id=$this->get_url_id('',1);
+ $pid=self::where('id',$id)->value('pid');
+ //取$pid下子菜单
+ $menus=self::where(array('status'=>1,'pid'=>$pid))->order('sort')->select();
+ return $menus;
+ }
+ /**
+ * 获取不需要验证的节点id
+ * @return array
+ */
+ public static function get_notcheck_ids()
+ {
+ $ids = self::where('notcheck', 1)->column('id');
+ return $ids;
+ }
+ /**
+ * 获取指定url的id(可能为显示状态或非显示状态)
+ * @param string $url 为空获取当前操作的id
+ * @param int $status 1表示取显示状态,为空或为0则不限制
+ * @return int -1表示不需要检测 0表示无后台菜单 其他表示当前url对应id
+ */
+ public function get_url_id($url='',$status=0)
+ {
+ $url=$url?:request()->module().'/'.request()->controller().'/'.request()->action();
+ if($url=='//'){
+ $routeInfo=request()->routeInfo();
+ //插件管理
+ if($routeInfo['route']=='\think\addons\Base@execute'){
+ $menu_id = self::where('name','admin/Addons/addons_list')->order('level desc,sort')->value('id');
+ return $menu_id?:0;
+ }
+ }
+ if(in_array($url,$this->not_check_url)) return -1;
+ if(in_array($url,['admin/Model/cmslist','admin/Model/cmsadd'])){
+ $id=get_query();
+ if(isset($id['id'])){
+ $id=$id['id'];
+ $url.='?id='.$id;
+ }
+ }
+ if(in_array(CONTROLLER_NAME,['Download','Lcwhcyb','Feedback','Culture','Link','Bsgg','Bsyw','Sczcxy','Nwwd','Bsjs','Zzjg','Zcfg','Gyzc','Hyzq','Zjtd','Lxwm','Lxwm','Video','Whsb','Whsbhd','Bsry','Bszc','Gpgl','Whjrfwzx','Zbzq','Zbxstgzx','Ssyyzx','Tjjg','Zcfwjg','Dsffwjg','Bjjg'])){
+ $query=get_query();
+ if(isset($query['cid'])){
+ $cid=$query['cid'];
+ $url.='?cid='.$cid;
+ }
+ }
+ //托管、合作机构选中菜单
+ if(in_array(CONTROLLER_NAME,['Trusteeship','Orgapply'])){
+ $query=get_query();
+ //托管、合作机构列表带有状态参数
+ if(isset($query['applystatus'])){
+ $applystatus=$query['applystatus'];
+ //审核页面,选中对应的状态的列表菜单
+ if(in_array($url,['tuoguan/Trusteeship/apply_check','org/Orgapply/apply_check'])){
+ $url.='?applystatus='.$applystatus;
+ $url = str_replace('apply_check','apply_list',$url);
+ }else{
+ $url.='?applystatus='.$applystatus;
+ }
+
+ }
+ }
+ // echo "".$url."
";
+ if(in_array(CONTROLLER_NAME,['Gpgl','Bigdata','News','Page','Agencys','Ask'])){
+ $kind=input('kind','');
+ $module=ACTION_NAME;
+ $module=strtolower($module);
+ if($kind!=''&&$module!="export"){
+ $url.=strpos($url,'?')?'&kind='.$kind:'?kind='.$kind;
+ }
+ }
+ if(in_array(CONTROLLER_NAME,['Capital','Sys','Cult4'])){
+ $kind=input('apply_type','');
+ if($kind){
+ $url.=strpos($url,'?')?'&apply_type='.$kind:'?apply_type='.$kind;
+ }
+ }
+ if(in_array(CONTROLLER_NAME,['Download'])){
+ $catid=input('catid','');
+ if($catid){
+ $url.='&catid='.$catid;
+ }
+ }
+ if(in_array(CONTROLLER_NAME,['News'])){
+ $catid=input('cid','');
+ $module=strtolower($module);
+ if($catid){
+ if(strpos($module,"apply")!=-1||$module=='export'){
+ $url.='?cid='.$catid;
+ }else if($catid){
+ $url.='&cid='.$catid;
+ }
+ }
+ }
+
+ $where['name']=[['eq',$url],['eq',htmlentities($url)],'or'];
+ if($status) $where['status']=$status;
+ $menu_id = self::where($where)->order('level desc,sort')->value('id');//4级或3级(如果4级,status是0,不显示)
+
+ if(isset($query['cid'])&&empty($menu_id)){
+ $url=str_replace('?cid='.$query['cid'],'', $url);
+ $where['name']=$url;
+ $menu_id = self::where($where)->order('level desc,sort')->value('id');//4级或3级(如果4级,status是0,不显示)
+ }
+ $menu_id=$menu_id?:0;
+ return $menu_id;
+ }
+ /**
+ * 权限检测
+ * @param int
+ * @return boolean
+ */
+ public function check_auth($id=0)
+ {
+ $id=$id?:$this->get_url_id();
+ if($id==-1) return true;
+ $uid=session('admin_auth.aid');
+ if(in_array($uid,$this->not_check_id)) return true;
+ $auth = new Auth();
+ //超管跳过
+ if(in_array(1,$auth->getGroupIds($uid))) return true;
+ $auth_ids_list=cache('auth_ids_list_'.$uid);
+
+ if(!$auth_ids_list){
+ $auth_ids_list=$auth->getAuthList($uid,1,'id');
+ cache('auth_ids_list_'.$uid,$auth_ids_list);
+ }
+ if(empty($auth_ids_list)) return false;
+ if(in_array($id,$auth_ids_list)){
+ return true;
+ }else{
+ return false;
+ }
+ }
+ /**
+ * 菜单检查是否有效
+ * @param int
+ * @return string 返回''表示无效,否则返回正确的name字符串
+ */
+ public static function check_name($name,$level=1)
+ {
+ $module='admin';
+ $arr=explode('/',$name);
+ $count=count($arr);
+ $rst='';
+ if($level==1){
+ if($count>1){
+ $module=strtolower($arr[0]);
+ $controller=ucfirst($arr[1]);
+ }else{
+ $controller=ucfirst($name);
+ }
+ if (has_controller($module,$controller)) {
+ $rst=$module.'/'.$controller;
+ }
+ }elseif($level==2){
+ $rst=$name;
+ }else{
+ if($count>2){
+ $module=strtolower($arr[0]);
+ $controller=ucfirst($arr[1]);
+ $action=$arr[2];
+ }elseif($count==2){
+ $controller=ucfirst($arr[0]);
+ $action=$arr[1];
+ }else{
+ return $rst;
+ }
+ if($action){
+ //判断$action是否含?
+ $arr=explode('?',$action);
+ $_action=(count($arr)==1)?$action:$arr[0];
+ if(has_action($module,$controller,$_action)==2){
+ $rst=$module.'/'.$controller.'/'.$action;
+ }
+ }
+ }
+ return $rst;
+ }
+ /**
+ * 获取权限菜单
+ * @return array
+ */
+ public function get_admin_menus()
+ {
+ $uid=session('admin_auth.aid');
+ $menus=cache('menus_admin_'.$uid);
+ if($menus) return $menus;
+ $where['status']=1;
+ if(!in_array($uid,$this->not_check_id)){
+ $auth_ids_list=cache('auth_ids_list_'.$uid);
+
+ if(empty($auth_ids_list)){
+ $auth = new Auth();
+ $auth_ids_list=$auth->getAuthList($uid,1,'id');
+ cache('auth_ids_list_'.$uid,$auth_ids_list);
+ }
+ if(empty($auth_ids_list)) return [];
+ $where['id']=array('in',$auth_ids_list);
+ }
+ $data = self::where($where)->order('sort')->select();
+ $tree=new \Tree();
+ $tree->init($data,['child'=>'_child','parentid'=>'pid']);
+ $menus=$tree->get_arraylist($data);
+ cache('menus_admin_'.$uid,$menus);
+ return $menus;
+ }
+ /**
+ * 获取权限菜单
+ * @return array
+ */
+ public static function get_ruels_tree()
+ {
+ $data=self::order('sort')->select();
+ $data=collection($data)->toArray();
+ $tree=new \Tree();
+ $tree->init($data,['child'=>'sub','parentid'=>'pid']);
+ $rst=$tree->get_arraylist($data);
+ return $rst;
+ }
+}
diff --git a/app/admin/model/Bigdata.php b/app/admin/model/Bigdata.php
new file mode 100644
index 0000000..338036e
--- /dev/null
+++ b/app/admin/model/Bigdata.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Bigdata extends Model
+{
+
+}
diff --git a/app/admin/model/Finance.php b/app/admin/model/Finance.php
new file mode 100644
index 0000000..699bb9a
--- /dev/null
+++ b/app/admin/model/Finance.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Finance extends Model
+{
+
+}
diff --git a/app/admin/model/MemberList.php b/app/admin/model/MemberList.php
new file mode 100644
index 0000000..abf950b
--- /dev/null
+++ b/app/admin/model/MemberList.php
@@ -0,0 +1,52 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 会员模型
+ * @package app\admin\model
+ */
+class MemberList extends Model
+{
+ public function news()
+ {
+ return $this->hasMany('News','news_auto');
+ }
+ /**
+ * 增加会员
+ * @return int 0或会员id
+ */
+ public static function add($username,$salt='',$pwd,$groupid=1,$nickname='',$email='',$tel='',$open=0,$status=0)
+ {
+ $salt=$salt?:random(10);
+ $sldata=array(
+ 'member_list_username'=>$username,
+ 'member_list_salt' => $salt,
+ 'member_list_pwd'=>encrypt_password($pwd,$salt),
+ 'member_list_groupid'=>$groupid,
+ 'member_list_nickname'=>$nickname,
+ 'member_list_email'=>$email,
+ 'member_list_tel'=>$tel,
+ 'member_list_open'=>$open,
+ 'last_login_ip'=>request()->ip(),
+ 'member_list_addtime'=>time(),
+ 'last_login_time'=>time(),
+ 'user_status'=>$status,
+ );
+ $member=self::create($sldata);
+ if($member){
+ return $member['member_list_id'];
+ }else{
+ return 0;
+ }
+ }
+}
diff --git a/app/admin/model/Menu.php b/app/admin/model/Menu.php
new file mode 100644
index 0000000..ab2a433
--- /dev/null
+++ b/app/admin/model/Menu.php
@@ -0,0 +1,24 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 前台菜单模型
+ * @package app\admin\model
+ */
+class Menu extends Model
+{
+ public function news()
+ {
+ return $this->hasMany('News','news_columnid')->bind('menu_name');
+ }
+}
diff --git a/app/admin/model/News.php b/app/admin/model/News.php
new file mode 100644
index 0000000..1098fa0
--- /dev/null
+++ b/app/admin/model/News.php
@@ -0,0 +1,29 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class News extends Model
+{
+ protected $insert = ['news_hits' => 200];
+ public function user()
+ {
+ return $this->belongsTo('MemberList','member_list_id');
+ }
+ public function menu()
+ {
+ return $this->belongsTo('Menu','id');
+ }
+}
diff --git a/app/admin/model/Options.php b/app/admin/model/Options.php
new file mode 100644
index 0000000..4c3dc70
--- /dev/null
+++ b/app/admin/model/Options.php
@@ -0,0 +1,224 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 配置模型
+ * @package app\admin\model
+ */
+class Options extends Model
+{
+ /*
+ * 前台模板文件数组
+ */
+ public static function tpls($lang='zh-cn')
+ {
+ $tpls=cache('tpls_'.$lang);
+ if(empty($tpls)){
+ $sys=self::get_options('site_options',$lang);
+ $arr=list_file(APP_PATH.'home/view/'.$sys['site_tpl'],'*.html');
+ $tpls=array();
+ foreach($arr as $v){
+ $tpls[]=basename($v['filename'],'.html');
+ }
+ cache('tpls_'.$lang,$tpls);
+ }
+ return $tpls;
+ }
+ /*
+ * 前台themes
+ */
+ public static function themes()
+ {
+ $themes=cache('themes');
+ if(empty($themes)){
+ $arr=list_file(APP_PATH.'home/view/');
+ foreach($arr as $v){
+ if($v['isDir'] && strtolower($v['filename']!='public')){
+ $themes[]=$v['filename'];
+ }
+ }
+ cache('themes',$themes);
+ }
+ return $themes;
+ }
+ /*
+ * 获取百度map
+ */
+ public static function map($lang='zh-cn')
+ {
+ $map=cache('site_options_map');
+ if(empty($map)){
+ $site_options = self::get_options('site_options',$lang);
+ $map['map_lat']=isset($site_options['map_lat'])?$site_options['map_lat']:'';
+ $map['map_lng']=isset($site_options['map_lng'])?$site_options['map_lng']:'';
+ if((empty($map['map_lat']) || empty($map['map_lng'])) && $site_options['site_co_name']){
+ $strUrl='http://api.map.baidu.com/place/v2/search?query='.$site_options['site_co_name'].'®ion=全国&city_limit=false&output=json&ak='.config('baidumap_ak');//自己去申请ak
+ $jsonStr = file_get_contents($strUrl);
+ $arr = json_decode($jsonStr,true);
+ if($arr['results'] && $arr['results'][0]['location']){
+ $map['map_lat']=$arr['results'][0]['location']['lat'];
+ $map['map_lng']=$arr['results'][0]['location']['lng'];
+ }
+ }
+ cache('site_options_map',$map);
+ }
+ return $map;
+ }
+ /*
+ * 获取系统基本设置
+ */
+ public static function get_options($type='site_options',$lang='zh-cn')
+ {
+ $options = cache($type.'_'.$lang);
+ if(empty($options)){
+ switch ($type){
+ case 'email_options':
+ $sys=array(
+ 'email_open'=>0,
+ 'email_rename'=>'',
+ 'email_name'=>'',
+ 'email_smtpname'=>'',
+ 'smtpsecure'=>'',
+ 'smtp_port'=>'',
+ 'email_emname'=>'',
+ 'email_pwd'=>'',
+ );
+ break;
+ case 'active_options':
+ $sys=array(
+ 'email_active'=>0,
+ 'email_title'=>'',
+ 'email_tpl'=>'',
+ );
+ break;
+ case 'agree_options':
+ case 'agree_options1':
+ case 'agree_options2':
+ case 'agree_options3':
+ case 'agree_options4':
+ case 'agree_options5':
+ case 'agree_options6':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'begincheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'dddcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'reviewcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'riskcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'notice_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'gjnotice_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'number_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgfee_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgcheckfk_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'feecheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ default:
+ $sys=array(
+ 'map_lat'=>'',
+ 'map_lng'=>'',
+ 'site_name'=>'',
+ 'site_host'=>'',
+ 'site_tpl'=>'',
+ 'site_tpl_m'=>'',
+ 'site_logo'=>'',
+ 'site_icp'=>'',
+ 'site_tongji'=>'',
+ 'site_copyright'=>'',
+ 'site_co_name'=>'',
+ 'site_address'=>'',
+ 'site_tel'=>'',
+ 'site_admin_email'=>'',
+ 'site_qq'=>'',
+ 'site_seo_title'=>'',
+ 'site_seo_keywords'=>'',
+ 'site_seo_description'=>'',
+ 'content_tpl'=>'',
+ );
+ }
+ $options=self::where(array('option_name'=>$type,'option_l'=>$lang))->find();
+ if($options)$options=$options->toArray();
+ if(empty($options)){
+ $options=self::where(array('option_name'=>$type,'option_l'=>'zh-cn'))->find();
+ if($options)$options=$options->toArray();
+ if($options){
+ $options['option_l']=$lang;
+ unset($options['option_id']);
+ }else{
+ $options=[
+ 'option_name'=>$type,
+ 'option_l'=>$lang,
+ 'option_value'=>'{}'
+ ];
+ }
+ self::create($options);
+ }
+
+ $options=json_decode($options['option_value'],true);
+ $options=array_merge($sys,$options);
+ cache($type.'_'.$lang,$options);
+ }
+ return $options;
+ }
+ /*
+ * 设置系统基本设置
+ */
+ public static function set_options($options=[],$type='site_options',$lang='zh-cn')
+ {
+ return self::where(['option_l'=>$lang,'option_name'=>$type])->setField('option_value',json_encode($options));
+ }
+}
diff --git a/app/admin/model/Options1218.php b/app/admin/model/Options1218.php
new file mode 100644
index 0000000..1cacf19
--- /dev/null
+++ b/app/admin/model/Options1218.php
@@ -0,0 +1,218 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 配置模型
+ * @package app\admin\model
+ */
+class Options extends Model
+{
+ /*
+ * 前台模板文件数组
+ */
+ public static function tpls($lang='zh-cn')
+ {
+ $tpls=cache('tpls_'.$lang);
+ if(empty($tpls)){
+ $sys=self::get_options('site_options',$lang);
+ $arr=list_file(APP_PATH.'home/view/'.$sys['site_tpl'],'*.html');
+ $tpls=array();
+ foreach($arr as $v){
+ $tpls[]=basename($v['filename'],'.html');
+ }
+ cache('tpls_'.$lang,$tpls);
+ }
+ return $tpls;
+ }
+ /*
+ * 前台themes
+ */
+ public static function themes()
+ {
+ $themes=cache('themes');
+ if(empty($themes)){
+ $arr=list_file(APP_PATH.'home/view/');
+ foreach($arr as $v){
+ if($v['isDir'] && strtolower($v['filename']!='public')){
+ $themes[]=$v['filename'];
+ }
+ }
+ cache('themes',$themes);
+ }
+ return $themes;
+ }
+ /*
+ * 获取百度map
+ */
+ public static function map($lang='zh-cn')
+ {
+ $map=cache('site_options_map');
+ if(empty($map)){
+ $site_options = self::get_options('site_options',$lang);
+ $map['map_lat']=isset($site_options['map_lat'])?$site_options['map_lat']:'';
+ $map['map_lng']=isset($site_options['map_lng'])?$site_options['map_lng']:'';
+ if((empty($map['map_lat']) || empty($map['map_lng'])) && $site_options['site_co_name']){
+ $strUrl='http://api.map.baidu.com/place/v2/search?query='.$site_options['site_co_name'].'®ion=全国&city_limit=false&output=json&ak='.config('baidumap_ak');//自己去申请ak
+ $jsonStr = file_get_contents($strUrl);
+ $arr = json_decode($jsonStr,true);
+ if($arr['results'] && $arr['results'][0]['location']){
+ $map['map_lat']=$arr['results'][0]['location']['lat'];
+ $map['map_lng']=$arr['results'][0]['location']['lng'];
+ }
+ }
+ cache('site_options_map',$map);
+ }
+ return $map;
+ }
+ /*
+ * 获取系统基本设置
+ */
+ public static function get_options($type='site_options',$lang='zh-cn')
+ {
+ $options = cache($type.'_'.$lang);
+ if(empty($options)){
+ switch ($type){
+ case 'email_options':
+ $sys=array(
+ 'email_open'=>0,
+ 'email_rename'=>'',
+ 'email_name'=>'',
+ 'email_smtpname'=>'',
+ 'smtpsecure'=>'',
+ 'smtp_port'=>'',
+ 'email_emname'=>'',
+ 'email_pwd'=>'',
+ );
+ break;
+ case 'active_options':
+ $sys=array(
+ 'email_active'=>0,
+ 'email_title'=>'',
+ 'email_tpl'=>'',
+ );
+ break;
+ case 'agree_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'begincheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'dddcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'reviewcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'riskcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'notice_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'number_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgfee_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgcheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'tgcheckfk_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ case 'feecheck_options':
+ $sys=array(
+ 'content_tpl'=>'',
+ );
+ break;
+ default:
+ $sys=array(
+ 'map_lat'=>'',
+ 'map_lng'=>'',
+ 'site_name'=>'',
+ 'site_host'=>'',
+ 'site_tpl'=>'',
+ 'site_tpl_m'=>'',
+ 'site_logo'=>'',
+ 'site_icp'=>'',
+ 'site_tongji'=>'',
+ 'site_copyright'=>'',
+ 'site_co_name'=>'',
+ 'site_address'=>'',
+ 'site_tel'=>'',
+ 'site_admin_email'=>'',
+ 'site_qq'=>'',
+ 'site_seo_title'=>'',
+ 'site_seo_keywords'=>'',
+ 'site_seo_description'=>'',
+ );
+ }
+ $options='';
+ $select=self::where(array('option_name'=>$type,'option_l'=>$lang))->find();
+ if($select){
+ $select=$select->toArray();
+ }
+ if(empty($options)){
+ $options='';
+ $select=self::where(array('option_name'=>$type,'option_l'=>'zh-cn'))->find();
+ if($select){
+ $select=$select->toArray();
+ }
+
+ if($options){
+ $options['option_l']=$lang;
+ unset($options['option_id']);
+ }else{
+ $options=[
+ 'option_name'=>$type,
+ 'option_l'=>$lang,
+ 'option_value'=>'{}'
+ ];
+ }
+ self::create($options);
+ }
+ $options=json_decode($options['option_value'],true);
+ $options=array_merge($sys,$options);
+ cache($type.'_'.$lang,$options);
+ }
+ return $options;
+ }
+ /*
+ * 设置系统基本设置
+ */
+ public static function set_options($options=[],$type='site_options',$lang='zh-cn')
+ {
+ return self::where(['option_l'=>$lang,'option_name'=>$type])->setField('option_value',json_encode($options));
+ }
+}
diff --git a/app/admin/model/Procategory.php b/app/admin/model/Procategory.php
new file mode 100644
index 0000000..4a3cfec
--- /dev/null
+++ b/app/admin/model/Procategory.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Procategory extends Model
+{
+
+}
diff --git a/app/admin/model/Product.php b/app/admin/model/Product.php
new file mode 100644
index 0000000..6df6511
--- /dev/null
+++ b/app/admin/model/Product.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Product extends Model
+{
+
+}
diff --git a/app/admin/model/Proquarter.php b/app/admin/model/Proquarter.php
new file mode 100644
index 0000000..d83632e
--- /dev/null
+++ b/app/admin/model/Proquarter.php
@@ -0,0 +1,21 @@
+
+// +----------------------------------------------------------------------
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * 文章模型
+ * @package app\admin\model
+ */
+class Proquarter extends Model
+{
+
+}