示例#1
0
 public function SavePayment()
 {
     $this->table = "payment";
     $user = $this->data['keyvalue'];
     $payment_date = date("Y-m-d H:i:s");
     $data = array("iduser" => $user, "amount" => $this->data['reqdata']['amount'], "payment_date" => $payment_date, "description" => $this->data['reqdata']['desc'], "usertype" => 1, "type" => 1, "flag" => 1, "created_by" => USERID);
     if (!empty($this->data['reqdata']['amount'])) {
         $this->sql = "UPDATE `user` SET `balance`=`balance`+" . $this->data['reqdata']['amount'] . ",`recharge_balance`=`recharge_balance`+" . $this->data['reqdata']['amount'] . " WHERE `id`='" . $user . "'";
         parent::custom();
         if (LOGINTYPE != 0) {
             $this->sql = "UPDATE `user` SET `balance`=`balance`-" . $this->data['reqdata']['amount'] . " ,`recharge_balance`=`recharge_balance`-" . $this->data['reqdata']['amount'] . " WHERE `id`='" . USERID . "'";
             parent::custom();
         }
     }
     parent::Save($data);
     header("location:" . HTTP_HOST . "index.php?session=" . $this->data["session"] . "&module=" . encode("user") . "&action=" . encode("list"));
 }