示例#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;
 }
示例#2
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++;
    }
}
$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'];
        $transactionID = $get_info[$ii]['TransactionID'];
        $commentType = $get_info[$ii]['CommentType'];
        $commentText = $get_info[$ii]['CommentText'];
        $requestXmlBody = '<?xml version="1.0" encoding="utf-8"?> 
								<GetFeedbackRequest xmlns="urn:ebay:apis:eBLBaseComponents"> 
									<RequesterCredentials> 
										<eBayAuthToken>' . $token . '</eBayAuthToken> 
									</RequesterCredentials>
									<ItemID>' . $itemID . '</ItemID>
示例#4
0
 public function view_ebayFeedbackManage()
 {
     $userId = isset($_GET['userId']) ? post_check($_GET['userId']) : '';
     $sku = isset($_GET['sku']) ? post_check($_GET['sku']) : '';
     $latest_type = isset($_GET['latest_type']) ? post_check($_GET['latest_type']) : '';
     $original_type = isset($_GET['original_type']) ? post_check($_GET['original_type']) : '';
     $account = isset($_GET['account']) ? post_check($_GET['account']) : '';
     $sort_type = isset($_GET['sort_type']) ? post_check($_GET['sort_type']) : '1';
     $start_time = isset($_GET['start_time']) ? post_check($_GET['start_time']) : '';
     $end_time = isset($_GET['end_time']) ? post_check($_GET['end_time']) : '';
     $feedbackReasonId = isset($_GET['feedbackReasonId']) ? post_check($_GET['feedbackReasonId']) : '';
     $this->smarty->assign('userId', $userId);
     $this->smarty->assign('sku', $sku);
     $this->smarty->assign('latest_type', $latest_type);
     $this->smarty->assign('original_type', $original_type);
     $this->smarty->assign('account', $account);
     $this->smarty->assign('sort_type', $sort_type);
     $this->smarty->assign('start_time', $start_time);
     $this->smarty->assign('end_time', $end_time);
     $this->smarty->assign('feedbackReasonId', $feedbackReasonId);
     $where = 'where is_delete = 0';
     if ($start_time != '') {
         $where .= " and feedbacktime >= '" . strtotime($start_time . '00:00:00') . "'";
     }
     if ($end_time != '') {
         $where .= " and feedbacktime <= '" . strtotime($end_time . '23:59:59') . "'";
     }
     if ($account != '') {
         $where .= " and account = '{$account}'";
     }
     if ($sku != '') {
         $where .= " and sku = '{$sku}'";
     }
     if ($userId != '') {
         $where .= " and CommentingUser = '******'";
     }
     if ($feedbackReasonId != '') {
         $where .= " and reasonId = '{$feedbackReasonId}'";
     }
     if ($original_type != '') {
         if ($original_type == "Neutral") {
             if ($latest_type != '') {
                 if ($latest_type == "Positive") {
                     $where .= " and status='21'";
                 } else {
                     if ($latest_type == "Negative") {
                         $where .= " and status='23'";
                     } else {
                         if ($latest_type == "Neutral") {
                             $where .= " and CommentType='Neutral' and status!='32'";
                         }
                     }
                 }
             } else {
                 $where .= " and (CommentType='Neutral' and status !='32' or status='21')";
             }
         } else {
             if ($original_type == "Negative") {
                 if ($latest_type != '') {
                     if ($latest_type == "Positive") {
                         $where .= " and status='31'";
                     } else {
                         if ($latest_type == "Neutral") {
                             $where .= " and status='32'";
                         } else {
                             if ($latest_type == "Negative") {
                                 $where .= " and CommentType='Negative'";
                             }
                         }
                     }
                 } else {
                     $where .= " and (CommentType='Negative' or status='31' or status='32')";
                 }
             }
         }
     }
     $FBAct = new EbayFeedbackAct();
     $total = $FBAct->act_getOrderNum($where);
     $num = 50;
     //每页显示的个数
     $page = new Page($total, $num, '', 'CN');
     if ($sort_type != '1') {
         $where .= " order by feedbacktime asc " . $page->limit;
     } else {
         $where .= " order by feedbacktime desc " . $page->limit;
     }
     //echo $where;
     $fbkList = $FBAct->act_getOrderList('*', $where);
     //var_dump($fbkList[0]);
     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);
     $reasonList = $FBAct->act_getEbayReasonCategoryInfo('*', '');
     $this->smarty->assign('reasonList', $reasonList);
     $this->smarty->assign('state', $state);
     $this->smarty->assign('secnev', '1');
     //二级导航
     $this->smarty->assign('module', 'SKU等待领取');
     $this->smarty->assign('username', $_SESSION['userName']);
     $this->smarty->display('ebayFeedbackManage.htm');
 }