本文整理汇总了PHP中smail::PaidSpecsAutopayed方法的典型用法代码示例。如果您正苦于以下问题:PHP smail::PaidSpecsAutopayed方法的具体用法?PHP smail::PaidSpecsAutopayed怎么用?PHP smail::PaidSpecsAutopayed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smail
的用法示例。
在下文中一共展示了smail::PaidSpecsAutopayed方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prolongSpecs
/**
* Продляет специализации по ID пользователя
*
* @param integer $uid ID пользователя
* @param boolean $is_autopaid Учитывать только отмеченные для автопродления
* @param string $period Период продления
* @param boolean $prolong_only
* @return string Сообщение об ошибке если есть
*/
function prolongSpecs($uid, $is_autopaid = false, $period = '1 mon', $prolong_only = false)
{
global $DB;
return;
// #0022795
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/account.php";
$account = new account();
$specs = self::getPaidSpecs($uid, true, $is_autopaid, $prolong_only);
if (!$specs) {
return 'Нет специализаций';
}
$transaction_id = $account->start_transaction($uid);
$billing_id = NULL;
$sum = 0;
foreach ($specs as $i => $spec) {
$DB->start();
$sql = "UPDATE spec_paid_choise SET paid_to = paid_to + '{$period}'::interval\n WHERE id = {$spec['id']} AND user_id = {$uid} RETURNING paid_to, (paid_to - '{$period}'::interval) as paid_from";
if ($res = $DB->query($sql)) {
$paid_to = pg_fetch_result($res, 0, 0);
$paid_from = pg_fetch_result($res, 0, 1);
$descr = 'Продление "' . $spec['name'] . '" до ' . date('d.m.Y', strtotime($paid_to));
if ($error = $account->Buy($bill_id, $transaction_id, self::OP_PAID_SPEC, $uid, $descr, $descr, 1, 0)) {
$DB->rollback();
break;
}
if ($DB->commit()) {
$billing_id = $bill_id;
$sum++;
$sql = "INSERT INTO spec_paid_acc_operations (billing_id, paid_from, paid_to)\n VALUES ({$bill_id}, '{$paid_from}'::timestamp, '{$paid_to}'::timestamp)";
$rs = $DB->query($sql);
}
}
}
if ($billing_id) {
$account->commit_transaction($transaction_id, $uid, $billing_id);
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/smail.php";
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/op_codes.php";
$mail = new smail();
$ops = new op_codes();
$price = $ops->getCodes(self::OP_PAID_SPEC);
if ($price) {
$price = $price[self::OP_PAID_SPEC];
$mail->PaidSpecsAutopayed($uid, $sum * $price['sum']);
}
}
return $error;
}