BusinessmanController.php 6.2 KB
<?php
/**
 * 展商服务
 * Author : xiaojie
 * DateTime: 2018/12/06 11:21
 */
namespace app\portal\controller;

use app\portal\model\PageModel;
use app\portal\model\PortalCategoryModel;
use app\portal\model\ShowModel;
use app\portal\model\StandModel;
use cmf\controller\HomeBaseController;
use think\Session;

class BusinessmanController extends HomeBaseController
{
    /**
     * 展商名录
     * portal/businessman/directories
     */
    public function directories()
    {
        $keyword = $this->request->param('keyword','');
        $showModel = new ShowModel();
        $list = $showModel->getList(24,$keyword,16);
        $page = $this->getPageStyle($list);
        //所在位置
        $location = [
            [
                'location' => '展商服务',
                'url' => 'javascript:;'
            ],
            [
                'location' => '展商名录',
                'url' => url('portal/businessman/directories')
            ]
        ];
        $this->assign('list',$list);
        $this->assign('location',$location);
        $this->assign('page',$page);
        $this->assign('keyword',empty($keyword)?'':$keyword);
        return $this->fetch();
    }

    /**
     * 参展手册(参展流程)
     * portal/businessman/manual
     */
    public function manual()
    {
        $cate_id = 25;
        $pageModel = new PageModel();
        $info = $pageModel->where('cate_id',$cate_id)->find();
        $this->setPageNum($info['id']);
        //所在位置
        $location = [
            [
                'location' => '展商服务',
                'url' => 'javascript:;'
            ],
            [
                'location' => '参展手册',
                'url' => url('portal/businessman/manual')
            ]
        ];
        $this->assign('info',$info);
        $this->assign('location',$location);
        return $this->fetch(':page');
    }

    /**
     * 展商心声
     * portal/businessman/aspirations
     */
    public function aspirations()
    {
        $cate_id = 27;
        $showModel = new ShowModel();
        $cateModel = new PortalCategoryModel();
        //分类信息
        $info = $cateModel->where('id',$cate_id)->find();
        //列表信息
        $list = $showModel->getList($cate_id,'',4,'sort desc');
        //分页样式
        $page = $this->getPageStyle($list);
        //增加阅读量
        $this->setCateNum($cate_id);
        //所在位置
        $location = [
            [
                'location' => '展商服务',
                'url' => 'javascript:;'
            ],
            [
                'location' => '展商心声',
                'url' => url('portal/businessman/aspirations')
            ]
        ];

        $this->assign('location',$location);
        $this->assign('list',$list);
        $this->assign('page',$page);
        $this->assign('info',$info);
        return $this->fetch();
    }

    /**
     * 特装搭建
     * portal/businessman/build
     */
    public function build()
    {
        $cate_id = 26;
        $pageModel = new PageModel();
        $info = $pageModel->where('cate_id',$cate_id)->find();
        $this->setPageNum($info['id']);
        //所在位置
        $location = [
            [
                'location' => '展商服务',
                'url' => 'javascript:;'
            ],
            [
                'location' => '特装搭建',
                'url' => url('portal/businessman/build')
            ]
        ];
        $this->assign('info',$info);
        $this->assign('location',$location);
        return $this->fetch(':page');
    }

    /**
     * 展位预定
     * portal/businessman/reserve
     */
    public function reserve()
    {
        return $this->fetch();
    }

    /**
     * 展位预定提交
     */
    public function ajax_reserve_add()
    {
        $user_mobile = Session::get('user_mobile');
        if(empty($user_mobile)){
            $this->apiResponse(-1,'请登录后在操作');
        }
        $param = $this->request->param();
        if(empty($param['enterprise_name']) or !isset($param['enterprise_name'])){
            $this->apiResponse(0,'企业名称不能为空');
        }
        if(empty($param['exhibits_name']) or !isset($param['exhibits_name'])){
            $this->apiResponse(0,'展品名称不能为空');
        }
        if(empty($param['application']) or !isset($param['application'])){
            $this->apiResponse(0,'应用行业不能为空');
        }
        if(empty($param['name']) or !isset($param['name'])){
            $this->apiResponse(0,'联系人不能为空');
        }
        if(empty($param['mobile']) or !isset($param['mobile'])){
            $this->apiResponse(0,'手机号不能为空');
        }
        if(empty($param['email']) or !isset($param['email'])){
            $this->apiResponse(0,'邮箱不能为空');
        }
//        if(empty($param['phone']) or !isset($param['phone'])){
//            $this->apiResponse(0,'座机不能为空');
//        }
        if(empty($param['company']) or !isset($param['company'])){
            $this->apiResponse(0,'公司不能为空');
        }
        if(empty($param['booth']) or !isset($param['booth'])){
            $this->apiResponse(0,'展位要求不能为空');
        }
        if(empty($param['area']) or !isset($param['area'])){
            $this->apiResponse(0,'展区要求不能为空');
        }

        if(!in_array(2,$param['booth'])){
            $param['booth_data'][1] = '';
        }else{
            if(empty($param['booth_data'][1])){
                $this->apiResponse(0,'请填写标准展位个数');
            }
        }
        if(!in_array(3,$param['booth'])){
            $param['booth_data'][2] = '';
        }else{
            if(empty($param['booth_data'][2])){
                $this->apiResponse(0,'请填写空地所占平米数');
            }
        }
        if(!in_array(8,$param['area'])){
            $param['area_data'] = '';
        }else{
            if(empty($param['area_data'])){
                $this->apiResponse(0,'请填写其他的具体内容');
            }
        }
        $standModel = new StandModel();
        $res = $standModel->save($param);
        if($res){
            $this->apiResponse(1,'提交成功');
        }
        $this->apiResponse(0,'请稍后重试');
    }

}