/**
  *  Получение и обработка данных оп платежах из кабинета WA
  *  Получение и обработка идет до тех пор, пока не будут обраотаны либо все страницы
  *  либо пока не будет найден платеж который уже есть в БД в таблице wacab_payments
  *  @param object wacabWaauth
  */
 public function getPayment($auth)
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     $model = new wacabPaymentModel();
     $count = 0;
     while (true) {
         if (!isset($url)) {
             $url = 'https://www.webasyst.ru/my/?action=checkingaccountInfo&id=' . $settings['account'];
         }
         $pays = wacabPaymentparseController::getPayments($url, $auth);
         $url = $pays[0];
         unset($pays[0]);
         foreach ($pays as $pay) {
             $check_pay = array('date' => $pay['date'], 'order' => $pay['order'], 'description' => $pay['description']);
             $exist_pay = $model->getByField($check_pay);
             if (count($exist_pay) > 0) {
                 break 2;
             }
             /* Привязываем платеж к плагину/приложению */
             $pay['type'] = self::checkType($pay);
             if ($pay['type'] == 'payin') {
                 $pay['apps_id'] = self::checkApps($pay);
             }
             /* EOF Привязываем платеж к плагину/приложению */
             $model->insert($pay);
             $count++;
         }
         if ($url == 'false') {
             break;
         }
     }
     return $count;
 }
 public function execute()
 {
     $model = new waModel();
     $payment_model = new wacabPaymentModel();
     $payments = $payment_model->getAll();
     $apps_model = new wacabAppsModel();
     $apps = $apps_model->getByField('stat', 1, true);
     $total = $model->query('SELECT SUM(pay) FROM wacab_payment WHERE `apps_id` is not null')->fetchAll();
     $plugins_stat = array();
     foreach ($apps as $app) {
         $app_total = $model->query('SELECT SUM(pay) FROM wacab_payment WHERE `apps_id` = ' . $app['id'])->fetch();
         $app_count = $model->query('SELECT COUNT(*) FROM wacab_payment WHERE `pay` >= 0 AND `apps_id` = ' . $app['id'])->fetch();
         $app_return = $model->query('SELECT COUNT(*) FROM wacab_payment WHERE `pay` < 0 AND `apps_id` = ' . $app['id'])->fetch();
         $names = json_decode($app['name'], true);
         if ($app['parent'] == 'no_parent' || $app['parent'] == '') {
             $pname = $names[0];
         } else {
             $pname = $names[0] . " (" . $app['parent'] . ")";
         }
         $plugins_stat[] = array('id' => $app['app_id'], 'total' => $app_total[0], 'name' => $pname, 'count' => $app_count[0], 'return' => $app_return[0]);
     }
     $this->view->assign('total', $total);
     $this->view->assign('apps', $plugins_stat);
     $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/statistic/stat_page.html');
 }
示例#3
0
 public function execute()
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     $model = new wacabPaymentModel();
     $reviews = $model->query('SELECT * FROM wacab_review ORDER BY date DESC')->fetchAll();
     $this->view->assign('reviews', $reviews);
     $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/reviews/reviews_page.html');
 }
 public function execute()
 {
     $data['order'] = waRequest::request('order');
     $data['start'] = waRequest::request('start', 0, 'int');
     $data['draw'] = waRequest::request('draw', 1, 'int');
     $data['length'] = waRequest::request('length', 10, 'int');
     $data['search'] = waRequest::request('search');
     $payment_model = new wacabPaymentModel();
     $response = $payment_model->getDataTable($data);
     print json_encode($response);
 }
 public function execute()
 {
     $payment_model = new wacabPaymentModel();
     $payments = $payment_model->getAll();
     foreach ($payments as $payment) {
         $res = wacabGetpayment::checkApps($payment);
         if ($res && $payment['apps_id'] != $res) {
             $payment['apps_id'] = $res;
             $payment_model->updateById($payment['id'], $payment);
         }
     }
 }
 public function execute()
 {
     $settings_model = new waAppSettingsModel();
     $settings = $settings_model->get('wacab');
     if (isset($settings['count'])) {
         $settings_model->set('wacab', 'new_count', 0);
     }
     $apps_count = wa()->getStorage()->read('apps-count');
     unset($apps_count['wacab']);
     wa()->getStorage()->set('apps-count', $apps_count);
     //        $new = new wacabGetpayment();
     //        $ps = $new->getPayment();
     $model = new wacabPaymentModel();
     $pays = $model->query('SELECT * FROM wacab_payment ORDER BY date DESC')->fetchAll();
     $this->view->assign('pays', $pays);
     $this->setTemplate(wacabHelper::getAppPath() . '/templates/actions/transactions/Transactions_page.html');
 }