| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace mall\controllers;
- use Yii;
- use common\components\util;
- use bizHd\hb\classes\HbClass;
- class HbController extends BaseController
- {
- //优惠券列表 ssh 2019.12.11
- public function actionList()
- {
- $get = Yii::$app->request->get();
- $where = [];
- $where['t.userId'] = $this->userId;
- if (isset($get['status'])) {
- if($get['status'] == 3){
- // 全部状态
- }elseif($get['status'] == 2){ // 已失效包含:1作废 与 过期(0未使用但endTime<当前时间) --- 所以当操作作废时,status改为-1,同时将endTime改为当前时间
- $where['t.endTime<'] = time();
- } else {
- $where['t.status'] = $get['status'];
- }
- }
-
- $list = HbClass::getHbList(['t.*', 's.merchantName', 's.shopName'], $where);
- util::success($list);
- }
- // 单个门店下所有可用红包
- public function actionAvailableHb()
- {
- $where = [];
- $where['customId'] = $this->customId;
- $where['status'] = 0;
- $where['endTime>'] = time();
- $list = HbClass::getAllByCondition($where, 'id DESC');
- util::success($list);
- }
- }
|