mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-04-06 03:58:04 +08:00
Update MediaService.php
This commit is contained in:
parent
6dc658d60f
commit
e5a3816acb
@ -35,18 +35,19 @@ class MediaService extends Service
|
|||||||
* @throws \think\db\exception\DbException
|
* @throws \think\db\exception\DbException
|
||||||
* @throws \think\db\exception\ModelNotFoundException
|
* @throws \think\db\exception\ModelNotFoundException
|
||||||
*/
|
*/
|
||||||
public function news($id, $map = []): array
|
public function news($id, array $map = []): array
|
||||||
{
|
{
|
||||||
// 文章主体数据
|
// 文章主体数据
|
||||||
$query = $this->app->db->name('WechatNews');
|
$where = ['id' => $id, 'is_deleted' => 0];
|
||||||
$data = $query->where(['id' => $id])->where($map)->find();
|
$data = $this->app->db->name('WechatNews')->where($where)->where($map)->find();
|
||||||
if (empty($data)) return [];
|
if (empty($data)) return [];
|
||||||
// 文章内容编号
|
// 文章内容编号
|
||||||
[$data['articles'], $articleIds] = [[], explode(',', $data['article_id'])];
|
$data['articles'] = [];
|
||||||
if (empty($data['article_id']) || empty($articleIds)) return $data;
|
$data['articleids'] = str2arr($data['article_id']);
|
||||||
|
if (empty($data['articleids'])) return $data;
|
||||||
// 文章内容集合
|
// 文章内容集合
|
||||||
$query = $this->app->db->name('WechatNewsArticle');
|
$query = $this->app->db->name('WechatNewsArticle');
|
||||||
$query->whereIn('id', $articleIds)->orderField('id', $articleIds);
|
$query->whereIn('id', $data['articleids'])->orderField('id', $data['articleids']);
|
||||||
$data['articles'] = $query->withoutField('create_by,create_at')->select()->toArray();
|
$data['articles'] = $query->withoutField('create_by,create_at')->select()->toArray();
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user