Browse Source

朋友圈图片信息创建处理

master
wanghongjun 7 months ago
parent
commit
e53e93d9fe
  1. 6
      app/enterprise/model/Posts.php

6
app/enterprise/model/Posts.php

@ -11,11 +11,11 @@ class Posts extends BaseModel
// 创建朋友圈头像 // 创建朋友圈头像
public static function createAvatar($posts_id) public static function createAvatar($posts_id)
{ {
$PostsFile = PostsFile::where(['posts_id' => $posts_id])->field('file_id')->select(); $PostsFile = PostsFile::where(['posts_id' => $posts_id])->field('file_id')->select()->toArray();
if (count($PostsFile) > 1) { if (count($PostsFile) > 1) {
$imgFileIdArr = array_column($PostsFile, 'file_id');
$imgFileArr = []; $imgFileArr = [];
foreach ($imgFileIdArr as $file_id) { foreach ($PostsFile as $value) {
$file_id = $value['file_id'];
$src = File::where('file_id', '=', $file_id)->value('src'); $src = File::where('file_id', '=', $file_id)->value('src');
if ($src) { if ($src) {
$imgFileArr[] = $src; $imgFileArr[] = $src;

Loading…
Cancel
Save