You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
976 lines
36 KiB
976 lines
36 KiB
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: Administrator
|
|
* Date: 2018/3/28
|
|
* Time: 13:39
|
|
*/
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use think\Db;
|
|
class Lcmanager extends Base
|
|
{
|
|
/**
|
|
* 楼层公馆列表
|
|
*/
|
|
public function mansion_list()
|
|
{
|
|
$mansion_list=Db::name('lc_gg')->order('p_sort,p_time desc')->paginate(config('paginate.list_rows'),false,['query'=>get_query()]);
|
|
$show = $mansion_list->render();
|
|
$show=preg_replace("(<a[^>]*page[=|/](\d+).+?>(.+?)<\/a>)","<a href='javascript:ajax_page($1);'>$2</a>",$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("(<a[^>]*page[=|/](\d+).+?>(.+?)<\/a>)","<a href='javascript:ajax_page($1);'>$2</a>",$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("(<a[^>]*page[=|/](\d+).+?>(.+?)<\/a>)","<a href='javascript:ajax_page($1);'>$2</a>",$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("(<a[^>]*page[=|/](\d+).+?>(.+?)<\/a>)","<a href='javascript:ajax_page($1);'>$2</a>",$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'));
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
}
|