Example #1
0
/**
 * 用户信息转移
 * @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 #2
0
<?php

/**
 * 将部分违禁关键词的is_select标记为0
 */
$file = "keyword.txt";
$fp = fopen($file, "r");
$conn = new Table("txonline");
while (!feof($fp)) {
    $line = fgets($fp);
    $keyword = trim($line);
    if (empty($keyword)) {
        continue;
    }
    $keywordRs = $conn->findOne("select id, keyword from gckeyword.key_proword where keyword = '{$keyword}' limit 1");
    if (empty($keywordRs)) {
        continue;
    }
    echo $keyword . "\n";
    $conn->update("update gckeyword.key_proword set is_select = 0 where id = '" . $keywordRs["id"] . "'");
}
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)
Example #3
0
<?php

/**
 * 国际站分类查询
 * User: zhangyanghua
 * Date: 16/4/19
 * Time: 下午2:02
 */
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
{
Example #4
0
/**
 * 拉取测试环境所有的产品到本地用于测试
 * @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 #5
0
<?php

/**
 * 产品信息转移
 */
$conn18 = new Table("local");
$conn198 = new Table("local198");
/** 转移一个企业的所有的产品信息到采集forbuyers产品库 */
$uid = 22118;
/** 开查下用户信息 */
$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) {
Example #6
0
<?php

/**
 * 临时转化下关键词
 */
$tableObj = new Table("txonline");
$f = fopen("guanjianci.txt", "r") or die("文件打开失败");
$wlog = "guanjianci_new.txt";
while (!feof($f)) {
    $line = trim(fgets($f));
    if (empty($line)) {
        continue;
    }
    $keyword = $line;
    $keywordRs = $tableObj->findOne("select id, keyword, cate3 from gckeyword.key_proword where keyword = '" . $keyword . "' limit 1");
    if (empty($keywordRs)) {
        file_put_contents($wlog, $keyword . "\t" . getSeachUrl($keyword) . "\t无法在关键词库查到\n", FILE_APPEND);
        continue;
    }
    if (empty($keywordRs["cate3"])) {
        file_put_contents($wlog, $keyword . "\t" . getSeachUrl($keyword) . "\t暂时没有归属cate\n", FILE_APPEND);
        continue;
    }
    $cateRs = $tableObj->findOne("select cateid, catename from gccateinfo.cate_cateinfo where cateid = '" . $keywordRs["cate3"] . "' limit 1");
    file_put_contents($wlog, $keyword . "\t" . getSeachUrl($keyword) . "\t" . $cateRs["catename"] . "\t" . $cateRs["cateid"] . "\n", FILE_APPEND);
}
function getSeachUrl($keyword)
{
    return "http://product.gongchang.com/sp?wd=" . $keyword;
}
class Config
Example #7
0
/**
 * 产品信息索引信息入库
 */
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
 * @DateTime 2016-05-26T08:31:23+0800
Example #8
0
<?php

/**
 * 获取新分类的一些信息
 */
$cateid = isset($_GET["cateid"]) ? intval($_GET["cateid"]) : 0;
if (empty($cateid)) {
    output("未知的分类");
}
$conn = new Table("local189");
$cateArr = $conn->findOne("select cateid, catename, level from forbuyscateinfo.fbcate_cateinfo where cateid = '" . $cateid . "' limit 1");
if (empty($cateArr)) {
    output("未获取到该分类");
}
$childArr = getAllChildCate($cateid);
output($childArr);
function output($arr)
{
    $arr = array("message" => $arr, "status" => false);
    echo json_encode($arr);
    exit;
}
/**
 * 获取所有的字分类信息
 *
 * @Author   tianyunzi
 * @DateTime 2016-01-27T13:37:22+0800
 * @return   [type]                   [description]
 */
function getAllChildCate($cateid)
{
Example #9
0
$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");
    if (empty($keywordRs)) {
        echo "=============未知的关键词" . $keyword . "==============\n";
        continue;
    }
    updateKeyword($keywordRs["id"], $url);