Exemplo n.º 1
0
 private static function getList($infos, $params)
 {
     $infos = StringOpt::cameltounline($infos['index']);
     $infos = explode('_', $infos);
     if (empty($infos[0]) || empty($infos[1])) {
         return false;
     }
     $index = $infos[0];
     $type = $infos[1];
     $url = 'http://localhost:9200/' . $index . '/' . $type . '/_search';
     $ret = HttpCurl::get($url, json_encode($params[0]));
     $body = json_decode($ret['body'], true);
     if ($body == false || empty($body['hits']['total'])) {
         return false;
     }
     return $body;
 }
Exemplo n.º 2
0
        if ($acc_infos != false) {
            $acc_infos = $acc_infos['_source'];
            if ($es_params['recType'] == 2) {
                $acc_infos['money'] += $es_params['money'];
            } else {
                $acc_infos['money'] -= $es_params['money'];
            }
            $acc_infos['orderNo']++;
            $acc_infos['updatetime'] = date('Y-m-d H:i:s', time());
            $ret = HttpCurl::post($acc_url, json_encode($acc_infos));
        }
        if (!isset($es_params['toAcc'])) {
            continue;
        }
        $acc_url = 'http://localhost:9200/wacai/account/' . $es_params['toAcc'];
        $ret = HttpCurl::get($acc_url);
        $ret = $ret['body'];
        $acc_infos = json_decode($ret, true);
        if ($acc_infos == false) {
            continue;
        }
        $acc_infos = $acc_infos['_source'];
        $acc_infos['money'] += $es_params['money'];
        $acc_infos['orderNo']++;
        $acc_infos['updatetime'] = date('Y-m-d H:i:s', time());
        HttpCurl::post($acc_url, json_encode($acc_infos));
    }
    sleep(3);
}
function get_cookie()
{
Exemplo n.º 3
0
<?php

require_once __DIR__ . '/../app/register.php';
echo '是否抓取挖财账目信息? [y/N]';
$sure = fgets(STDIN);
if (trim($sure[0]) != 'Y' && trim($sure[0]) != 'y') {
    exit;
}
HttpCurl::set_cookie(get_cookie());
$url = 'https://www.wacai.com/setting/account_list.action' . '?reqBalance=true&type=all&pageInfo.pageIndex=';
$pageCount = 1;
for ($i = 1; $i <= $pageCount; $i++) {
    $ret = HttpCurl::get($url . $i);
    if ($ret['body'] == false) {
        echo 'get_earnings ERROR: url ' . $url . $i . '; error ' . $ret['error'] . PHP_EOL;
        exit;
    }
    $infos = json_decode($ret['body'], true);
    if ($infos == false) {
        echo 'get_earnings ERROR: url ' . $url . $i . '; body ' . $ret['body'] . PHP_EOL;
        exit;
    }
    if ($i == 1) {
        $pageCount = $infos['pi']['pageCount'];
    }
    $acc = $infos['accountTypeSum'];
    foreach ($acc as $infos) {
        if (isset($infos['hiddenAccs'])) {
            foreach ($infos['hiddenAccs'] as $acc_infos) {
                $es_params = array();
                $es_params['currency'] = $acc_infos['moneyType']['name'];