/** * получаем историю операция по карте * * @param $cardId * @param $limit */ public static function getOperationsHistory($cardId, $params = []) { if (empty($cardId)) { return []; } $db = Oracle::init(); $card = Model_Card::getCard($cardId); $user = Auth::instance()->get_user(); $where = ["card_id = " . Oracle::quote($cardId), "agent_id = " . $user['AGENT_ID']]; if (!empty($card['CONTRACT_ID'])) { $where[] = "contract_id = " . Oracle::quote($card['CONTRACT_ID']); } $sql = "\n\t\t\tselect *\n\t\t\tfrom " . Oracle::$prefix . "V_WEB_CRD_HISTORY\n\t\t\twhere " . implode(" and ", $where) . "\n\t\t\torder by HISTORY_DATE desc\n\t\t"; if (!empty($params['pagination'])) { return $db->pagination($sql, $params); } return $db->query($sql); }
/** * изымаем новую карту */ public function action_card_withdraw() { $params = $this->request->post('params'); $result = Model_Card::withdrawCard($params); if ($result === true) { $this->jsonResult(true); } $this->jsonResult(false); }