order('sort DESC,id DESC')->select(); $data = count($data) ? $data->toArray() : []; foreach ($data as &$item) { $item['live_gift_num'] = json_decode($item['live_gift_num']); } return $data; } /** * 单个礼物信息 */ public static function liveGiftOne($id) { $gift = self::where('is_show', 1)->where('id', $id)->find(); if ($gift) return $gift; else return []; } }