Exemplo n.º 1
0
 public function preform()
 {
     $DaoUser = new DaoUser();
     $result = $DaoUser->getUserInfoByUserId($this->params['safe']['uid']);
     $this->result['data'] = $result;
     //print_r($result);
 }
Exemplo n.º 2
0
 public static function formartBlogList($list)
 {
     if (empty($list)) {
         return false;
     }
     $blog_type = array(1 => "历史迷雾", 2 => '个人心路', 3 => '技术控', 4 => '学习心得');
     $DaoUser = new DaoUser();
     $DaoComment = new DaoComment();
     foreach ($list as $key => $value) {
         $list[$key]['create_time'] = date("Y-m-d H:i:s", $value['create_time']);
         $content = strip_tags($value['blog']);
         //经典的汉字截断方法
         if (mb_strlen($content, "UTF-8") > 200) {
             $content = mb_substr($content, 0, 200, 'UTF-8') . "...";
         }
         $list[$key]['blog_type_name'] = $blog_type[$value['blog_type']];
         $list[$key]['blog'] = $content;
         $user_info = $DaoUser->getUserInfoByUserId($value['user_id']);
         $list[$key]['user_info'] = $user_info[0];
         $total = $DaoComment->getTotalCommentByBlogId($value['id']);
         $list[$key]['comment_total'] = $total;
     }
     return $list;
 }