РЕШЕНО помогите поставить заглушку на вывод денег

dghdepohged

Участник
#1
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);
$minp = 35;

if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}
else if ($set_purse['ins_sum'] >= $minp) {
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Для заказа выплаты вам необходимо пополнить баланс на ' . $minp . ' руб.');
}
 
#2
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);
$minp = 35;

if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}
else if ($set_purse['ins_sum'] >= $minp) {
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Для заказа выплаты вам необходимо пополнить баланс на ' . $minp . ' руб.');
}
здесь указываешь сумму заглушки $minp = 35; где 35 ставишь любое число какое нужно
 

dghdepohged

Участник
#4
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);


if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}
 
#5
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);


if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}
Попробуй там где $fee = round($sum/100*$ps['fee'],2); написано 100 изменить на свою сумму и посмотри как выйдет
 
#9
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);


if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}
а что за скрипт то хоть?
Если есть возможность скинь полный код
 

dghdepohged

Участник
#10
вот а мне тоесть надо чтобы человек не мог вывести деньги пока скажем не пополнит баланс на 10 рублей
 

dghdepohged

Участник
#11
<?php
class AccountController extends Controller{
public function main(){
if(empty($_SESSION['user'])){
header( 'Location: /signin/' );
exit;
}

$page = $this->router->getParameter('page');
$item = $this->router->getParameter('item');
if(empty($page) && empty($item)){
$rsum = $this->model->sumRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rsum', $rsum);
$rcnt = $this->model->countRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rcnt', $rcnt);
$sumpay = $this-> model->sumPayment($_SESSION['user']['id']);
$this->view->setTemplateVar('sumpay', $sumpay);
}
else
if(in_array($page,array('insert','payment','logs','purses','exit','support','history','success','fail','insert_fk','bonus','referals','ref_history'))){
switch ($page){
case 'exit':
unset($_SESSION['user']);
header( 'Location: /' );
exit;
case 'insert':
if(!empty($_POST['sum'])){
$pdata = $this -> model ->getMerchantParams(1);
$pdata['amount'] = number_format($_POST['sum'],2);
file_put_contents(DIR_ROOT.'serv/payeer_order.log',var_export($pdata,true),FILE_APPEND);
$pdata['orderid'] = $this ->model ->createOrder(1,$pdata['amount']);
$pdata['desc'] = base64_encode('Loto - USER '.$_SESSION['user']['id']);
$arHash = array(
$pdata['shop'],
$pdata['orderid'],
$pdata['amount'],
'RUB',
$pdata['desc'],
$pdata['key']
);
$pdata['sign'] = strtoupper(hash('sha256', implode(":", $arHash)));

$this->view->setTemplateVar('pdata', $pdata);
}
break;
case 'insert_fk':
if(!empty($_POST['sum'])){
$fdata = $this -> model ->getMerchantParams(2);
$fdata['oa'] = number_format($_POST['sum'],2);
$fdata['o'] = $this ->model ->createOrder(2,$fdata['oa']);
$arHash = array(
$fdata['shop'],
$fdata['oa'],
$fdata['key'],
$fdata['o']
);
$fdata['s'] = md5(implode(":", $arHash));
$this->view->setTemplateVar('fdata', $fdata);
}
break;
case 'logs':
$logs = $this->model->getLogons($_SESSION['user']['id'],10);
$this->view->setTemplateVar('logs', $logs);
break;
case 'support':

if(empty($item)){
$params = array(
'form'=>array('action'=>$this->router->makeUrl('self'), 'method'=>'POST', 'name'=>'ticket', 'id'=>'ticketForm', 'submit_title'=>'Отправить'),
'controls'=>array(
'section'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Категория', 'size'=>40, 'max'=>200, 'required'=>true),
'title'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Тема', 'size'=>40, 'max'=>200, 'required'=>true),
'text'=>array('type'=>'string', 'control_type'=>'textarea', 'title'=>'Сообщение', 'cols'=>50, 'rows'=>10, 'required'=>true, 'id'=>'conttext'),
)
);
$form = new FormProcessor();
$form->createForm($params);
if ($result = $form->checkFormSubmit()){
$ticket = array(
'add_date' => date("Y-m-d H:i:s"),
'title' => $result['title'],
'cat_id' => $result['section'],
'user_id' => $_SESSION['user']['id']
);
$id = $this->model->insertAssoc('tickets', $ticket);
$this->model->addMessageToTicket($id,$result['text']);
$this->view->setTemplateVar('succ', true);

}
$this->view->setTemplateVar("form", $form);
}
else{
$ticket = $this->model->getTicket($item,$_SESSION['user']['id']);
if(!empty($ticket)){
if($_POST['close_ticket']==1){
$this->model->updateTicketStatus($ticket['id'],1);
$ticket['status']=1;
}
if($_POST['open_ticket']==1){
$this->model->updateTicketStatus($ticket['id'],0);
$ticket['status']=0;
}
if(!empty($_POST['message']))
$this->model->addMessageToTicket($ticket['id'],$_POST['message']);
$messages = $this->model->getMessages($item);
$this->view->setTemplateVar("messages", $messages);
$this->view->setInnerTemplate('ticket');

$this->view->setTemplateVar("ticket", $ticket);

}
}
$tickets = $this->model->getTickets($_SESSION['user']['id']);
$this->view->setTemplateVar("tickets", $tickets);
break;
case 'history':
$history = $this->model->getHistory($_SESSION['user']['id'],10);
$this->view->setTemplateVar("history", $history);
break;
case 'bonus':
$bonus = $this->model->getBonus24($_SESSION['user']['id']);
if(!empty($bonus)){
$last_time= strtotime($bonus['odate'].' +1 day')- time();
$this->view->setTemplateVar("last_time", $last_time);
}
if(!empty($_POST['bonus']) && empty($bonus)){
if($this->model->isInGroup()){
$new_bonus = $this->model->generateBonus($_SESSION['user']['id']);
$this->view->setTemplateVar('new_bonus', $new_bonus);
$user = $this->model->getAllFromById('my_admin_users',$_SESSION['user']['id']);
$this->view->setTemplateVar('user', $user);
}
else{
$this->view->setTemplateVar("need_group", false);
}
}
$bonuses = $this->model->getBonuses();
$this->view->setTemplateVar("bonuses", $bonuses);
break;
case 'purses':
if(empty($item)){
if(!empty($_POST['delpurse'])){
$this->model->deleteById('purses',$_POST['delpurse']);
}
$pss= $this->model->getAllFrom('out_systems');
$this->view->setTemplateVar('pss', $pss);
$purses = $this->model->getPurses($_SESSION['user']['id']);
$this->view->setTemplateVar('purses',$purses);
}else if($item=='add_purse'){
$psid = $_POST['psid'];
if(!empty($psid)){
$ps = $this->model->getAllFromById('out_systems',$psid);
if(!empty($ps)){
if(!empty($_POST['purse'])){
$purse=$_POST['purse'];
$pat = '/'.$ps['valid'].'/i';
if(preg_match($pat,$purse)==1){
$data= array(
'add_date'=> date("Y-m-d H:i:s"),
'user_id' => $_SESSION['user']['id'],
'system_id'=>$psid,
'purse' => $_POST['purse']
);
$this->model->insertAssoc('purses',$data);
$this->view->setTemplateVar('purse',$_POST['purse']);
}else{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Неправильный формат кошелька');
}

}
$this->view->setTemplateVar('ps', $ps);
$this->view->setInnerTemplate('add_purse');


}

}
}

break;
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);


if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}

else{
$purse = $_POST['purse'];
switch($alias){
case 'payeer':
$pdata = $this -> model ->getOutParams(1);
$payeer = new CPayeer($pdata['id'], $pdata['user'], $pdata['key']);
if ($payeer->isAuth())
{

$out = $this ->model ->createOut(1,$ps['id'],$purse,$sum,$fee);
$data=array(
'curIn' => 'RUB',
'sum' => $sum,
'curOut' => 'RUB',
//'sumOut' => 1,
'to' => $purse,
//'to' => '[email protected]',
'comment' => 'ВЫПЛАТА С DARKPROFIT LOTO',
//'anonim' => 'Y',
//'protect' => 'Y',
//'protectPeriod' => '3',
//'protectCode' => '12345',
);
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($data,true),FILE_APPEND);
$arTransfer = $payeer->transfer($data);
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($arTransfer,true),FILE_APPEND);

if (empty($arTransfer['errors']))
{
$this-> model->setOutData($out,'Успех',$arTransfer['historyId']);
$this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
$this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
$this->view->setTemplateVar('color', 'green');
$this->view->setTemplateVar('msg', 'Перевод средств успешно выполнен');
}
else
{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Ошибка при выполении операции');
$errors = var_export($arTransfer["errors"],true);
$this-> model->setOutData($out,'Отмена',0,$errors);
}
}
else{
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($payeer->getErrors(),true),FILE_APPEND);
}
break;
case 'ooopay':
case 'webmoney':
case 'qiwi':
case 'ya':
$out = $this ->model ->createOut(2,$ps['id'],$purse,$sum,$fee);
$currency = $this->model->getCurrency($alias);
$answer = $this->model->cashOut($purse,$sum,$currency);
$pid = $answer['data']['payment_id'];
$status='';
if(!empty($pid)){
$answer = $this->model->getPaymentStatus($pid);
$status = $answer['data']['status'];
$desc= $answer['desc'];
}
else $desc=$answer['desc'];
if($status=='Completed' || $status=='In process'){
$ostatus=($status=='Completed')?'Успех':'Обрабатывается';
$this-> model->setOutData($out,$ostatus,$pid);
$this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
$this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
$this->view->setTemplateVar('color', 'green');
$msg=($status=='Completed')?'Перевод средств успешно выполнен':'Перевод отправлен и находится в обработке';
$this->view->setTemplateVar('msg', $msg);
}else{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Ошибка при выполении операции: '.$desc);
$this-> model->setOutData($out,'Отмена',0);
}
break;
}
}
}
$this->view->setTemplateVar('ps', $ps);
$purses = $this->model->getPursesBySystem($_SESSION['user']['id'],$ps['id']);
$this->view->setTemplateVar('purses', $purses);
$this->view->setInnerTemplate('ps_out');

$outs = $this->model->getPayments($_SESSION['user']['id'],$ps['id']);
$this->view->setTemplateVar('outs', $outs);


}
}
}
break;
case 'referals':
$rcnt = $this->model->countRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rcnt', $rcnt);
$this->view->setTemplateVar('uid', $_SESSION['user']['id']);
if(empty($item) || in_array($item,array('level_1','level_2','level_3'))){
$level=1;
if(!empty($item)){
$p=explode('_',$item);
$level=$p[1];
}
$this->view->setTemplateVar('level', $level);
$sort=1;
if(!empty($_POST['sort'])) $sort = $_POST['sort'];
$refinfo= $this->model->getRefInfo($_SESSION['user']['id'],$level,$sort);
$this->view->setTemplateVar('refinfo', $refinfo);
$this->view->setInnerTemplate('referals');
}

break;
case 'ref_history':
$opers= $this->model->getRefHistory($_SESSION['user']['id'],10);
$this->view->setTemplateVar('opers', $opers);
break;
}
if(empty($item))
$this->view->setInnerTemplate($page);
}


}
}
 

DjSuzuki

Команда форума
Гл. Модератор
#12
<?php
class AccountController extends Controller{
public function main(){
if(empty($_SESSION['user'])){
header( 'Location: /signin/' );
exit;
}

$page = $this->router->getParameter('page');
$item = $this->router->getParameter('item');
if(empty($page) && empty($item)){
$rsum = $this->model->sumRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rsum', $rsum);
$rcnt = $this->model->countRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rcnt', $rcnt);
$sumpay = $this-> model->sumPayment($_SESSION['user']['id']);
$this->view->setTemplateVar('sumpay', $sumpay);
}
else
if(in_array($page,array('insert','payment','logs','purses','exit','support','history','success','fail','insert_fk','bonus','referals','ref_history'))){
switch ($page){
case 'exit':
unset($_SESSION['user']);
header( 'Location: /' );
exit;
case 'insert':
if(!empty($_POST['sum'])){
$pdata = $this -> model ->getMerchantParams(1);
$pdata['amount'] = number_format($_POST['sum'],2);
file_put_contents(DIR_ROOT.'serv/payeer_order.log',var_export($pdata,true),FILE_APPEND);
$pdata['orderid'] = $this ->model ->createOrder(1,$pdata['amount']);
$pdata['desc'] = base64_encode('Loto - USER '.$_SESSION['user']['id']);
$arHash = array(
$pdata['shop'],
$pdata['orderid'],
$pdata['amount'],
'RUB',
$pdata['desc'],
$pdata['key']
);
$pdata['sign'] = strtoupper(hash('sha256', implode(":", $arHash)));

$this->view->setTemplateVar('pdata', $pdata);
}
break;
case 'insert_fk':
if(!empty($_POST['sum'])){
$fdata = $this -> model ->getMerchantParams(2);
$fdata['oa'] = number_format($_POST['sum'],2);
$fdata['o'] = $this ->model ->createOrder(2,$fdata['oa']);
$arHash = array(
$fdata['shop'],
$fdata['oa'],
$fdata['key'],
$fdata['o']
);
$fdata['s'] = md5(implode(":", $arHash));
$this->view->setTemplateVar('fdata', $fdata);
}
break;
case 'logs':
$logs = $this->model->getLogons($_SESSION['user']['id'],10);
$this->view->setTemplateVar('logs', $logs);
break;
case 'support':

if(empty($item)){
$params = array(
'form'=>array('action'=>$this->router->makeUrl('self'), 'method'=>'POST', 'name'=>'ticket', 'id'=>'ticketForm', 'submit_title'=>'Отправить'),
'controls'=>array(
'section'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Категория', 'size'=>40, 'max'=>200, 'required'=>true),
'title'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Тема', 'size'=>40, 'max'=>200, 'required'=>true),
'text'=>array('type'=>'string', 'control_type'=>'textarea', 'title'=>'Сообщение', 'cols'=>50, 'rows'=>10, 'required'=>true, 'id'=>'conttext'),
)
);
$form = new FormProcessor();
$form->createForm($params);
if ($result = $form->checkFormSubmit()){
$ticket = array(
'add_date' => date("Y-m-d H:i:s"),
'title' => $result['title'],
'cat_id' => $result['section'],
'user_id' => $_SESSION['user']['id']
);
$id = $this->model->insertAssoc('tickets', $ticket);
$this->model->addMessageToTicket($id,$result['text']);
$this->view->setTemplateVar('succ', true);

}
$this->view->setTemplateVar("form", $form);
}
else{
$ticket = $this->model->getTicket($item,$_SESSION['user']['id']);
if(!empty($ticket)){
if($_POST['close_ticket']==1){
$this->model->updateTicketStatus($ticket['id'],1);
$ticket['status']=1;
}
if($_POST['open_ticket']==1){
$this->model->updateTicketStatus($ticket['id'],0);
$ticket['status']=0;
}
if(!empty($_POST['message']))
$this->model->addMessageToTicket($ticket['id'],$_POST['message']);
$messages = $this->model->getMessages($item);
$this->view->setTemplateVar("messages", $messages);
$this->view->setInnerTemplate('ticket');

$this->view->setTemplateVar("ticket", $ticket);

}
}
$tickets = $this->model->getTickets($_SESSION['user']['id']);
$this->view->setTemplateVar("tickets", $tickets);
break;
case 'history':
$history = $this->model->getHistory($_SESSION['user']['id'],10);
$this->view->setTemplateVar("history", $history);
break;
case 'bonus':
$bonus = $this->model->getBonus24($_SESSION['user']['id']);
if(!empty($bonus)){
$last_time= strtotime($bonus['odate'].' +1 day')- time();
$this->view->setTemplateVar("last_time", $last_time);
}
if(!empty($_POST['bonus']) && empty($bonus)){
if($this->model->isInGroup()){
$new_bonus = $this->model->generateBonus($_SESSION['user']['id']);
$this->view->setTemplateVar('new_bonus', $new_bonus);
$user = $this->model->getAllFromById('my_admin_users',$_SESSION['user']['id']);
$this->view->setTemplateVar('user', $user);
}
else{
$this->view->setTemplateVar("need_group", false);
}
}
$bonuses = $this->model->getBonuses();
$this->view->setTemplateVar("bonuses", $bonuses);
break;
case 'purses':
if(empty($item)){
if(!empty($_POST['delpurse'])){
$this->model->deleteById('purses',$_POST['delpurse']);
}
$pss= $this->model->getAllFrom('out_systems');
$this->view->setTemplateVar('pss', $pss);
$purses = $this->model->getPurses($_SESSION['user']['id']);
$this->view->setTemplateVar('purses',$purses);
}else if($item=='add_purse'){
$psid = $_POST['psid'];
if(!empty($psid)){
$ps = $this->model->getAllFromById('out_systems',$psid);
if(!empty($ps)){
if(!empty($_POST['purse'])){
$purse=$_POST['purse'];
$pat = '/'.$ps['valid'].'/i';
if(preg_match($pat,$purse)==1){
$data= array(
'add_date'=> date("Y-m-d H:i:s"),
'user_id' => $_SESSION['user']['id'],
'system_id'=>$psid,
'purse' => $_POST['purse']
);
$this->model->insertAssoc('purses',$data);
$this->view->setTemplateVar('purse',$_POST['purse']);
}else{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Неправильный формат кошелька');
}

}
$this->view->setTemplateVar('ps', $ps);
$this->view->setInnerTemplate('add_purse');


}

}
}

break;
case 'payment':
$this->model->updatePaymentStatus($_SESSION['user']['id']);
if(!empty($item)){
$parse=explode('_',$item);
$alias = $parse[1];
if(!empty($alias)){
$ps = $this->model->getAllFromByAlias('out_systems',$alias);
if(!empty($ps) ){
if(!empty($_POST['sum'])){
$sum = (float)$_POST['sum'];
$fee = round($sum/100*$ps['fee'],2);
$balance = $this->model->getBalance($_SESSION['user']['id']);


if($sum < $ps['min'] ){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
}
else if($sum+$fee>$balance){
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
}

else{
$purse = $_POST['purse'];
switch($alias){
case 'payeer':
$pdata = $this -> model ->getOutParams(1);
$payeer = new CPayeer($pdata['id'], $pdata['user'], $pdata['key']);
if ($payeer->isAuth())
{

$out = $this ->model ->createOut(1,$ps['id'],$purse,$sum,$fee);
$data=array(
'curIn' => 'RUB',
'sum' => $sum,
'curOut' => 'RUB',
//'sumOut' => 1,
'to' => $purse,
//'to' => '[email protected]',
'comment' => 'ВЫПЛАТА С DARKPROFIT LOTO',
//'anonim' => 'Y',
//'protect' => 'Y',
//'protectPeriod' => '3',
//'protectCode' => '12345',
);
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($data,true),FILE_APPEND);
$arTransfer = $payeer->transfer($data);
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($arTransfer,true),FILE_APPEND);

if (empty($arTransfer['errors']))
{
$this-> model->setOutData($out,'Успех',$arTransfer['historyId']);
$this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
$this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
$this->view->setTemplateVar('color', 'green');
$this->view->setTemplateVar('msg', 'Перевод средств успешно выполнен');
}
else
{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Ошибка при выполении операции');
$errors = var_export($arTransfer["errors"],true);
$this-> model->setOutData($out,'Отмена',0,$errors);
}
}
else{
file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($payeer->getErrors(),true),FILE_APPEND);
}
break;
case 'ooopay':
case 'webmoney':
case 'qiwi':
case 'ya':
$out = $this ->model ->createOut(2,$ps['id'],$purse,$sum,$fee);
$currency = $this->model->getCurrency($alias);
$answer = $this->model->cashOut($purse,$sum,$currency);
$pid = $answer['data']['payment_id'];
$status='';
if(!empty($pid)){
$answer = $this->model->getPaymentStatus($pid);
$status = $answer['data']['status'];
$desc= $answer['desc'];
}
else $desc=$answer['desc'];
if($status=='Completed' || $status=='In process'){
$ostatus=($status=='Completed')?'Успех':'Обрабатывается';
$this-> model->setOutData($out,$ostatus,$pid);
$this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
$this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
$this->view->setTemplateVar('color', 'green');
$msg=($status=='Completed')?'Перевод средств успешно выполнен':'Перевод отправлен и находится в обработке';
$this->view->setTemplateVar('msg', $msg);
}else{
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Ошибка при выполении операции: '.$desc);
$this-> model->setOutData($out,'Отмена',0);
}
break;
}
}
}
$this->view->setTemplateVar('ps', $ps);
$purses = $this->model->getPursesBySystem($_SESSION['user']['id'],$ps['id']);
$this->view->setTemplateVar('purses', $purses);
$this->view->setInnerTemplate('ps_out');

$outs = $this->model->getPayments($_SESSION['user']['id'],$ps['id']);
$this->view->setTemplateVar('outs', $outs);


}
}
}
break;
case 'referals':
$rcnt = $this->model->countRef($_SESSION['user']['id']);
$this->view->setTemplateVar('rcnt', $rcnt);
$this->view->setTemplateVar('uid', $_SESSION['user']['id']);
if(empty($item) || in_array($item,array('level_1','level_2','level_3'))){
$level=1;
if(!empty($item)){
$p=explode('_',$item);
$level=$p[1];
}
$this->view->setTemplateVar('level', $level);
$sort=1;
if(!empty($_POST['sort'])) $sort = $_POST['sort'];
$refinfo= $this->model->getRefInfo($_SESSION['user']['id'],$level,$sort);
$this->view->setTemplateVar('refinfo', $refinfo);
$this->view->setInnerTemplate('referals');
}

break;
case 'ref_history':
$opers= $this->model->getRefHistory($_SESSION['user']['id'],10);
$this->view->setTemplateVar('opers', $opers);
break;
}
if(empty($item))
$this->view->setInnerTemplate($page);
}


}
}
Оформляйте код. Вставить - код.
 

dghdepohged

Участник
#14
Код:
<?php
class AccountController extends Controller{
    public function main(){
        if(empty($_SESSION['user'])){
            header( 'Location: /signin/' );
            exit;
        }

        $page = $this->router->getParameter('page');
        $item = $this->router->getParameter('item');
        if(empty($page) && empty($item)){
            $rsum = $this->model->sumRef($_SESSION['user']['id']);
            $this->view->setTemplateVar('rsum', $rsum);
            $rcnt = $this->model->countRef($_SESSION['user']['id']);
            $this->view->setTemplateVar('rcnt', $rcnt);
            $sumpay = $this-> model->sumPayment($_SESSION['user']['id']);
            $this->view->setTemplateVar('sumpay', $sumpay);
        }
        else
        if(in_array($page,array('insert','payment','logs','purses','exit','support','history','success','fail','insert_fk','bonus','referals','ref_history'))){
            switch ($page){
                case 'exit':
                    unset($_SESSION['user']);
                    header( 'Location: /' );
                    exit;
                case 'insert':
                    if(!empty($_POST['sum'])){
                        $pdata = $this -> model ->getMerchantParams(1);
                        $pdata['amount'] = number_format($_POST['sum'],2);
                        file_put_contents(DIR_ROOT.'serv/payeer_order.log',var_export($pdata,true),FILE_APPEND);
                        $pdata['orderid'] = $this ->model ->createOrder(1,$pdata['amount']);
                        $pdata['desc'] = base64_encode('Loto - USER '.$_SESSION['user']['id']);
                        $arHash = array(
                            $pdata['shop'],
                            $pdata['orderid'],
                            $pdata['amount'],
                            'RUB',
                            $pdata['desc'],
                            $pdata['key']
                        );
                        $pdata['sign'] = strtoupper(hash('sha256', implode(":", $arHash)));

                        $this->view->setTemplateVar('pdata', $pdata);
                    }
                    break;
                case 'insert_fk':
                    if(!empty($_POST['sum'])){
                        $fdata = $this -> model ->getMerchantParams(2);
                        $fdata['oa'] = number_format($_POST['sum'],2);
                        $fdata['o'] = $this ->model ->createOrder(2,$fdata['oa']);
                        $arHash = array(
                            $fdata['shop'],
                            $fdata['oa'],
                            $fdata['key'],
                            $fdata['o']
                        );
                        $fdata['s'] = md5(implode(":", $arHash));
                        $this->view->setTemplateVar('fdata', $fdata);
                    }
                    break;
                case 'logs':
                    $logs = $this->model->getLogons($_SESSION['user']['id'],10);
                    $this->view->setTemplateVar('logs', $logs);
                    break;
                case 'support':

                    if(empty($item)){
                        $params = array(
                            'form'=>array('action'=>$this->router->makeUrl('self'), 'method'=>'POST', 'name'=>'ticket', 'id'=>'ticketForm', 'submit_title'=>'Отправить'),
                            'controls'=>array(
                                'section'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Категория', 'size'=>40, 'max'=>200, 'required'=>true),
                                'title'=>array('type'=>'string', 'control_type'=>'text', 'title'=>'Тема', 'size'=>40, 'max'=>200, 'required'=>true),
                                'text'=>array('type'=>'string', 'control_type'=>'textarea', 'title'=>'Сообщение', 'cols'=>50, 'rows'=>10, 'required'=>true, 'id'=>'conttext'),
                            )
                        );
                        $form = new FormProcessor();
                        $form->createForm($params);
                        if ($result = $form->checkFormSubmit()){
                            $ticket = array(
                                'add_date' => date("Y-m-d H:i:s"),
                                'title' => $result['title'],
                                'cat_id' => $result['section'],
                                'user_id' => $_SESSION['user']['id']
                            );
                            $id = $this->model->insertAssoc('tickets', $ticket);
                            $this->model->addMessageToTicket($id,$result['text']);
                            $this->view->setTemplateVar('succ', true);

                        }
                        $this->view->setTemplateVar("form", $form);
                    }
                    else{
                        $ticket = $this->model->getTicket($item,$_SESSION['user']['id']);
                        if(!empty($ticket)){
                            if($_POST['close_ticket']==1){
                                $this->model->updateTicketStatus($ticket['id'],1);
                                $ticket['status']=1;
                            }
                            if($_POST['open_ticket']==1){
                                $this->model->updateTicketStatus($ticket['id'],0);
                                $ticket['status']=0;
                            }
                            if(!empty($_POST['message']))
                                $this->model->addMessageToTicket($ticket['id'],$_POST['message']);
                            $messages = $this->model->getMessages($item);
                            $this->view->setTemplateVar("messages", $messages);
                            $this->view->setInnerTemplate('ticket');

                            $this->view->setTemplateVar("ticket", $ticket);

                        }
                    }
                    $tickets = $this->model->getTickets($_SESSION['user']['id']);
                    $this->view->setTemplateVar("tickets", $tickets);
                    break;
                case 'history':
                    $history = $this->model->getHistory($_SESSION['user']['id'],10);
                    $this->view->setTemplateVar("history", $history);
                    break;
                case 'bonus':
                    $bonus = $this->model->getBonus24($_SESSION['user']['id']);
                    if(!empty($bonus)){
                        $last_time= strtotime($bonus['odate'].' +1 day')- time();
                        $this->view->setTemplateVar("last_time", $last_time);
                    }
                    if(!empty($_POST['bonus']) && empty($bonus)){
                        if($this->model->isInGroup()){
                            $new_bonus = $this->model->generateBonus($_SESSION['user']['id']);
                            $this->view->setTemplateVar('new_bonus', $new_bonus);
                            $user  = $this->model->getAllFromById('my_admin_users',$_SESSION['user']['id']);
                            $this->view->setTemplateVar('user', $user);
                        }
                        else{
                            $this->view->setTemplateVar("need_group", false);
                        }
                    }
                    $bonuses = $this->model->getBonuses();
                    $this->view->setTemplateVar("bonuses", $bonuses);
                    break;
                case 'purses':
                    if(empty($item)){
                        if(!empty($_POST['delpurse'])){
                            $this->model->deleteById('purses',$_POST['delpurse']);
                        }
                        $pss= $this->model->getAllFrom('out_systems');
                        $this->view->setTemplateVar('pss', $pss);
                        $purses = $this->model->getPurses($_SESSION['user']['id']);
                        $this->view->setTemplateVar('purses',$purses);
                    }else if($item=='add_purse'){
                        $psid = $_POST['psid'];
                        if(!empty($psid)){
                            $ps = $this->model->getAllFromById('out_systems',$psid);
                            if(!empty($ps)){
                                if(!empty($_POST['purse'])){
                                    $purse=$_POST['purse'];
                                    $pat = '/'.$ps['valid'].'/i';
                                    if(preg_match($pat,$purse)==1){
                                        $data= array(
                                            'add_date'=> date("Y-m-d H:i:s"),
                                            'user_id' => $_SESSION['user']['id'],
                                            'system_id'=>$psid,
                                            'purse' => $_POST['purse']
                                        );
                                        $this->model->insertAssoc('purses',$data);
                                        $this->view->setTemplateVar('purse',$_POST['purse']);
                                    }else{
                                        $this->view->setTemplateVar('color', 'red');
                                        $this->view->setTemplateVar('msg', 'Неправильный формат кошелька');
                                    }

                                }
                                $this->view->setTemplateVar('ps', $ps);
                                $this->view->setInnerTemplate('add_purse');


                            }

                        }
                    }

                    break;
                case 'payment':
                    $this->model->updatePaymentStatus($_SESSION['user']['id']);
                    if(!empty($item)){
                        $parse=explode('_',$item);
                        $alias = $parse[1];
                        if(!empty($alias)){
                            $ps = $this->model->getAllFromByAlias('out_systems',$alias);
                            if(!empty($ps) ){
                                if(!empty($_POST['sum'])){
                                $sum = (float)$_POST['sum'];
                                $fee = round($sum/100*$ps['fee'],2);
                                $balance = $this->model->getBalance($_SESSION['user']['id']);
                                
                                
                                if($sum < $ps['min'] ){
                                    $this->view->setTemplateVar('color', 'red');
                                    $this->view->setTemplateVar('msg', 'Сумма меньше минимальной');
                                }
                                else  if($sum+$fee>$balance){
                                    $this->view->setTemplateVar('color', 'red');
                                    $this->view->setTemplateVar('msg', 'Недостаточно денег на балансе');
                                }
                                
                                else{
                                    $purse = $_POST['purse'];
                                    switch($alias){
                                        case 'payeer':
                                        $pdata = $this -> model ->getOutParams(1);
                                        $payeer = new CPayeer($pdata['id'], $pdata['user'], $pdata['key']);
                                        if ($payeer->isAuth())
                                        {

                                            $out = $this ->model ->createOut(1,$ps['id'],$purse,$sum,$fee);
                                            $data=array(
                                                'curIn' => 'RUB',
                                                'sum' => $sum,
                                                'curOut' => 'RUB',
                                                //'sumOut' => 1,
                                                'to' => $purse,
                                                //'to' => '[email protected]',
                                                'comment' => 'ВЫПЛАТА С DARKPROFIT LOTO',
                                                //'anonim' => 'Y',
                                                //'protect' => 'Y',
                                                //'protectPeriod' => '3',
                                                //'protectCode' => '12345',
                                            );
                                            file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($data,true),FILE_APPEND);
                                            $arTransfer = $payeer->transfer($data);
                                            file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($arTransfer,true),FILE_APPEND);

                                            if (empty($arTransfer['errors']))
                                            {
                                                $this-> model->setOutData($out,'Успех',$arTransfer['historyId']);
                                                $this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
                                                $this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
                                                $this->view->setTemplateVar('color', 'green');
                                                $this->view->setTemplateVar('msg', 'Перевод средств успешно выполнен');
                                            }
                                            else
                                            {
                                                $this->view->setTemplateVar('color', 'red');
                                                $this->view->setTemplateVar('msg', 'Ошибка при выполении операции');
                                                $errors = var_export($arTransfer["errors"],true);
                                                $this-> model->setOutData($out,'Отмена',0,$errors);
                                            }
                                        }
                                        else{
                                            file_put_contents(DIR_ROOT.'serv/payeer_out.log',var_export($payeer->getErrors(),true),FILE_APPEND);
                                        }
                                        break;
                                        case 'ooopay':
                                        case 'webmoney':
                                        case 'qiwi':
                                        case 'ya':
                                            $out = $this ->model ->createOut(2,$ps['id'],$purse,$sum,$fee);
                                            $currency = $this->model->getCurrency($alias);
                                            $answer = $this->model->cashOut($purse,$sum,$currency);
                                            $pid = $answer['data']['payment_id'];
                                            $status='';
                                            if(!empty($pid)){
                                                $answer = $this->model->getPaymentStatus($pid);
                                                $status = $answer['data']['status'];
                                                $desc= $answer['desc'];
                                            }
                                            else $desc=$answer['desc'];
                                            if($status=='Completed' || $status=='In process'){
                                                $ostatus=($status=='Completed')?'Успех':'Обрабатывается';
                                                $this-> model->setOutData($out,$ostatus,$pid);
                                                $this-> model -> movement($sum,$_SESSION['user']['id'],$ps['account'],2,0,0,$out);
                                                $this-> model -> movement($fee,$_SESSION['user']['id'],$ps['account'],11,0,0,$out);
                                                $this->view->setTemplateVar('color', 'green');
                                                $msg=($status=='Completed')?'Перевод средств успешно выполнен':'Перевод отправлен и находится в обработке';
                                                $this->view->setTemplateVar('msg', $msg);
                                            }else{
                                                $this->view->setTemplateVar('color', 'red');
                                                $this->view->setTemplateVar('msg', 'Ошибка при выполении операции: '.$desc);
                                                $this-> model->setOutData($out,'Отмена',0);
                                            }
                                        break;
                                    }
                                }
                                }
                                $this->view->setTemplateVar('ps', $ps);
                                $purses = $this->model->getPursesBySystem($_SESSION['user']['id'],$ps['id']);
                                $this->view->setTemplateVar('purses', $purses);
                                $this->view->setInnerTemplate('ps_out');

                                $outs = $this->model->getPayments($_SESSION['user']['id'],$ps['id']);
                                $this->view->setTemplateVar('outs', $outs);


                            }
                        }
                    }
                    break;
                case 'referals':
                    $rcnt = $this->model->countRef($_SESSION['user']['id']);
                    $this->view->setTemplateVar('rcnt', $rcnt);
                    $this->view->setTemplateVar('uid', $_SESSION['user']['id']);
                    if(empty($item) || in_array($item,array('level_1','level_2','level_3'))){
                        $level=1;
                        if(!empty($item)){
                            $p=explode('_',$item);
                            $level=$p[1];
                        }
                        $this->view->setTemplateVar('level', $level);
                        $sort=1;
                        if(!empty($_POST['sort'])) $sort = $_POST['sort'];
                        $refinfo= $this->model->getRefInfo($_SESSION['user']['id'],$level,$sort);
                        $this->view->setTemplateVar('refinfo', $refinfo);
                        $this->view->setInnerTemplate('referals');
                    }

                    break;
                case 'ref_history':
                        $opers= $this->model->getRefHistory($_SESSION['user']['id'],10);
                    $this->view->setTemplateVar('opers', $opers);
                    break;
            }
            if(empty($item))
                $this->view->setInnerTemplate($page);
        }


    }
}
 

A_lex

Участник
#16
Код:
else if ($set_purse['ins_sum'] >= 35) {
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Для заказа выплаты вам необходимо пополнить баланс на 35 руб.');
}
Пробовал сразу число подставить?
 

dghdepohged

Участник
#17
Код:
else if ($set_purse['ins_sum'] >= 35) {
$this->view->setTemplateVar('color', 'red');
$this->view->setTemplateVar('msg', 'Для заказа выплаты вам необходимо пополнить баланс на 35 руб.');
}
Пробовал сразу число подставить?
да пробовал так вообще данный алиас не выходит
 

dghdepohged

Участник
#19
Код:
<div class="row">
    <div class='col-md-10 col-md-offset-1 dark_fon' align=center>


        <header class="post-header clearfix">
            <div class="post-header-container page-header-container">
                <h1 class="post-title">Заказать выплату</h1>
            </div>
        </header>


        <div class="silver-bk">
            <div class="clr"></div>
            <BR />

            <style>
                /*
                .ps_icons > div >a {
                    background: #fff;
                }*/
            </style>

            <div align="center" class='ps_icons'>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_payeer/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/payeer_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_qiwi/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/qiwi_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_ya/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/ya_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

            </div>

            <BR />
            Каждая платежная система по своему удобна и уникальна. В какой-то платежной системе маленькая комиссия, а в какой-то больше направлений для вывода.

            <BR /><BR />
            <div class="clr"></div>
        </div>



    </div>
</div>
 
#20
Код:
<div class="row">
    <div class='col-md-10 col-md-offset-1 dark_fon' align=center>


        <header class="post-header clearfix">
            <div class="post-header-container page-header-container">
                <h1 class="post-title">Заказать выплату</h1>
            </div>
        </header>


        <div class="silver-bk">
            <div class="clr"></div>
            <BR />

            <style>
                /*
                .ps_icons > div >a {
                    background: #fff;
                }*/
            </style>

            <div align="center" class='ps_icons'>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_payeer/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/payeer_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_qiwi/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/qiwi_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

                <div width="30%" style="margin:8px; display:inline-block;">
                    <a href="/account/payment/ps_ya/" style="text-decoration: none;">
                        <div class='white_fon'><img src="/img/ps_logo/ya_logo.png" border="0" style="border: 1px solid #336699;"/></div>
                        <BR /><h3 style="margin-top:4px;">Выбрать</h3>
                    </a>
                </div>

            </div>

            <BR />
            Каждая платежная система по своему удобна и уникальна. В какой-то платежной системе маленькая комиссия, а в какой-то больше направлений для вывода.

            <BR /><BR />
            <div class="clr"></div>
        </div>



    </div>
</div>
Админку проверял?
 
Сверху