request->get(); $where = []; $where['t.userId'] = $this->userId; $status = $get['status'] ?? ''; if ($status != '') { $where['t.status'] = $get['status']; } $respond = HbClass::getHbList(['t.*', 's.merchantName', 's.shopName'], $where); if (!empty($respond['list'])) { foreach ($respond['list'] as &$v) { $v['customName'] = $v['custom']['name'] ?? ''; if ($v['status'] == 0 && $v['endTime'] < time()) { //发现红包已过期,需要作废,多有处作废操作,搜索关键词 cancellation_hb $id = $v['id']; HbClass::updateById($id, ['status' => -1]); } } } util::success($respond); } // 单个门店下所有可用红包 public function actionAvailableHb() { $where = []; $where['customId'] = $this->customId; $where['status'] = 0; $list = HbClass::getAllByCondition($where, 'id DESC'); //已经过期的就不再显示,并且作废,多有处作废操作,搜索关键词 cancellation_hb if (!empty($list)) { foreach ($list as $k => $v) { if ($v['status'] == 0 && $v['endTime'] < time()) { unset($list[$k]); $id = $v['id']; HbClass::updateById($id, ['status' => -1]); } } } util::success($list); } }