Link.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. *
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 控制器
  14. */
  15. class Link extends BaseMall {
  16. public function initialize() {
  17. parent::initialize(); // TODO: Change the autogenerated stub
  18. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/link.lang.php');
  19. }
  20. public function index() {
  21. //把加密的用户id写入cookie
  22. $uid = input('uid');
  23. cookie('uid', $uid);
  24. //友情连接内容
  25. $link_model = model('link');
  26. $link_list = $link_model->getLinkList();
  27. /**
  28. * 整理图片链接
  29. */
  30. if (is_array($link_list)) {
  31. foreach ($link_list as $k => $v) {
  32. if (!empty($v['link_pic'])) {
  33. $link_list[$k]['link_pic'] = ds_get_pic( DIR_ADMIN . '/link' , $v['link_pic']);
  34. }
  35. }
  36. }
  37. View::assign('link_list', $link_list);
  38. View::assign('link', 'index');
  39. return View::fetch($this->template_dir . 'link');
  40. }
  41. }