Pointshop.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. namespace app\api\controller;
  3. use think\facade\Lang;
  4. /**
  5. * ============================================================================
  6. *
  7. * ============================================================================
  8. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  9. * 网站地址: https://www.valimart.net/
  10. * ----------------------------------------------------------------------------
  11. *
  12. * ============================================================================
  13. * 控制器
  14. */
  15. class Pointshop extends MobileMall
  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').'/pointprod.lang.php');
  21. Lang::load(base_path().'home/lang/'.config('lang.default_lang').'/voucher.lang.php');
  22. //判断系统是否开启积分兑换功能
  23. if (config('ds_config.points_isuse') != 1 || config('ds_config.pointprod_isuse') != 1) {
  24. ds_json_encode(10001, lang('pointshop_unavailable'));
  25. }
  26. }
  27. public function index(){
  28. $result=array();
  29. //开启代金券功能后查询推荐的热门代金券列表
  30. if (config('ds_config.voucher_allow') == 1){
  31. $recommend_voucher = model('voucher')->getRecommendTemplate(6);
  32. $result['recommend_voucher']=$recommend_voucher;
  33. //平台代金券
  34. $where = array();
  35. $where[]=array('mallvouchertemplate_startdate','<',TIMESTAMP);
  36. $where[]=array('mallvouchertemplate_enddate','>',TIMESTAMP);
  37. $mallvoucherlist = model('mallvouchertemplate')->getMallvouchertemplateList($where, 6);
  38. $result['mall_voucher']=$mallvoucherlist;
  39. }
  40. //开启积分兑换功能后查询推荐的热门兑换商品列表
  41. if (config('ds_config.pointprod_isuse') == 1){
  42. //热门积分兑换商品
  43. $recommend_pointsprod = model('pointprod')->getRecommendPointProd(10);
  44. $result['recommend_pointsprod']=$recommend_pointsprod;
  45. }
  46. ds_json_encode(10000, '', $result);
  47. }
  48. }