Inviterpro.php 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. *
  8. * ============================================================================
  9. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  10. * 网站地址: https://www.valimart.net/
  11. * ----------------------------------------------------------------------------
  12. *
  13. * ============================================================================
  14. * 控制器
  15. */
  16. class Inviterpro extends BaseMall {
  17. //每页显示商品数
  18. const PAGESIZE = 12;
  19. public function initialize() {
  20. parent::initialize();
  21. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/inviterpro.lang.php');
  22. }
  23. public function index() {
  24. $condition = array();
  25. $condition[]=array('gc_parent_id','=',0);
  26. $goods_class_array = model('goodsclass')->getGoodsclassList($condition);
  27. View::assign('goods_class_array', $goods_class_array);
  28. $goods_model = model('goods');
  29. if (!config('ds_config.inviter_open')) {
  30. $goods_list=array();
  31. } else {
  32. $condition = array();
  33. $condition[]=array('inviter_open','=',1);
  34. if (input('param.keyword')) {
  35. $condition[] = array('goods_name','like', '%' . input('param.keyword') . '%');
  36. }
  37. if(input('param.cate_id')){
  38. $condition[]=array('gc_id_1|gc_id_2|gc_id_3','=',intval(input('param.cate_id')));
  39. }
  40. $goods_list = $goods_model->getGoodsCommonList($condition, '*', self::PAGESIZE);
  41. foreach ($goods_list as $key => $goods) {
  42. $goods_info=$goods_model->getGoodsInfo(array('goods_commonid'=>$goods['goods_commonid']),'goods_id');
  43. $goods_list[$key]['goods_id'] = $goods_info['goods_id'];
  44. $goods_list[$key]['goods_image_url'] = goods_cthumb($goods['goods_image'], 240);
  45. $goods_list[$key]['inviter_amount'] = 0;
  46. if (config('ds_config.inviter_show')) {
  47. $inviter_amount = round($goods['inviter_ratio'] / 100 * $goods['goods_price'] * floatval(config('ds_config.inviter_ratio_1')) / 100, 2);
  48. if ($inviter_amount > 0) {
  49. $goods_list[$key]['inviter_amount'] = $inviter_amount;
  50. }
  51. }
  52. }
  53. }
  54. View::assign('goods_list', $goods_list);
  55. View::assign('show_page', is_object($goods_model->page_info)?$goods_model->page_info->render():"");
  56. // 当前位置导航
  57. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string)url('home/Index/index')),array('title'=>lang('inviterpro_inviter_market'))));
  58. //SEO 设置
  59. $seo = array(
  60. 'html_title'=>config('ds_config.site_name').'-'.lang('inviterpro_inviter_market'),
  61. 'seo_keywords'=>lang('inviterpro_inviter_market'),
  62. 'seo_description'=>lang('inviterpro_inviter_market'),
  63. );
  64. $this->_assign_seo($seo);
  65. return View::fetch($this->template_dir . 'index');
  66. }
  67. }
  68. ?>