<?php

namespace app\api\controller\ContactUs;

use app\BaseController;
use app\common\model\ContactUs\LeaveMessage as ModelLeaveMessage;
use app\Request;
use think\Validate;
use think\exception\ValidateException;
use think\facade\Filesystem;
use app\common\arw\adjfut\src\Excel;
use app\common\arw\adjfut\src\UploadFile;
use think\facade\Db;
use app\common\exception\Tool;
use think\facade\Env;


class LeaveMessage extends BaseController
{
    /**
     * 添加用户留言
     */
    public function addLeaveMessage(Request $request): array
    {
        $params = $request->param();
        $this->validate($params, [
            'leave_message_content|留言内容' => 'require',
            'leave_message_user_name|留言人名称' => 'require',
            'leave_message_user_phone|留言人手机号码' => 'require',
            'captcha|验证码' => 'require|captcha',
        ]);
        $model = ModelLeaveMessage::create($params, [
            'leave_message_guid',
            'leave_message_create_user_guid',
            'leave_message_update_user_guid',
            'leave_message_content',
            'leave_message_status',
            'leave_message_user_name',
            'leave_message_user_phone'
        ]);
        return msg('提交成功!');
    }
}
