comment not null

This commit is contained in:
toogee 2020-04-14 19:08:31 +08:00
parent 1f3c44bbf3
commit 449fc474e7

View File

@ -152,7 +152,9 @@ class Article extends BaseController
//获取评论
$data = Request::only(['content','article_id','user_id']);
$sendId = $data['user_id'];
if(empty($data['content'])){
return json(['code'=>0, 'msg'=>'评论不能为空!']);
}
//用户留言存入数据库
if (Comment::create($data)) {
//站内信
@ -184,7 +186,6 @@ class Article extends BaseController
{
if(Request::isAjax()){
$data = Request::only(['cate_id','title','title_color','user_id','content','upzip','tags','captcha']);
halt($data);
$validate = new \app\common\validate\Article; //调用验证器
$result = $validate->scene('Artadd')->check($data); //进行数据验证
if(true !==$result){