<?php
// +----------------------------------------------------------------------
// | HulaCWMS 呼啦企业网站管理系统
// +----------------------------------------------------------------------
// | Copyright (c) 2021 https://www.kaifashu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 开发树
// +----------------------------------------------------------------------

namespace app\index\controller;
use app\common\model\MessageForm as MessageFormModel;
use app\common\validate\MessageForm as MessageFormValidate;


class Messageform extends Base
{
    /**
     * 新增留言
     */
    public function addMessageform(){
        if($this->request->isGet()){
            return $this -> fetch();
        }
        $model=new MessageFormModel();
        $postData=$this->request->param();
        //验证器
        $messageFormValidate=new MessageFormValidate();
        if (!$messageFormValidate->check($postData)) {
            $this->error($messageFormValidate->getError());
        }
        $re=$model->add($postData);
        if($re){
            $this->success('success！','index');
        }
        else{
            $this->error($model->getError());
        }
    }

}
