Inviterpro.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <?php
  2. namespace app\home\controller;
  3. use think\facade\View;
  4. use think\facade\Lang;
  5. /**
  6. * ============================================================================
  7. * DSMall多用户商城
  8. * ============================================================================
  9. * 版权所有 2014-2028 长沙德尚网络科技有限公司,并保留所有权利。
  10. * 网站地址: http://www.csdeshang.com
  11. * ----------------------------------------------------------------------------
  12. * 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
  13. * 不允许对程序代码以任何形式任何目的的再发布。
  14. * ============================================================================
  15. * 控制器
  16. */
  17. class Inviterpro extends BaseMall {
  18. //每页显示商品数
  19. const PAGESIZE = 12;
  20. public function initialize() {
  21. parent::initialize();
  22. Lang::load(base_path() . 'home/lang/'.config('lang.default_lang').'/inviterpro.lang.php');
  23. }
  24. public function index() {
  25. $condition = array();
  26. $condition[]=array('gc_parent_id','=',0);
  27. $goods_class_array = model('goodsclass')->getGoodsclassList($condition);
  28. View::assign('goods_class_array', $goods_class_array);
  29. $goods_model = model('goods');
  30. if (!config('ds_config.inviter_open')) {
  31. $goods_list=array();
  32. } else {
  33. $condition = array();
  34. $condition[]=array('inviter_open','=',1);
  35. if (input('param.keyword')) {
  36. $condition[] = array('goods_name','like', '%' . input('param.keyword') . '%');
  37. }
  38. if(input('param.cate_id')){
  39. $condition[]=array('gc_id_1|gc_id_2|gc_id_3','=',intval(input('param.cate_id')));
  40. }
  41. $goods_list = $goods_model->getGoodsCommonList($condition, '*', self::PAGESIZE);
  42. foreach ($goods_list as $key => $goods) {
  43. $goods_info=$goods_model->getGoodsInfo(array('goods_commonid'=>$goods['goods_commonid']),'goods_id');
  44. $goods_list[$key]['goods_id'] = $goods_info['goods_id'];
  45. $goods_list[$key]['goods_image_url'] = goods_cthumb($goods['goods_image'], 240);
  46. $goods_list[$key]['inviter_amount'] = 0;
  47. if (config('ds_config.inviter_show')) {
  48. $inviter_amount = round($goods['inviter_ratio'] / 100 * $goods['goods_price'] * floatval(config('ds_config.inviter_ratio_1')) / 100, 2);
  49. if ($inviter_amount > 0) {
  50. $goods_list[$key]['inviter_amount'] = $inviter_amount;
  51. }
  52. }
  53. }
  54. }
  55. View::assign('goods_list', $goods_list);
  56. View::assign('show_page', is_object($goods_model->page_info)?$goods_model->page_info->render():"");
  57. // 当前位置导航
  58. View::assign('nav_link_list', array(array('title' => lang('homepage'), 'link' => (string)url('home/Index/index')),array('title'=>lang('inviterpro_inviter_market'))));
  59. //SEO 设置
  60. $seo = array(
  61. 'html_title'=>config('ds_config.site_name').'-'.lang('inviterpro_inviter_market'),
  62. 'seo_keywords'=>lang('inviterpro_inviter_market'),
  63. 'seo_description'=>lang('inviterpro_inviter_market'),
  64. );
  65. $this->_assign_seo($seo);
  66. return View::fetch($this->template_dir . 'index');
  67. }
  68. }
  69. ?>