case.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. if (!defined('ES_PATH')) {
  3. exit('Access Denied');
  4. }
  5. class CaseController extends Controller
  6. {
  7. public function index()
  8. {
  9. global $_W;
  10. global $_GPC;
  11. $uniacid = intval($_GPC['__uniacid']);
  12. $pindex = max(1, intval($_GPC['page']));
  13. $psize = 12;
  14. $condition = ' and a.status = 1 ';
  15. $params = array();
  16. if (!empty($_GPC['cate'])) {
  17. $cateid = intval($_GPC['cate']);
  18. $condition .= ' and a.cate = :cate';
  19. $params[':cate'] = $cateid;
  20. }
  21. $articles = pdo_fetchall('SELECT a.* ,c.id as cid,c.name FROM ' . tablename('ewei_shop_system_case') . ' AS a
  22. LEFT JOIN ' . tablename('ewei_shop_system_casecategory') . (' AS c ON a.cate = c.id and c.status = 1
  23. WHERE 1 ' . $condition . ' ORDER BY a.displayorder DESC LIMIT ') . ($pindex - 1) * $psize . ',' . $psize, $params);
  24. $total = pdo_fetchcolumn('SELECT count(1) FROM ' . tablename('ewei_shop_system_case') . ' WHERE status = 1 ', $params);
  25. $category = pdo_fetchall('select id,name from ' . tablename('ewei_shop_system_casecategory') . ' where status = 1 order by displayorder asc ');
  26. $pager = $this->pagination($total, $pindex, $psize);
  27. $casebanner = pdo_fetch('select casebanner,background from ' . tablename('ewei_shop_system_setting') . ' where uniacid = :uniacid ', array(':uniacid' => $uniacid));
  28. if (empty($casebanner)) {
  29. $casebanners = pdo_fetchall('select casebanner,background from ' . tablename('ewei_shop_system_setting') . ' where 1 ');
  30. foreach ($casebanners as $value) {
  31. if (!empty($value['casebanner'])) {
  32. $casebanner['casebanner'] = $value['casebanner'];
  33. }
  34. }
  35. }
  36. $basicset = $this->basicset();
  37. $title = '案例展示';
  38. include $this->template('case/index');
  39. }
  40. public function detail()
  41. {
  42. global $_W;
  43. global $_GPC;
  44. $id = intval($_GPC['id']);
  45. $article = pdo_fetch('SELECT * FROM ' . tablename('ewei_shop_system_case') . ' AS a
  46. LEFT JOIN ' . tablename('ewei_shop_system_casecategory') . ' AS c ON a.cate = c.id
  47. WHERE a.id = ' . $id);
  48. $basicset = $this->basicset();
  49. $title = $article['title'];
  50. include $this->template('news/detail');
  51. }
  52. }
  53. ?>