Pointgrade.php 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 Pointgrade extends BasePointShop
  16. {
  17. public function initialize()
  18. {
  19. parent::initialize(); // TODO: Change the autogenerated stub
  20. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/pointgrade.lang.php');
  21. if (session('is_login') != '1') {
  22. $this->error(lang('no_login'), (string)url('Login/login'));
  23. }
  24. }
  25. public function index()
  26. {
  27. //查询会员及其附属信息
  28. $result = parent::pointshopMInfo(true);
  29. $member_info = $result['member_info'];
  30. unset($result);
  31. $member_model = model('member');
  32. //获得会员升级进度
  33. $membergrade_arr = $member_model->getMemberGradeArr(true, $member_info['member_exppoints'], $member_info['level']);
  34. View::assign('membergrade_arr', $membergrade_arr);
  35. //处理经验值计算说明文字
  36. $exppoints_rule = config("ds_config.exppoints_rule") ? unserialize(config("ds_config.exppoints_rule")) : array();
  37. $ruleexplain_arr = array();
  38. $exppoints_rule['exp_orderrate'] = floatval($exppoints_rule['exp_orderrate']);
  39. if ($exppoints_rule['exp_orderrate'] > 0) {
  40. $ruleexplain_arr['exp_order'] = lang('empirical_value_calculated_valid_shopping') . "{$exppoints_rule['exp_orderrate']}" . lang('ds_yuan') . "=1" . lang('experience');
  41. $exp_ordermax = intval($exppoints_rule['exp_ordermax']);
  42. if ($exp_ordermax > 0) {
  43. $ruleexplain_arr['exp_order'] .= lang('single_order_most_available') . "{$exppoints_rule['exp_ordermax']}" . lang('experience');
  44. }
  45. }
  46. $exppoints_rule['exp_login'] = intval($exppoints_rule['exp_login']);
  47. if ($exppoints_rule['exp_login'] > 0) {
  48. $ruleexplain_arr['exp_login'] = lang('members_first_logged_each_day') . "{$exppoints_rule['exp_login']}" . lang('experience');
  49. }
  50. $exppoints_rule['exp_comments'] = intval($exppoints_rule['exp_comments']);
  51. if ($exppoints_rule['exp_comments'] > 0) {
  52. $ruleexplain_arr['exp_comments'] = lang('review_order_will_obtained') . "{$exppoints_rule['exp_comments']}" . lang('experience');
  53. }
  54. View::assign('ruleexplain_arr', $ruleexplain_arr);
  55. //分类导航
  56. $nav_link = array(
  57. 0 => array('title' => lang('homepage'), 'link' => HOME_SITE_URL),
  58. 1 => array('title' => lang('ds_pointprod'), 'link' => (string)url('Pointshop/index')),
  59. 2 => array('title' => lang('my_growth'))
  60. );
  61. View::assign('nav_link_list', $nav_link);
  62. return View::fetch($this->template_dir . 'pointgrade');
  63. }
  64. /**
  65. * 经验明细列表
  66. */
  67. public function exppointlog()
  68. {
  69. //查询会员及其附属信息
  70. $result = parent::pointshopMInfo();
  71. //查询积分日志列表
  72. $exppoints_model = model('exppoints');
  73. $condition = array();
  74. $condition[] = array('explog_memberid', '=', session('member_id'));
  75. $list_log = $exppoints_model->getExppointslogList($condition, '*', 20, 'explog_id desc');
  76. //信息输出
  77. View::assign('stage_arr', $exppoints_model->getExppointsStage());
  78. View::assign('show_page', $exppoints_model->page_info->render());
  79. View::assign('list_log', $list_log);
  80. //分类导航
  81. $nav_link = array(
  82. 0 => array('title' => lang('homepage'), 'link' => HOME_SITE_URL),
  83. 1 => array('title' => lang('ds_pointprod'), 'link' => (string)url('Pointshop/index')),
  84. 2 => array('title' => lang('experience_details'))
  85. );
  86. View::assign('nav_link_list', $nav_link);
  87. return View::fetch($this->template_dir . 'point_exppointslog');
  88. }
  89. }