Example #1
0
 public function view_ebayStatisticsExport()
 {
     $start = isset($_GET['start']) ? post_check($_GET['start']) : '';
     $end = isset($_GET['end']) ? post_check($_GET['end']) : '';
     $start = strtotime($start);
     $end = strtotime($end);
     //$start	= 1356972800;
     //$end	= 1399972800;
     $where = " where is_delete = 0";
     if ($start != '') {
         $where .= " and feedbacktime >= '{$start}' ";
     }
     if ($end != '') {
         $where .= " and feedbacktime <= '{$end}' ";
     }
     $accAct = new AccountAct();
     $accountList = $accAct->act_getAccountList('account', 'where platformId = 1 and is_delete = 0');
     $FBAct = new EbayFeedbackAct();
     $exporter = new ExportDataExcel("browser", "ebayStatistics_" . date('Y-m-d') . ".xls");
     $exporter->initialize();
     $exporter->addRow(array('eBay帐号', '好评数', '中评数', '差评数', '总评数', '好评率'));
     foreach ($accountList as $k => $v) {
         $account = $v['account'];
         $positive = $FBAct->act_getOrderList('count(*)', " {$where} and account='{$account}' and CommentType='Positive'");
         $positiveTotal = $positive[0]['count(*)'];
         $neutral = $FBAct->act_getOrderList('count(*)', " {$where} and account='{$account}' and CommentType='Neutral'");
         $neutralTotal = $neutral[0]['count(*)'];
         $negative = $FBAct->act_getOrderList('count(*)', " {$where} and account='{$account}' and CommentType='Negative'");
         $negativeTotal = $negative[0]['count(*)'];
         $total = $positiveTotal + $neutralTotal * 0.6 + $negativeTotal;
         $total = round_num($total, 1);
         if ($total != 0) {
             $per_positive = $positiveTotal / $total;
             $per_positive = round_num($per_positive * 100, 2);
             //$per_positive = round_num($positiveTotal * 100,2).'%';
         } else {
             $per_positive = 0;
         }
         $data = array($account, $positiveTotal, $neutralTotal, $negativeTotal, $total, $per_positive);
         $exporter->addRow($data);
     }
     $exporter->finalize();
     exit;
 }
if ($argc != 2) {
    exit("Usage: /usr/bin/php {$argv['0']} eBayAccount");
}
$startTime = strtotime(date('Y-m-d 08:00:00'));
$endTime = strtotime(date('Y-m-d 09:30:00'));
$nowTime = strtotime(date('Y-m-d H:i:s'));
if ($nowTime > $startTime && $nowTime < $endTime) {
    exit('此时间段不执行');
}
$ebay_account = trim($argv[1]);
global $devID, $appID, $certID, $serverUrl, $siteID, $detailLevel, $compatabilityLevel, $dbcon, $user;
$accAct = new AccountAct();
$accountInfo = $accAct->act_getAccountList('token', "where account = '{$ebay_account}' and is_delete = 0");
$token = $accountInfo[0]['token'];
$verb = 'GetFeedback';
$FBAct = new EbayFeedbackAct();
$info = $FBAct->act_getRequestChangeList('*', " where modifyStatus=0 and account='{$ebay_account}'");
$count1 = count($info);
for ($kk = 0; $kk < $count1; $kk++) {
    $id = $info[$kk]['id'];
    echo "-----update fb_request_change_ebay {$id}----\n";
    $ebay_userid = trim($info[$kk]['ebayUserId']);
    $where = " where account='{$ebay_account}' and CommentingUser ='******' and (CommentType='Neutral' or CommentType='Negative') ";
    $field = " FeedbackID,CommentText,CommentingUser,ItemID,TransactionID,CommentType ";
    $get_info = $FBAct->act_getOrderList($field, $where);
    $orderNum = count($get_info);
    for ($ii = 0; $ii < $orderNum; $ii++) {
        $status = "";
        $feedbackID = $get_info[$ii]['FeedbackID'];
        $commentingUser = $get_info[$ii]['CommentingUser'];
        $itemID = $get_info[$ii]['ItemID'];
Example #3
0
    function act_feedbackChangeMutilMessage()
    {
        include WEB_PATH . "lib/feedback/ebaylibrary/ebay_config.php";
        //print_r($_POST);//exit;
        $bills = isset($_POST['bill']) ? $_POST['bill'] : '';
        $content = isset($_POST['content']) ? $_POST['content'] : '';
        $content = htmlspecialchars($content);
        $content = str_replace("\\", "", $content);
        if ($bills == '' || $content == '') {
            self::$errCode = '001';
            self::$errMsg = "参数错误!";
            return false;
        }
        $accountArr = array();
        foreach ($bills as $bill) {
            $accountArr[] = $bill['account'];
        }
        $accountArr = array_unique($accountArr);
        $accountStr = implode("','", $accountArr);
        $accAct = new AccountAct();
        $accountInfo = $accAct->act_getAccountList('account,token', "where account in ('{$accountStr}') and is_delete = 0");
        $accountTokens = array();
        foreach ($accountInfo as $v) {
            $accountTokens[$v['account']] = $v['token'];
        }
        foreach ($bills as &$bill) {
            $bill['token'] = $accountTokens[$bill['account']];
            $where = " where account = '{$bill['account']}' and CommentingUser = '******'ebayUserId']}' limit 1";
            $lists = EbayFeedbackModel::getOrderList('itemID', $where);
            $bill['itemID'] = $lists[0]['itemID'];
        }
        //print_r($bills);exit;
        $verb = 'AddMemberMessageAAQToPartner';
        foreach ($bills as $bil) {
            //$feedbackid	= $bill['feedbackID'];
            $userid = $bil['ebayUserId'];
            $itemid = $bil['itemID'];
            $account = $bil['account'];
            $token = $bil['token'];
            $requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
			<AddMemberMessageAAQToPartnerRequest xmlns="urn:ebay:apis:eBLBaseComponents">
				<RequesterCredentials>
					<eBayAuthToken>' . $token . '</eBayAuthToken>
				</RequesterCredentials>
				<ItemID>' . $itemid . '</ItemID>
				<MemberMessage>
					<EmailCopyToSender>true</EmailCopyToSender>
					<Body>' . $content . '</Body>
					<QuestionType>General</QuestionType>
					<RecipientID>' . $userid . '</RecipientID>
				</MemberMessage>
			</AddMemberMessageAAQToPartnerRequest>';
            $session = new eBaySession($token, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
            //print_r($session);
            //continue;//exit;
            $responseXml = $session->sendHttpRequest($requestXmlBody);
            if (stristr($responseXml, 'HTTP 404') || $responseXml == '') {
                self::$errCode = '002';
                self::$errMsg = 'id not found';
                return false;
            }
            $data = XML_unserialize($responseXml);
            $ack = $data['AddMemberMessageAAQToPartnerResponse']['Ack'];
            $error = $data['AddMemberMessageAAQToPartnerResponse']['Errors']['LongMessage'];
            if ($ack != "Failure") {
                $data = array('reply_feedback' => $content);
                $where = " and FeedbackID='{$feedbackid}' ";
                EbayFeedbackModel::update($data, $where);
                return 'ok';
            } else {
                self::$errCode = '003';
                self::$errMsg = "批量Message失败!" . $error;
                return false;
            }
        }
    }
Example #4
0
function GetFeedback($account, $startpage, $endpage, $perPageCount)
{
    //require_once  WEB_PATH."lib/xmlhandle.php";
    global $dbcon, $api_feedback, $user;
    echo '同步feedback,开始于第' . $startpage . '页,结束于第' . $endpage . '页,每页同步' . $perPageCount . '条' . "\n";
    $hasmore = true;
    $status = "";
    $FBAct = new EbayFeedbackAct();
    while (true) {
        echo '开始运行,第' . $startpage . '页' . "\n";
        $responseXml = $api_feedback->request($startpage, $perPageCount);
        if (stristr($responseXml, 'HTTP 404') || $responseXml == '') {
            return 'id not found';
        }
        $data = XML_unserialize($responseXml);
        //var_dump($data);
        $ack = $data['GetFeedbackResponse']['Ack'];
        $TotalNumberOfPages = $data['GetFeedbackResponse']['PaginationResult']['TotalNumberOfPages'];
        if ($ack != "Success") {
            echo "<font color=red>评价加载失败</font>";
            //var_dump($data['GetFeedbackResponse']);exit;
        }
        $feedback = $data['GetFeedbackResponse']['FeedbackDetailArray']['FeedbackDetail'];
        foreach ($feedback as $li) {
            $CommentingUser = str_rep($li['CommentingUser']);
            $CommentingUserScore = str_rep($li['CommentingUserScore']);
            $CommentText = mysql_real_escape_string(str_rep($li['CommentText']));
            $CommentTime = str_rep($li['CommentTime']);
            $feedbacktime = date('Y-m-d H:i:s', strtotime($CommentTime));
            $feedbacktime = date('Y-m-d H:i:s', strtotime("{$feedbacktime} - 900 minutes"));
            $feedbacktime = strtotime($feedbacktime);
            $CommentType = str_rep($li['CommentType']);
            $ItemID = str_rep($li['ItemID']);
            $FeedbackID = str_rep($li['FeedbackID']);
            $TransactionID = $li['TransactionID'] ? $li['TransactionID'] : 0;
            $ItemTitle = str_rep($li['ItemTitle']);
            $currencyID = str_rep($li['ItemPrice attr']['currencyID']);
            $ItemPrice = str_rep($li['ItemPrice']);
            $data = array('CommentingUser' => $CommentingUser, 'account' => $account, 'CommentingUserScore' => $CommentingUserScore, 'CommentText' => $CommentText, 'CommentTime' => $CommentTime, 'CommentType' => $CommentType, 'ItemID' => $ItemID, 'FeedbackID' => $FeedbackID, 'TransactionID' => $TransactionID, 'ItemTitle' => $ItemTitle, 'currencyID' => $currencyID, 'ItemPrice' => $ItemPrice, 'feedbacktime' => $feedbacktime);
            $list = $FBAct->act_getOrderList('id', " where FeedbackID='{$FeedbackID}' ");
            if (!$list) {
                //不存在,则插入
                $ret = EbayFeedbackModel::insertRow($data);
                if ($ret) {
                    echo "insert success!\n";
                    $field = 'a.ebay_ordersn, a.ebay_paidtime, b.sku, b.ebay_amount';
                    $orderInfo = UserCacheModel::getErpOrderInfo($CommentingUser, $ItemID, $TransactionID, $field);
                    /* var_dump($orderInfo);
                    			exit; */
                    $ordersn = $orderInfo['data'][0]['ebay_ordersn'];
                    //订单号
                    $sku = $orderInfo['data'][0]['sku'];
                    //料号
                    $amount = $orderInfo['data'][0]['ebay_amount'];
                    //数量
                    $orderPayTime = $orderInfo['data'][0]['ebay_paidtime'];
                    //付款时间
                    $data = array('Qty' => $amount, 'sku' => $sku, 'orderPayTime' => $orderPayTime);
                    EbayFeedbackModel::update($data, " and FeedbackID = '{$FeedbackID}'");
                    UserCacheModel::updateErpOrderInfoFeedback($ordersn, $ItemID, $TransactionID, $CommentType);
                } else {
                    echo "insert failed!\n";
                }
            } else {
                echo "Exsited!\n";
            }
        }
        if ($startpage >= $endpage) {
            break;
        }
        $startpage++;
    }
}
Example #5
0
 public function view_ebayFeedbackRequestChange()
 {
     $account = isset($_GET['account']) ? post_check($_GET['account']) : '';
     $ebayUserId = isset($_GET['ebayUserId']) ? post_check($_GET['ebayUserId']) : '';
     $modify_status = isset($_GET['modify_status']) ? post_check($_GET['modify_status']) : '';
     $add_start_time = isset($_GET['add_start_time']) ? post_check($_GET['add_start_time']) : '';
     $add_end_time = isset($_GET['add_end_time']) ? post_check($_GET['add_end_time']) : '';
     $this->smarty->assign('account', $account);
     $this->smarty->assign('ebayUserId', $ebayUserId);
     $this->smarty->assign('modify_status', $modify_status);
     $this->smarty->assign('add_start_time', $add_start_time);
     $this->smarty->assign('add_end_time', $add_end_time);
     $where = 'where is_delete = 0';
     if ($account != '') {
         $where .= " and account = '{$account}'";
     }
     if ($ebayUserId != '') {
         $where .= " and ebayUserId = '{$ebayUserId}'";
     }
     if ($modify_status != '') {
         $where .= " and modifyStatus = '{$modify_status}'";
     }
     if ($add_start_time != '') {
         $where .= " and addTime >= '" . strtotime($add_start_time) . "'";
     }
     if ($add_end_time != '') {
         $where .= " and addTime <= '" . strtotime($add_end_time) . "'";
     }
     $FBAct = new EbayFeedbackAct();
     $total = $FBAct->act_getRequestChangeNum($where);
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     $where .= " order by id desc " . $page->limit;
     $fbkList = $FBAct->act_getRequestChangeList('*', $where);
     if (!empty($_GET['page'])) {
         if (intval($_GET['page']) <= 1 || intval($_GET['page']) > ceil($total / $num)) {
             $n = 1;
         } else {
             $n = (intval($_GET['page']) - 1) * $num + 1;
         }
     } else {
         $n = 1;
     }
     if ($total > $num) {
         //输出分页显示
         $show_page = $page->fpage(array(0, 2, 3, 4, 5, 6, 7, 8, 9));
     } else {
         $show_page = $page->fpage(array(0, 2, 3));
     }
     $this->smarty->assign('show_page', $show_page);
     $this->smarty->assign('fbkList', $fbkList);
     $accAct = new AccountAct();
     $accountList = $accAct->act_getAccountList('id,account', 'where platformId = 1 and is_delete = 0');
     $this->smarty->assign('accountList', $accountList);
     $this->smarty->assign('state', $state);
     $this->smarty->assign('secnev', '1');
     //二级导航
     $this->smarty->assign('module', 'SKU等待领取');
     $this->smarty->assign('username', $_SESSION['userName']);
     //$navarr = array("<a href='index.php?mod=FeedbackManage&act=fbkList'>卖家评价</a>",">>","评价列表");
     //$this->smarty->assign('navarr',$navarr);
     $this->smarty->display('ebayFeedbackRequestChange.htm');
 }
$user = '******';
$_SESSION['user'] = $user;
error_reporting(0);
require_once 'config1.php';
require_once 'ebay_order_cron_config.php';
require_once 'ebaylibrary/eBaySession.php';
if ($argc != 3) {
    exit("Usage: /usr/bin/php {$argv['0']} eBayAccount userid");
}
$ebay_account = trim($argv[1]);
$userid = trim($argv[2]);
global $devID, $appID, $certID, $serverUrl, $siteID, $detailLevel, $compatabilityLevel, $dbcon, $user;
$accAct = new AccountAct();
$accountInfo = $accAct->act_getAccountList('token', "where account = '{$ebay_account}' and is_delete = 0");
$token = $accountInfo[0]['token'];
$FBAct = new EbayFeedbackAct();
$info = $FBAct->act_getRequestChangeList('*', " where modifyStatus=0 and ebayUserId='{$userid}'");
$count1 = count($info);
$verb = 'GetFeedback';
for ($kk = 0; $kk < $count1; $kk++) {
    $id = $info[$kk]['id'];
    $ebay_userid = $info[$kk]['ebayUserId'];
    $ebay_account = $info[$kk]['account'];
    $where = " where account='{$ebay_account}' and CommentingUser ='******' and (CommentType='Neutral' or CommentType='Negative') ";
    $field = " FeedbackID,CommentText,CommentingUser,ItemID,TransactionID,CommentType ";
    $get_info = $FBAct->act_getOrderList($field, $where);
    $orderNum = count($get_info);
    for ($ii = 0; $ii < $orderNum; $ii++) {
        $status = "";
        $feedbackID = $get_info[$ii]['FeedbackID'];
        $commentingUser = $get_info[$ii]['CommentingUser'];