Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
class Transaction {
private $db;
private $request;
private $service;
private $id;
protected $providerDbTable = "zeiger";
protected $transactionDbTable = "transaction";
public function __construct($sql = NULL, $request) {
$db = Database::getInstance();
$this->db = $db;
$this->request = $request;
$this->chooseService();
$this->saveTransaction();
$this->execute();
}
private function getPriceForTransaction() {
$stmt = $this->db->prepare("
SELECT
// code entfernt
");
$stmt->bindValue(':user_id', $this->request->getUserId(), PDO::PARAM_INT);
$stmt->bindValue(':land_id', (int)substr($this->request->getAgs(),0,2), PDO::PARAM_INT);
$stmt->execute();
$userEndPrice = $stmt->fetch(PDO::FETCH_ASSOC);
return $userEndPrice['tarif'];
}
private function saveTransaction() {
try
{
$this->db->beginTransaction();
$stmt = $this->db->prepare("
INSERT INTO
//code entfernt
");
$stmt->bindParam(':request_id', $this->request->getId());
$stmt->bindParam(':created', date("c",time()));
$stmt->bindParam(':service', $this->service);
$stmt->bindParam(':price', $this->getPriceForTransaction());
$stmt->execute();
$this->id = $this->db->lastInsertId();
$this->db->commit();
}
catch(PDOException $e)
{
$this->db->rollback();
}
}
private function chooseService() {
$providerId = $this->request->getProviderId();
$stmt = $this->db->prepare("
SELECT
// code entfernt
");
$stmt->bindValue(':provider_id', (int)$providerId);
$stmt->execute();
$provider = $stmt->fetch(PDO::FETCH_ASSOC);
$this->service = $provider['name'];
}
private function execute() {
$serviceClass = $this->service."Service";
if($this->service!="") {
require_once(ZEM_ROOT.'/libs/services/'.$serviceClass.'.php');
$service=new $serviceClass($this->sql, $this->id, $this->request);
} else {
//@TODO NO SERVICE
$stmt = $this->db->prepare("
UPDATE
//code entfernt
");
$stmt->bindParam(':timeout', 2);
$stmt->bindParam(':zusatzinfo', 99);
$stmt->bindParam(':ergebnis_status', '04');
$stmt->bindValue(':id', $this->id);
$stmt->execute();
}
}
}
?>
<br />
<b>Notice</b>: Undefined property: Request::$getMassRequest in <b>/var/.....RService.php</b> on line <b>68</b><br />
<br />
<b>Notice</b>: Undefined property: Request::$getMassRequest in <b>/var/.....RService.php</b> on line <b>103</b><br />
<br />
<b>Fatal error</b>: Call to a member function Query() on a non-object in <b>/var/.......RService.php</b> on line <b>111</b><br />
<b>Warning</b>: Transaction::require_once(/var/.......Rservice.php) [<a href='function.Transaction-require-once'>function.Transaction-require-once</a>]: failed to open stream: No such file or directory in <b>/var/........./Transaction.php</b> on line <b>119</b><br />
<br />
<b>Fatal error</b>: Transaction::require_once() [<a href='function.require'>function.require</a>]: Failed opening required '/var/........Rservice.php' (include_path='.:/usr/share/php:/usr/share/php/PEAR:/var/www/wid/htdocs/zem') in <b>/var/.........Transaction.php</b> on line <b>119</b><br />
if($this->service!="") {
require_once(ZEM_ROOT.'/libs/services/'.$serviceClass.'.php'); // hier ist zeile 119
$service=new $serviceClass($this->sql, $this->id, $this->request);
} else { .......