<?php

namespace app\home\controller;

use think\Lang;

class Link extends BaseMall {

    public function _initialize() {
        parent::_initialize(); // TODO: Change the autogenerated stub
        Lang::load(APP_PATH . 'home/lang/'.config('default_lang').'/article.lang.php');
    }

    public function index() {
        //把加密的用户id写入cookie
        $uid = input('uid');
        cookie('uid', $uid);

        //友情连接内容
        $link_model = model('link');
        $link_list = $link_model->getLinkList();
        /**
         * 整理图片链接
         */
        if (is_array($link_list)) {
            foreach ($link_list as $k => $v) {
                if (!empty($v['link_pic'])) {
                    $link_list[$k]['link_pic'] = UPLOAD_SITE_URL . '/' . DIR_ADMIN . '/link' . '/' . $v['link_pic'];
                }
            }
        }
        $this->assign('link_list', $link_list);
        $this->assign('link', 'index');
        return $this->fetch($this->template_dir . 'link');
    }
}

?>
