Memberpoints.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 Memberpoints extends BaseMember
  13. {
  14. public function initialize()
  15. {
  16. parent::initialize();
  17. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/memberpoints.lang.php');
  18. }
  19. /**
  20. * 积分日志列表
  21. */
  22. public function index()
  23. {
  24. $condition_arr = array();
  25. $condition_arr[] = array('pl_memberid', '=', session('member_id'));
  26. if (input('param.stage')) {
  27. $condition_arr[] = array('pl_stage', '=', input('param.stage'));
  28. }
  29. $saddtime = input('get.stime');
  30. $etime = input('get.etime');
  31. $if_start_time = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $saddtime);
  32. $if_end_time = preg_match('/^20\d{2}-\d{2}-\d{2}$/', $etime);
  33. $start_unixtime = $if_start_time ? strtotime($saddtime) : null;
  34. $end_unixtime = $if_end_time ? strtotime($etime) : null;
  35. if ($start_unixtime) {
  36. $condition_arr[] = array('pl_addtime', '>=', $start_unixtime);
  37. }
  38. if ($end_unixtime) {
  39. $end_unixtime = $end_unixtime + 86399;
  40. $condition_arr[] = array('pl_addtime', '<=', $end_unixtime);
  41. }
  42. $pl_desc = input('get.description');
  43. if (!empty($pl_desc)) {
  44. $condition_arr[] = array('pl_desc', 'like', '%' . $pl_desc . '%');
  45. }
  46. //分页
  47. //查询积分日志列表
  48. $points_model = model('points');
  49. $list_log = $points_model->getPointslogList($condition_arr, '10', '*', '');
  50. $member_points = model('member')->getMemberInfo(array('member_id' => session('member_id')), 'member_points');
  51. /* 设置买家当前菜单 */
  52. $this->setMemberCurMenu('member_points');
  53. /* 设置买家当前栏目 */
  54. $this->setMemberCurItem('points');
  55. View::assign('show_page', $points_model->page_info->render());
  56. View::assign('list_log', $list_log);
  57. View::assign('member_points', $member_points);
  58. return View::fetch($this->template_dir . 'index');
  59. }
  60. /**
  61. * 用户中心右边,小导航
  62. *
  63. * @param string $menu_type 导航类型
  64. * @param string $menu_key 当前导航的menu_key
  65. * @param array $array 附加菜单
  66. * @return
  67. */
  68. protected function getMemberItemList()
  69. {
  70. $menu_array = array(
  71. array(
  72. 'name' => 'points',
  73. 'text' => lang('ds_member_path_points'),
  74. 'url' => (string)url('Memberpoints/index')
  75. ),
  76. );
  77. return $menu_array;
  78. }
  79. }