<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\CmsProperty\Util; use ModStart\Core\Dao\ModelUtil; use ModStart\Core\Util\ArrayUtil; use ModStart\Core\Util\HtmlUtil; class CmsPropertyUtil { public static function buildRecord($Lu5WV) { goto Gix1f; oVY8T: $qgfZ7['day'] = date('Y-m-d', strtotime($Lu5WV['created_at'])); goto xhyKA; Gix1f: $qgfZ7 = ArrayUtil::keepKeys($Lu5WV, array('id', 'cover', 'title', 'updated_at')); goto oVY8T; xhyKA: if (empty($Lu5WV['cover'])) { $k1_u1 = HtmlUtil::extractTextAndImages($Lu5WV['content']); if (!empty($k1_u1['images'])) { $qgfZ7['cover'] = $k1_u1['images'][0]; } } goto SFAZm; SFAZm: return $qgfZ7; goto EAxJy; EAxJy: } public static function buildRecords($vKRZ2) { foreach ($vKRZ2 as $l0ek5 => $Lu5WV) { $vKRZ2[$l0ek5] = self::buildRecord($Lu5WV); } return $vKRZ2; } public static function listLatest($BMu21 = 5) { $vKRZ2 = ModelUtil::model('cms_property')->orderBy('id', 'desc')->limit($BMu21)->get()->toArray(); return self::buildRecords($vKRZ2); } public static function get($WXJys) { return ModelUtil::get('cms_property', array('id' => $WXJys)); } public static function listCategories() { return ModelUtil::model('cms_property_category')->orderBy('sort', 'asc')->get()->toArray(); } }