是否允许发布帖子权限
This commit is contained in:
@@ -3,9 +3,11 @@
|
||||
namespace app\common\service;
|
||||
|
||||
use app\common\model\PostMedia;
|
||||
use app\common\model\User;
|
||||
use app\common\validate\PostValidate;
|
||||
use app\common\traits\crud\CrudServiceTrait;
|
||||
use app\common\model\Post;
|
||||
use support\exception\BusinessException;
|
||||
use support\Redis;
|
||||
use support\Request;
|
||||
|
||||
@@ -92,6 +94,10 @@ class PostService
|
||||
public function beforeServiceStore($data, Request $request)
|
||||
{
|
||||
$data['user_id'] = $request->user->uid;;
|
||||
$user = User::where('id', $data['user_id'])->first();
|
||||
if($user->is_release == 0){
|
||||
throw new BusinessException('无发布权限');
|
||||
}
|
||||
$media = serialize($data['media']);
|
||||
redis::set('PostMedia_'.$data['user_id'],$media,30);
|
||||
unset($data['media']);
|
||||
|
||||
Reference in New Issue
Block a user