用户编辑,帖子创建优化
This commit is contained in:
@@ -51,7 +51,7 @@ class PostService
|
||||
if (isset($p['category_id']) && $p['category_id']) {
|
||||
$config['where']['category_id'] = $p['category_id'];
|
||||
}
|
||||
if (isset($p['self']) && $p['self']) {
|
||||
if (isset($p['scene']) && $p['scene']=='self') {
|
||||
$config['where']['user_id'] = $request->user->uid;
|
||||
}
|
||||
$config['where']['status'] = 1;
|
||||
@@ -95,11 +95,14 @@ class PostService
|
||||
{
|
||||
$media = redis::get('PostMedia_'.$res['user_id']);
|
||||
$media = unserialize($media);
|
||||
if(!is_array($media)){
|
||||
$media = explode(',',$media);
|
||||
}
|
||||
foreach ($media as $v) {
|
||||
PostMedia::create([
|
||||
'post_id' => $res->id,
|
||||
'media_type' => $this->getMediaTypeByUrl($v['url']),
|
||||
'url' => $v['url'],
|
||||
'media_type' => $this->getMediaTypeByUrl($v),
|
||||
'url' => $v,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user