123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\api\controller;
- use think\facade\Lang;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 控制器
- */
- class Pointshop extends MobileMall
- {
- public function initialize()
- {
- parent::initialize(); // TODO: Change the autogenerated stub
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/pointprod.lang.php');
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/voucher.lang.php');
- //判断系统是否开启积分兑换功能
- if (config('ds_config.points_isuse') != 1 || config('ds_config.pointprod_isuse') != 1) {
- ds_json_encode(10001, lang('pointshop_unavailable'));
- }
- }
- public function index()
- {
- $result = array();
- //开启代金券功能后查询推荐的热门代金券列表
- if (config('ds_config.voucher_allow') == 1) {
- $recommend_voucher = model('voucher')->getRecommendTemplate(6);
- $result['recommend_voucher'] = $recommend_voucher;
- //平台代金券
- $where = array();
- $where[] = array('mallvouchertemplate_startdate', '<', TIMESTAMP);
- $where[] = array('mallvouchertemplate_enddate', '>', TIMESTAMP);
- $mallvoucherlist = model('mallvouchertemplate')->getMallvouchertemplateList($where, 6);
- $result['mall_voucher'] = $mallvoucherlist;
- }
- //开启积分兑换功能后查询推荐的热门兑换商品列表
- if (config('ds_config.pointprod_isuse') == 1) {
- //热门积分兑换商品
- $recommend_pointsprod = model('pointprod')->getRecommendPointProd(10);
- $result['recommend_pointsprod'] = $recommend_pointsprod;
- }
- ds_json_encode(10000, '', $result);
- }
- }
|