Example #1
0
<?php

/**
 * 统计下状态正常的产品信息数量
 */
$tableObj = new Table("txonline");
$id = 0;
$num = 0;
while (1) {
    $mysqlRs = $tableObj->findAll("select id, keyword, state from gckeyword.key_proword where id > '" . $id . "' order by id asc limit 100");
    if (empty($mysqlRs)) {
        exit("统计完毕\n");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        echo $id . "\t" . $num . "\n";
        if ($value["state"] < 0) {
            continue;
        }
        $num++;
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
}
class Table
{
    public $conn = '';
    public $config;
Example #2
0
 */
header("Content-type:text/html;charset=utf-8");
define("ROOT", substr(__FILE__, 0, stripos(__FILE__, "tianyunchong.select")));
$conn = new Table("local198");
$cateid = isset($_GET["cateid"]) ? trim($_GET["cateid"]) : "";
if (empty($cateid)) {
    $parentid = 0;
} else {
    $cateInfo = $conn->findOne("select * from fbcateinfo.fbcate_cateinfo where cateid='" . $cateid . "' limit 1");
    if ($cateInfo) {
        $parentid = $cateInfo["cateid"];
    } else {
        $parentid = 0;
    }
}
$cateArr = $conn->findAll("select * from fbcateinfo.fbcate_cateinfo where parentid='{$parentid}' limit 100");
require ROOT . 'tianyunchong.select/templates/forbuyers/catechild.phtml';
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'local198' => array('192.168.8.198', 'root', '123456', 'fbproduct'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
}
class Table
{
    public $conn = '';
    public $config;
    public function __construct($connName)
    {
        $db = Config::$dbArr;
        $this->config = $db[$connName];
        try {
Example #3
0
<?php

/**
 * 初始化所有的关键词组
 */
include_once "common.php";
$conn = new Table("local189");
$conn->query("TRUNCATE TABLE  `tianyunzi`.`360_group`");
$jihuaArr = $conn->findAll("select * from tianyunzi.360_jihua limit 100");
$api = "https://api.e.360.cn/account/clientLogin";
$postData = array("format" => "json", "username" => "郑州悉知", "passwd" => "7232275XZgcw");
$md = md5("7232275XZgcw");
$key = "15fdeq7buepvssh8z899rusa6ynxufyn";
$m = new Xcrypt(substr($key, 0, 16), 'cbc', substr($key, 16, 16));
$postData["passwd"] = $m->encrypt($md, 'hex');
$header = array();
$header[] = "serveToken:" . microtime(1);
$header[] = "apiKey:1kg8tunzfxt8zvzpf53vjr5es45lvszh";
$str = curlPost($api, $header, $postData);
if (!isset($str["accessToken"])) {
    exit("用户登录验证失败!\n");
} else {
    echo "用户登录验证成功!\n";
}
$header[] = "accessToken:" . $str["accessToken"];
$header[] = "sessionToken:" . $str["sessionToken"];
foreach ($jihuaArr as $value) {
    $api = "https://api.e.360.cn/2.0/group/getIdListByCampaignId";
    $params = array("format" => "json", "campaignId" => intval($value["id"]));
    $str = curlPost($api, $header, $params);
    if (!isset($str["groupIdList"])) {
Example #4
0
<?php

/**
 * 初始化所有的关键词入库
 */
include_once "common.php";
$conn = new Table("local189");
$conn->query("TRUNCATE TABLE  `tianyunzi`.`360_keywords`");
$jihuaArr = $conn->findAll("select * from tianyunzi.360_jihua limit 100");
$api = "https://api.e.360.cn/account/clientLogin";
$postData = array("format" => "json", "username" => "郑州悉知", "passwd" => "7232275XZgcw");
$md = md5("7232275XZgcw");
$key = "15fdeq7buepvssh8z899rusa6ynxufyn";
$m = new Xcrypt(substr($key, 0, 16), 'cbc', substr($key, 16, 16));
$postData["passwd"] = $m->encrypt($md, 'hex');
$header = array();
$header[] = "serveToken:" . microtime(1);
$header[] = "apiKey:1kg8tunzfxt8zvzpf53vjr5es45lvszh";
$str = curlPost($api, $header, $postData);
if (!isset($str["accessToken"])) {
    exit("用户登录验证失败!\n");
} else {
    echo "用户登录验证成功!\n";
}
$header[] = "accessToken:" . $str["accessToken"];
$header[] = "sessionToken:" . $str["sessionToken"];
$groupid = 0;
while (1) {
    $groupArr = $conn->findAll("select * from tianyunzi.360_group where id > '{$groupid}' order by id asc limit 100");
    if (empty($groupArr)) {
        exit("所有的关键词处理完毕\n");
Example #5
0
<?php

/**
 * 用户信息转移
 * @author tianyunchong
 * @datetime 2016/05/26
 */
ini_set('magic_quotes_gpc', "1");
include_once "../common.php";
$conn = new Table("forbuyers-test");
$connLocal = new Table("local198");
$supid = 0;
while (1) {
    $userArr = $conn->findAll("select * from fbsupplier.fb_sup_user where supid > '" . $supid . "' limit 100");
    if (empty($userArr)) {
        break;
    }
    foreach ($userArr as $value) {
        $supid = $value["supid"];
        $existArr = $connLocal->findOne("select * from fbsupplier.fb_sup_user where supid = '" . $supid . "' limit 1");
        if ($existArr) {
            continue;
        }
        /** 邮箱不能重复 */
        $existArr = $connLocal->findOne("select * from fbsupplier.fb_sup_user where email = '" . $value["email"] . "' limit 1");
        if ($existArr) {
            continue;
        }
        $value["notice"] = intval($value["notice"]);
        $connLocal->insert($value, "fbsupplier.fb_sup_user");
        echo $supid . "\t" . $value["username"] . "\n";
Example #6
0
<?php

$localObj = new Table("local");
$onlineObj = new Table("txonline");
$id = 358403;
while (1) {
    echo $id, "\n";
    $resultRs = $localObj->findAll("select * from tianyunzi.phome_ecms_keywords where id > '{$id}' order by id asc limit 100");
    if (empty($resultRs)) {
        exit("所有数据处理完毕\n");
    }
    foreach ($resultRs as $value) {
        $id = $value["id"];
        updateKeyword($value);
    }
}
function updateKeyword($keywordArr)
{
    global $onlineObj;
    $keywordMysql = $onlineObj->findOne("select * from gckeyword.key_proword where keyword = '" . $keywordArr["title"] . "' limit 1");
    if (empty($keywordMysql)) {
        echo $keywordArr['title'] . "  不在当前词库中存在!\n";
        return false;
    }
    //开始更新数据
    $mainword = array_filter(explode("|", $keywordArr["mainword"]));
    $mainword = getMysqlJson($mainword);
    $f_word = array_filter(explode("|", $keywordArr["f_word"]));
    if (empty($f_word)) {
        $f_word = $keywordMysql["redword"];
    } else {
Example #7
0
/** 开查下用户信息 */
$userInfo = $conn18->findOne("select * from alienglish.fb_sup_user where supid = '" . $uid . "' limit 1");
if (empty($userInfo)) {
    exit("用户信息不存在!");
}
/** 开查下企业信息 */
$comInfo = $conn18->findOne("select * from alienglish.fb_company where supid = '" . $uid . "' limit 1");
if (empty($comInfo)) {
    exit("企业信息不存在!");
}
$cid = $comInfo["cid"];
$domain = $comInfo["domain"];
/** 开查下产品信息 */
$id = 0;
while (1) {
    $productMapArr = $conn18->findAll("select * from alienglish.pd_cate where id > '" . $id . "' order by id asc limit 100");
    if (empty($productMapArr)) {
        break;
    }
    foreach ($productMapArr as $value) {
        $id = $value["id"];
        if ($value["domain"] != $domain) {
            echo "alipid\t" . $value["alipid"] . "\t跳过\n";
            continue;
        }
        $alipid = $value["alipid"];
        $productData = $conn18->findOne("select * from alienglish.pd_info where alipid = '" . $alipid . "' limit 1");
        if (empty($productData)) {
            continue;
        }
        /** 开始处理单条的产品信息 */
Example #8
0
<?php

/**
 * 获取下所有的关键词处理标记为竞价
 */
$id = 0;
/* 清空下所有的关键词 */
$beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300));
while (1) {
    $conn = new Table("local");
    $groupArr = $conn->findAll("select * from tianyunzi.baidu_group where id > '{$id}' order by id asc limit 100");
    if (empty($groupArr)) {
        echo "所有的单元已经过完\n";
        exit;
    }
    foreach ($groupArr as $value) {
        $id = $value["id"];
        /* 获取当前单元下的所有关键词 */
        $keywordArr = getKeyword($value["id"]);
        if (empty($keywordArr) || !isset($keywordArr["body"]["data"])) {
            echo "计划[" . $value["jihuaname"] . "],单元[" . $value["groupname"] . "],没有查到关键词\n";
            continue;
        }
        foreach ($keywordArr["body"]["data"] as $value1) {
            /* 插入数据库 */
            $insertArr = array("id" => $value1["keywordId"], "campaignId" => $value1["campaignId"], "adgroupId" => $value1["adgroupId"], "keyword" => $value1["keyword"], "pcDestinationUrl" => $value1["pcDestinationUrl"]);
            echo $insertArr["keyword"] . "\n";
            writeBeans($insertArr["keyword"]);
            //file_put_contents("/tmp/keyword.log", $insertArr["keyword"] . "\n", FILE_APPEND);
        }
    }
Example #9
0
<?php

/**
 * 处理下存在全毛的相关分类
 */
$id = 0;
$conn = new Table("txonline");
$beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300));
while (1) {
    $keywordMysql = $conn->findAll("select id, keyword, relacateid from gckeyword.key_proword where id > '{$id}' order by id asc limit 100");
    if (empty($keywordMysql)) {
        exit("所有数据处理完毕");
    }
    foreach ($keywordMysql as $value) {
        $id = $value["id"];
        if (!strstr($value["relacateid"], "1270")) {
            continue;
        }
        $conn->update("update gckeyword.key_proword set relacateid = '' where id = '" . $value["id"] . "'");
        try {
            $beanstalk->choose('v3www_prokeyword_rela');
            echo $beanstalk->put($value["id"], array('priority' => 1024, 'delay' => 0, 'ttr' => 86400)), "\n";
        } catch (\Exception $e) {
        }
        exit;
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
Example #10
0
<?php

/**
 * 产品信息索引信息入库
 */
include_once "../common.php";
$conn = new Table("local198");
$pid = 0;
while (1) {
    $productArr = $conn->findAll("select * from fbproduct.pd_info where pid > '" . $pid . "' order by pid asc limit 100");
    if (empty($productArr)) {
        break;
    }
    foreach ($productArr as $value) {
        $pid = $value["pid"];
        /** 获取下企业信息 */
        $companyArr = $conn->findOne("select * from fbsupplier.fb_company where cid = '" . $value["cid"] . "' limit 1");
        $userArr = $conn->findOne("select * from fbsupplier.fb_sup_user where supid = '" . $value["uid"] . "' limit 1");
        $esArr = array("pid" => $value["pid"], "proname" => $value["proname"], "prokey" => $value["prokey"], "property" => getProperty($value["property"], $value["userproperty"]), "cate1" => $value["cate1"], "cate2" => $value["cate2"], "cate3" => $value["cate3"], "cate4" => $value["cate4"], "categoryid" => $value["cate4"] ? $value["cate4"] : ($value["cate3"] ? $value["cate3"] : $value["cate2"]), "groupid" => getGroupIdArr($value["pid"]), "pubtime" => $value["pubtime"], "uptime" => $value["uptime"], "star" => $value["star"], "province" => $companyArr["province"], "city" => $companyArr["city"], "cid" => $value["cid"], "uid" => $value["uid"], "is_verified" => $companyArr["is_verfied"], "is_vip" => $companyArr["is_vip"], "mobile_verified" => $userArr["mobile_checked"], "email_verified" => $userArr["email_checked"], "mincount" => $value["mincount"], "state" => $value["state"]);
        /** 开始创建es */
        $params = array("index" => "forbuyers_product", "type" => "product", "id" => $esArr["pid"], "body" => $esArr);
        $response = $client->index($params);
        if (isset($response["created"]) && $response["created"]) {
            echo $pid . "\tcreat success!\n";
        }
    }
}
/**
 * 获取产品分组
 *
 * @Author   tianyunzi
Example #11
0
/**
 * 开始更新处理百度关键词
 */
define("ROOT", "/data/cap/php/");
$conn = new Table("local");
$fp = fopen(ROOT . "baidu1.csv", "r");
while ($data = fgetcsv($fp)) {
    if (empty($data[0]) || $data[0] == "关键词") {
        continue;
    }
    $jihua = trim($data[0]);
    $group = trim($data[1]);
    $keyword = trim($data[2]);
    $url = trim($data[3]);
    $keywordRs = $conn->findAll("select * from tianyunzi.baidu_keywords where keyword = '" . $keyword . "' limit 10");
    if (count($keywordRs) <= 1) {
        echo $keyword . "\n";
        continue;
    }
    $jihuaArr = $conn->findOne("select * from tianyunzi.baidu_jihua where name = '" . $jihua . "' limit 1");
    if (empty($jihuaArr)) {
        echo "============未知的计划" . $jihua . "==================\n";
        continue;
    }
    $groupArr = $conn->findOne("select * from tianyunzi.baidu_group where groupname = '" . $group . "' limit 1");
    if (empty($groupArr)) {
        echo "==============未知的分组" . $group . "=================\n";
        continue;
    }
    $keywordRs = $conn->findOne("select * from tianyunzi.baidu_keywords where keyword = '" . $keyword . "' and campaignId = '" . $jihuaArr["id"] . "' and adgroupId = '" . $groupArr["id"] . "' limit 1");
Example #12
0
<?php

/**
 * 帮助中心信息处理
 * 把您改成你
 */
$onlineObj = new Table("txonline");
$id = 0;
while (1) {
    $mysqlRs = $onlineObj->findAll("select * from gcbuyer.com_article where id > '{$id}' order by id asc limit 100");
    if (empty($mysqlRs)) {
        exit("所有信息处理完毕");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        echo $id;
        echo "\n";
        $checkStr = $value["articletitle"] . $value["content"] . $value["smalltext"];
        if (strstr($checkStr, "您") || strstr($checkStr, "账号") || strstr($checkStr, "账户")) {
            var_dump($value);
            echo "\n";
            $updateArr = array("articletitle" => str_replace(array("您", "账号", "账户"), array("你", "帐号", "帐户"), $value["articletitle"]), "content" => str_replace(array("您", "账号", "账户"), array("你", "帐号", "帐户"), $value["content"]), "smalltext" => str_replace(array("您", "账号", "账户"), array("你", "帐号", "帐户"), $value["smalltext"]));
            $onlineObj->update("update gcbuyer.com_article set articletitle = '" . $updateArr["articletitle"] . "', content = '" . $updateArr["content"] . "', smalltext = '" . $updateArr["smalltext"] . "' where id = '" . $value["id"] . "'");
        } else {
            continue;
        }
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'root', 'gc7232275', 'gckeyword'));
Example #13
0
<?php

/**
 * 打入相关关键词预热脚本
 */
$id = 46607377;
$config = array('172.17.16.101', 11300);
$queue = new \Phalcon\Queue\Beanstalk(array("host" => $config[0], "port" => $config[1]));
$conn = new Table("txonline");
$keywordRs = $conn->findAll("select id, keyword from gckeyword.key_proword where id >=46607318 and id <= 46607375 limit 100");
foreach ($keywordRs as $value) {
    echo $value["id"] . "\n";
    try {
        $queue->choose('v3www_prokeyword_rela');
        echo $queue->put($value["id"], array('priority' => 1024, 'delay' => 0, 'ttr' => 86400)), "\n";
    } catch (\Exception $e) {
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('55651c3e54ae6.sh.cdb.myqcloud.com', 'cdb_outerroot', 'ScIwH*3fEB(', 'cn_clubnew', 8287), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
}
class Table
{
    public $conn = '';
    public $config;
    public function __construct($connName)
    {
        $db = Config::$dbArr;
        $this->config = $db[$connName];
Example #14
0
<?php

/**
 * 清除掉社区采集的问答
 */
$clubObj = new Table("club");
$id = 1143160;
$fids = array(155, 156, 157, 158);
while (1) {
    $mysqlRs = $clubObj->findAll("select * from pre_forum_thread where tid > '{$id}' order by tid asc limit 100");
    if (empty($mysqlRs)) {
        exit("所有数据处理完毕!");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["tid"];
        echo $id . "\n";
        if (!in_array($value["fid"], $fids)) {
            continue;
        }
        if ($value["authorid"] != "2563479") {
            continue;
        }
        var_dump($value);
        echo "\n";
        $clubObj->query("delete from pre_forum_thread where tid = '" . $value["tid"] . "'");
    }
}
class Config
{
    public static $dbArr = array('localhost' => array('192.168.12.70', "root", "123456", "test"), 'online' => array('192.168.2.163', "gongchangdb", "gongchangdb7232275", "caijiproductinfo"), 'info' => array('192.168.2.101', 'hangye', 'hangye7232275', 'hangye'), 'local' => array('192.168.8.18', 'root', 'gc7232275', 'gcoperate'), "local170" => array('192.168.8.170', "root", "gc7232275", "test"), 'local189' => array('192.168.8.189', 'gongchang', 'gongchang123', 'gckeyword'), 'main' => array('read.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), 'maind' => array('write.mysql.ch.gongchang.com', 'gcwork', 'gcwork7232275', 'catesearch'), "product" => array("pdinfo.read.mysql.ch.gongchang.com", "gccontent", "gccontent7232275", "caijiproductinfo"), 'club' => array('172.17.18.2', 'root', 'gc7232275', 'cn_clubnew', 3306), 'txonline' => array('172.17.18.4', 'gckeyword', 'WVwVaxADjX9z3PHd', 'gckeyword'));
    public static $cateApiUrl = 'http://cate.ch.gongchang.com/cate_json/';
Example #15
0
<?php

/**
 * 企业详情seo需要打入队列处理数据
 */
define("APP_DEV", "dev");
if (APP_DEV == 'dev') {
    $cfg = array('host' => '192.168.8.18', 'port' => '5672', 'login' => 'admin', 'password' => 'gc7232275', 'vhost' => '/');
    $txonline = new Table("local189");
} else {
    $cfg = array('host' => '172.17.16.108', 'port' => '5672', 'login' => 'admin', 'password' => 'gc7232275', 'vhost' => '/');
    $txonline = new Table("txonline");
}
$id = 0;
while (1) {
    $mysqlRs = $txonline->findAll("select cid,province from combusiness.cb_combusiness where cid > '{$id}' order by cid asc limit 100");
    if (empty($mysqlRs)) {
        exit("所有数据处理完毕\n");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["cid"];
        echo getComUrl($value["cid"], $value["province"]);
        writeRMQ("v3cb", "hy", $id);
        echo $id, "\n";
    }
}
function getComUrl($cid, $pid)
{
    return "http://company.gongchang.com/p-{$pid}/{$cid}_" . getCombusAuth($cid) . '/';
}
function getCombusAuth($cid)
Example #16
0
<?php

/**
 * 拉取测试环境所有的产品到本地用于测试
 * @author tianyunchong
 * @datetime 2016/05/25
 */
ini_set('magic_quotes_gpc', "1");
include_once "../common.php";
$conn = new Table("forbuyers-test");
$connLocal = new Table("local198");
$cid = 1;
while (1) {
    $companyArr = $conn->findAll("select * from fbsupplier.fb_company where cid > '" . $cid . "' limit 100");
    if (empty($companyArr)) {
        break;
    }
    foreach ($companyArr as $value) {
        $cid = $value["cid"];
        $existArr = $connLocal->findOne("select * from fbsupplier.fb_company where cid = '" . $cid . "' limit 1");
        if ($existArr) {
            continue;
        }
        $value["comdesc"] = addslashes($value["comdesc"]);
        $value["cncomname"] = addslashes($value["cncomname"]);
        $value["encomname"] = addslashes($value["encomname"]);
        $value["address"] = addslashes($value["address"]);
        $value["tmpaddress"] = addslashes($value["tmpaddress"]);
        $value["promain"] = addslashes($value["promain"]);
        $connLocal->insert($value, "fbsupplier.fb_company");
        echo $cid . "\t" . $value["encomname"] . "\n";
Example #17
0
$postData["passwd"] = $m->encrypt($md, 'hex');
$header = array();
$header[] = "serveToken:" . microtime(1);
$header[] = "apiKey:1kg8tunzfxt8zvzpf53vjr5es45lvszh";
$str = curlPost($api, $header, $postData);
if (!isset($str["accessToken"])) {
    exit("用户登录验证失败!\n");
} else {
    echo "用户登录验证成功!\n";
}
$header[] = "accessToken:" . $str["accessToken"];
$header[] = "sessionToken:" . $str["sessionToken"];
/** 循环读取每个单元格的数据 */
$id = 0;
while (1) {
    $mysqlRs = $conn->findAll("select * from tianyunzi.360_keywords where id > '{$id}' order by id asc limit 100");
    if (empty($mysqlRs)) {
        exit("所有的关键词处理完毕\n");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        if (!strstr($value["oldUrl"], "gongchang.com")) {
            echo "======关键词[" . $value["name"] . "]无需处理============\n";
            continue;
        }
        if ($value["oldUrl"] == $value["newUrl"]) {
            echo "======关键词[" . $value["name"] . "]链接未变化============\n";
            continue;
        }
        $api = "https://api.e.360.cn/2.0/keyword/update";
        $params = array("format" => "json", "keywords" => array());
Example #18
0
 /**
  * Returns an array of all items in a table.
  * @param string $tableName name of the table
  * @return array
  */
 final function items($tableName)
 {
     $table = new Table($tableName);
     return $table->findAll();
 }
Example #19
0
<?php

/**
 * 查询下产品关键词预热处理到了哪里
 */
$startid = $argv[1];
$endid = 10000000;
$id = $startid;
$onlineObj = new Table("txonline");
while (1) {
    $sql = "select id, keyword, relaword, relacateid, state from gckeyword.key_proword where id > '{$id}' order by id asc limit 100";
    echo $sql;
    echo "\n";
    $mysqlRs = $onlineObj->findAll($sql);
    if (empty($mysqlRs)) {
        exit("区间" . $startid . "-" . $endid . "处理完毕\n");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        if ($value["state"] < 0) {
            continue;
        }
        if ($value["relacateid"]) {
            continue;
        }
        recheck($id);
    }
}
function recheck($id)
{
    global $endid, $onlineObj;
Example #20
0
<?php

/**
 * 处理下部分关键词分词带+的情况
 */
$id = 0;
$beanstalk = new \Phalcon\Queue\Beanstalk(array("host" => "172.17.16.101", "port" => 11300));
$conn = new Table("txonline");
while (1) {
    echo $id;
    echo "\n";
    $mysqlRs = $conn->findAll("select id, keyword, redword from gckeyword.key_proword where id > '{$id}' order by id asc limit 100");
    if (empty($mysqlRs)) {
        exit("所有数据处理完毕!");
    }
    foreach ($mysqlRs as $value) {
        $id = $value["id"];
        if (!strstr($value["redword"], "+")) {
            continue;
        }
        echo $value["keyword"] . "\n";
        echo $value["redword"];
        echo "\n";
        $redword = str_replace("+", "", $value["redword"]);
        $redword = preg_replace("/[\\s]+/is", " ", $redword);
        echo $redword;
        echo "\n";
        $conn->update("update gckeyword.key_proword set redword = '" . $redword . "' where id = '" . $value["id"] . "'");
        try {
            $beanstalk->choose('v3www_prokeyword_cachewrite');
            echo $beanstalk->put($value["keyword"], array('priority' => 1024, 'delay' => 0, 'ttr' => 86400)), "\n";
Example #21
0
<?php

/**
 * 更新下百度关键词数据
 */
$id = 0;
while (1) {
    $conn = new Table("local189");
    $keywordArr = $conn->findAll("select * from tianyunzi.baidu_keywords where id > '{$id}' order by id asc limit 100");
    if (empty($keywordArr)) {
        echo "所有的关键词已经过完\n";
        exit;
    }
    foreach ($keywordArr as $value) {
        $id = $value["id"];
        if (!strstr($value["pcDestinationUrl"], "gongchang.com")) {
            continue;
        }
        if ($value["pcDestinationUrl"] == $value["newUrl"]) {
            continue;
        }
        $res = updateKeyword($value["id"], $value["newUrl"]);
        if ($res["header"]["desc"] == "success") {
            echo $value["keyword"] . " 更新成功\n";
            echo $value["newUrl"] . "\n";
        } else {
            echo "=======" . $value["keyword"] . " 更新失败=============\n";
        }
    }
    $conn->close();
}