Exemple #1
0
 /**
  * 根据模板展示资源内容
  * 
  * @param \array $theme
  * 
  * @return \array
  */
 public static function showByTheme(array $theme)
 {
     $result = self::showByTpl($theme['id']);
     if ($result) {
         $locked = false;
     } else {
         $result = self::showByTpl($theme['alias_id']);
         $locked = true;
     }
     $response = array('resource' => \Comm\Arr::hashmap($result, 'resource_name'), 'locked' => $locked);
     return $response;
 }
Exemple #2
0
 /**
  * 批量获取属性
  * 
  * @param array $keys
  * @return \Comm\array
  */
 public static function showBatch(array $keys)
 {
     $data = self::db()->wAnd(['k' => $keys])->fetchAll();
     $result = \Comm\Arr::hashmap($data, 'k', 'v');
     return $result;
 }
Exemple #3
0
 /**
  * 文章列表追加分类信息
  * 
  * @param array $articles
  * 
  * @return array
  */
 public static function appendCategory(array $articles)
 {
     $categorys = Category::showUserAll();
     $categorys = \Comm\Arr::hashmap($categorys, 'id');
     foreach ($articles as $key => $article) {
         if (isset($categorys[$article['category_id']])) {
             $articles[$key]['category'] = $categorys[$article['category_id']];
         } else {
             $articles[$key]['category'] = array();
         }
     }
     return $articles;
 }