示例#1
0
$logger_coins->log($_SERVER['REMOTE_ADDR']. ' '.$_SERVER['HTTP_USER_AGENT']. ' '.' viporder:'.$viporder.', add to basket '.$shopcoins.':'.$tpl['user']['user_id'].', order:'.$shopcoinsorder,Zend_Log::INFO); 

$shopcoins = (integer)request('shopcoins');
$onefio = request('onefio');
$onephone = request('onephone');
$amount = (integer) request('amount');
$basket_type = request('basket_type');

if($tpl['user']['user_id']==352480){
    //var_dump($shopcoinsorder);
}

$erroramount = "";
if (!$amount) $amount = 1;

$helpshopcoinsorder_class = new model_helpshopcoinsorder($db_class);
$order_class = new model_order($db_class);
$orderdetails_class = new model_orderdetails($db_class,$shopcoinsorder);

$data_result = array();
$data_result['error'] = null;


if (!$shopcoins) $data_result['error'] = "noshopcoins";	

$rows = $shopcoins_class->getRowByParams(array('shopcoins'=>$shopcoins));

if(!$rows){
    $data_result['error'] = "noshopcoins";
} else  {
	$price = $rows['price'];
示例#2
0
<?
require $cfg['path'] . '/configs/config_shopcoins.php';
require_once $cfg['path'] . '/models/helpshopcoinsorder.php';

$data_result = array();
$data_result['error'] = null;
if(!$tpl['user']['user_id']) $data_result['error'] = "noauth";

$shopcoins = (integer)request('shopcoins');	

$helpshopcoinsorder_class = new model_helpshopcoinsorder($db_class);

//������ ��� ������� - �� �����������
$rows = $shopcoins_class->getRowByParams(array('shopcoins'=>$shopcoins));

if(!$rows||$rows["check"]==0) $data_result['error'] = "notavailable";
else {    
    $ShopcoinsMaterialtype = $rows["materialtype"];    
    if (in_array($ShopcoinsMaterialtype, array(8,6,7,4,2))) { 	
    	$result_amount = $helpshopcoinsorder_class->getAllByParams(array('shopcoins'=>$shopcoins));   
    	
    	$amountreserve = 0;
    	foreach ($result_amount as $rows_amount) {  	
    		if (time()-$rows_amount["reserve"] < $reservetime ) 
    			$amountreserve++;
    	}    	
    	if ( !$rows["amount"] ) $rows["amount"] = 1;
    	
    	if ($rows["amount"] <= $amountreserve) {    	
    		$data_result['error'] = "reserved"; 
    	}