public function cekDiskon($barangId, $tipeDiskonId) { return DiskonBarang::model()->find(['condition' => '(barang_id=:barangId or semua_barang=:semuaBarang) and status=:status and tipe_diskon_id=:tipeDiskon and (sampai >= now() or sampai is null)', 'order' => 'id desc', 'params' => ['barangId' => $barangId, 'semuaBarang' => DiskonBarang::SEMUA_BARANG, 'status' => DiskonBarang::STATUS_AKTIF, 'tipeDiskon' => $tipeDiskonId]]); }
public function actionAutoExpire() { $this->renderJSON(DiskonBarang::model()->autoExpire()); }