Link.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. class Link extends BaseMall
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize(); // TODO: Change the autogenerated stub
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/link.lang.php');
  18. }
  19. public function index()
  20. {
  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. }