本文整理汇总了PHP中smail::SbrReservedMoney方法的典型用法代码示例。如果您正苦于以下问题:PHP smail::SbrReservedMoney方法的具体用法?PHP smail::SbrReservedMoney怎么用?PHP smail::SbrReservedMoney使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类smail
的用法示例。
在下文中一共展示了smail::SbrReservedMoney方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkStatus
/**
* Проверяет обновления аккредитивов в статусах form|new.
* Если статус изменился на cover, отмечает резерв в соответствующей сделке
*
* @param type $cntIn
* @param type $cntOut
* @return boolean
*/
public static function checkStatus($ids = array(), &$cntIn = 0, &$cntOut = 0)
{
$db = new DB('master');
$sql = "SELECT lc.*, s.emp_id, s.frl_id FROM pskb_lc lc\n INNER JOIN sbr s ON s.id = lc.sbr_id AND s.is_draft = false\n WHERE lc_id IS NOT NULL AND state IN ('form', 'new')";
if ($ids) {
$sql .= " AND lc_id IN (?l) ";
$data = $db->rows($sql, $ids);
} else {
$data = $db->rows($sql);
}
if (!$data) {
return false;
}
$cntIn = count($data);
$list = array();
foreach ($data as $row) {
$list[] = intval($row['lc_id']);
}
$pskb = new pskb();
$resp = $pskb->_checks(json_encode(array('id' => $list)));
foreach ($data as $row) {
if (!$row['lc_id'] || !isset($resp[$row['lc_id']])) {
continue;
}
$lc = $resp[$row['lc_id']];
if ($lc->state == $row['state']) {
continue;
}
$up_data = array('state' => $lc->state, 'stateReason' => $lc->stateReason);
switch ($lc->state) {
case self::STATE_NEW:
// справедливо только для статуса form
if ($row['state'] != pskb::STATE_FORM) {
continue;
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/smail.php';
$smail = new smail();
$smail->SbrReservedMoney($row['sbr_id'], $row['emp_id']);
$up_data['created'] = 'NOW()';
break;
case self::STATE_COVER:
// покрыть можно только из статуса new
if ($row['state'] != pskb::STATE_NEW) {
continue;
}
$time = time();
$date = date('c', $time);
$descr = "ПСКБ аккредитив #{$row['lc_id']};" . " платежная cистема пользователя #{$row['ps_emp']}: сумма оплаты {$row['sum']} руб.;" . " обработан {$date}";
$account = new account();
$account->GetInfo($row['emp_id'], true);
$ammount = $row['sum'];
$op_code = sbr::OP_RESERVE;
$amm = 0;
$descr .= ' СбР #' . $row['sbr_id'];
$error = $account->deposit($op_id, $account->id, $amm, $descr, onlinedengi::PAYMENT_SYS, $ammount, $op_code, $row['sbr_id']);
$up_data['covered'] = 'NOW()';
break;
case self::STATE_EXP_COVER:
case self::STATE_EXP_EXEC:
case self::STATE_EXP_END:
break;
case self::STATE_END:
break;
case self::STATE_ERR:
$up_data['dol_is_failed'] = null;
break;
default:
continue;
}
if (!$error) {
$db->update('pskb_lc', $up_data, 'lc_id = ?', $row['lc_id']);
}
$cntOut++;
}
// отметить резерв
return true;
}