AdminTeamController.php 2.5 KB
<?php
/**
 * 专业团队
 * Author : xiaojie
 * DateTime: 2018/12/03 11:31
 */
namespace app\portal\controller;

use app\portal\model\TeamModel;
use cmf\controller\AdminBaseController;

/**
 * Class AdminTeamController
 * @package app\portal\controller
 * @adminMenuRoot(
 *     'name'   =>'专业团队',
 *     'action' =>'default',
 *     'parent' =>'',
 *     'display'=> true,
 *     'order'  => 30,
 *     'icon'   =>'th',
 *     'remark' =>'专业团队'
 * )
 */

class AdminTeamController extends AdminBaseController
{

    /**
     * 专业团队
     * @adminMenu(
     *     'name'   => '专业团队',
     *     'parent' => 'portal/AdminTeam/default',
     *     'display'=> true,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '专业团队',
     *     'param'  => ''
     * )
     */
    public function index()
    {
        $teamModel = new TeamModel();
        $param = $this->request->param();
        $map = $this->search($param,'update_time','name|mobile');
        $list = $teamModel
            ->where($map)
            ->order('id DESC')
            ->paginate(30);

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

    /**
     * 编辑专业团队
     * @adminMenu(
     *     'name'   => '编辑专业团队',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> true,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '编辑专业团队',
     *     'param'  => ''
     * )
     */
    public function edit()
    {
        $teamModel = new TeamModel();
        $id = $this->request->param('id','','intval');
        $info = $teamModel->where('id',$id)->find();

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

    /**
     * 编辑专业团队提交
     * @adminMenu(
     *     'name'   => '编辑专业团队提交',
     *     'parent' => 'index',
     *     'display'=> false,
     *     'hasView'=> false,
     *     'order'  => 10000,
     *     'icon'   => '',
     *     'remark' => '编辑专业团队提交',
     *     'param'  => ''
     * )
     */
    public function editPost()
    {
        $teamModel = new TeamModel();
        $param = $this->request->param();
        $res = $teamModel->isUpdate(true)->save($param);
        if($res){
            $this->success('保存成功');
        }
        $this->error('请稍后重试');
    }


}