本文整理汇总了PHP中Notify::alert方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::alert方法的具体用法?PHP Notify::alert怎么用?PHP Notify::alert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::alert方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
function notify()
{
$order_id = $_GET['order_id'];
$type = strtolower($_GET['type']);
$type_arr = array('cancel', 'alert');
if (!in_array($type, $type_arr)) {
echo 'no_type';
exit;
}
$order_model = M('Order');
// 查找订单
$order = $order_model->find($order_id);
if (empty($order)) {
echo 'no_order';
exit;
}
if ($order['status'] > 1) {
echo 'type_error';
exit;
}
// 更改订单状态
if ($type == 'cancel') {
$order_model->setStatus($order['store_id'], $order['order_id'], 5);
echo 'ok';
exit;
}
if ($type == 'alert') {
import('source.class.Notify');
Notify::alert('尊敬的会员' . $order['address_user'] . '您好,您的订单号:' . $order_id . '未付款,请及时付款');
}
}
示例2: postWithdraw
public function postWithdraw()
{
$amount = Bitcoin::toSatoshi(floatval(Input::get('amount', 0)));
$address = Input::get('address');
if ($amount < Config::get('bitcoin.minimum_withdrawal')) {
return Redirect::back()->withInput()->with('error', 'Amount is less than the minimum.');
} else {
if ($amount > Auth::user()->getBalance()) {
return Redirect::back()->withInput()->with('error', 'You do not have the required funds.');
}
}
if (!Bitcoin::checkAddress($address)) {
return Redirect::back()->withInput()->with('error', 'Invalid bitcoin address.');
}
$api_url = 'https://blockchain.info/merchant/' . urlencode(Config::get('bitcoin.guid')) . '/payment';
$api_url .= '?password=' . urlencode(Config::get('bitcoin.password'));
$api_url .= '&to=' . urlencode($address);
$withdraw_amount = $amount - Config::get('bitcoin.withdrawal_fee');
$api_url .= '&amount=' . urlencode($withdraw_amount);
$response = file_get_contents($api_url);
$response = json_decode($response);
if (!property_exists($response, 'tx_hash')) {
return Redirect::back()->withInput()->with('error', $response->error);
} else {
Auth::user()->subtractFromBalance($amount);
}
$withdraw = new Withdraw();
$withdraw->user_id = Auth::user()->id;
$withdraw->amount = $amount;
$withdraw->btc_address = $address;
$withdraw->transaction_hash = $response->tx_hash;
if (property_exists($response, 'notice')) {
$withdraw->notice = $response->notice;
}
if (property_exists($response, 'message')) {
$withdraw->message = $response->message;
}
if (!$withdraw->save()) {
Notify::alert('Withdraw couldn\'t be saved!');
}
return Redirect::back()->with('success', 'Withdraw processed.');
}
示例3: handleWinner
public function handleWinner()
{
if ($this->winner_paid) {
return false;
}
$btc_price = Bitcoin::toUSD();
if ($this->type == 'above') {
$winner = $btc_price > $this->target_price ? $this->created_by_user_id : $this->accepted_by_user_id;
} else {
if ($this->type == 'under') {
$winner = $btc_price < $this->target_price ? $this->created_by_user_id : $this->accepted_by_user_id;
}
}
$this->winner_user_id = $winner;
$winnings = (1 - Config::get('bitcoin.winnings_fee')) * (intval($this->bet_amount) + intval($this->cross_bet_amount));
$winner_model = User::where('id', $winner)->first();
$winner_model->addToBalance($winnings);
Notify::alert("User {$winner} paid " . Bitcoin::toBTC($winnings) . " BTC");
$this->winner_paid = 1;
$this->save();
return true;
}
示例4: getCallback
public function getCallback()
{
if (Input::get('secret') != Config::get('bitcoin.secret')) {
Notify::alert('Invalid secret provided: ' . Input::get('secret', ''));
App::abort(404);
}
$destination_address = Input::get('destination_address');
if ($destination_address != Config::get('bitcoin.wallet_address')) {
Notify::alert('Invalid destination address: ' . $destination_address);
App::abort(404);
}
$input_address = Input::get('input_address');
$user = User::where('deposit_btc_address', $input_address)->first();
if (count($user) != 1) {
Notify::alert('Invalid user deposit address: ' . $input_address);
App::abort(404);
}
$transaction_hash = Input::get('transaction_hash');
$input_transaction_hash = Input::get('input_transaction_hash');
$value_in_satoshi = Input::get('value');
$deposit = new ExternalDeposit();
$deposit->amount = $value_in_satoshi;
$deposit->user_id = $user->id;
$deposit->confirmations = Input::get('confirmations');
$deposit->input_address = $input_address;
$deposit->destination_address = $destination_address;
$deposit->transaction_hash = $transaction_hash;
$deposit->input_transaction_hash = $input_transaction_hash;
if ($deposit->save()) {
if (intval(Input::get('confirmations')) >= Config::get('bitcoin.num_confirmations_deposit')) {
Notify::alert('Money deposited!');
$user->addToBalance($value_in_satoshi);
echo "*ok*";
}
} else {
Notify::alert('Unable to make external deposit!');
App::abort(404);
}
}
示例5: import
import('source.class.Notify');
// md5进行验证
$data = array();
$data['order_id'] = $order_id;
$data['type'] = $type;
$data['appid'] = $appid;
$md5 = Notify::encrypt_key($data, $notify_key);
if ($md5 != $auth_key) {
echo 'auth error';
exit;
}
$order_model = M('Order');
// 查找订单
$order = $order_model->find($order_id);
if (empty($order)) {
echo 'no_order';
exit;
}
if ($order['status'] > 1) {
echo 'type_error';
exit;
}
// 更改订单状态
if ($type == 'cancel') {
$order_model->cancelOrder($order, 0);
echo 'ok';
exit;
}
if ($type == 'alert') {
Notify::alert('尊敬的会员' . $order['address_user'] . '您好,您的订单号:' . $order_id . '未付款,请及时付款');
}