65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace app\api\controller\home;
|
|
|
|
use app\common\model\home\LeaveWord as LeaveWordModel;
|
|
|
|
/**
|
|
* 网站留言
|
|
*/
|
|
class LeaveWord extends Base
|
|
{
|
|
protected $noNeedLogin = ['*'];
|
|
protected $noNeedRight = ['*'];
|
|
|
|
/**
|
|
* @var \app\common\model\home\LeaveWord
|
|
*/
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new LeaveWordModel;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* @ApiTitle( 发网站留言)
|
|
* @ApiSummary(发网站留言)
|
|
* @ApiMethod(POST)
|
|
* @ApiParams(name = "name", type = "string",required=false,description = "提交者姓名")
|
|
* @ApiParams(name = "mobile", type = "string",required=true,description = "联系电话")
|
|
* @ApiParams(name = "emil", type = "string",required=true,description = "邮箱地址")
|
|
* @ApiParams(name = "message", type = "string",required=false,description = "留言内容")
|
|
* @ApiReturn({
|
|
*
|
|
*})
|
|
*/
|
|
public function add()
|
|
{
|
|
$user_id = 0;
|
|
$user = $this->auth->getUser();//登录用户
|
|
if($user)$user_id = $user['id'];
|
|
$params=[];
|
|
$params["name"] = $this->request->post('name/s', ''); //页数
|
|
$params["mobile"] = $this->request->post('mobile/s', ''); //条数
|
|
$params["emil"] = $this->request->post('emil/s', ''); //搜索关键字
|
|
$params["message"] = $this->request->post('message/s', ''); //搜索关键字
|
|
|
|
|
|
|
|
try{
|
|
//当前申请状态
|
|
$res = $this->model->add($params,true);
|
|
// var_dump($this->model->getLastSql());
|
|
}catch (\Exception $e){
|
|
|
|
$this->error($e->getMessage());
|
|
}
|
|
$this->success('添加成功', $res);
|
|
}
|
|
|
|
|
|
} |