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; }
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; } } }
date_default_timezone_set('Asia/Shanghai'); require_once "scripts.comm.php"; require_once "config1.php"; 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 = "";
public function view_ebayFeedbackExport() { $starttime = date('Y-m-d ') . ' 00:00:00'; $endtime = date('Y-m-d ') . ' 23:59:59'; $this->smarty->assign('product_start_time', $starttime); $this->smarty->assign('product_end_time', $endtime); $this->smarty->assign('ebaySale_start_time', $starttime); $this->smarty->assign('ebaySale_end_time', $endtime); $this->smarty->assign('neutral_start_time', $starttime); $this->smarty->assign('neutral_end_time', $endtime); $this->smarty->assign('negative_start_time', $starttime); $this->smarty->assign('negative_end_time', $endtime); $this->smarty->assign('service_start_time', $starttime); $this->smarty->assign('service_end_time', $endtime); $this->smarty->assign('ebayStatistics_start_time', $starttime); $this->smarty->assign('ebayStatistics_end_time', $endtime); $accAct = new AccountAct(); $accountList = $accAct->act_getAccountList('id,account', 'where platformId = 1 and is_delete = 0'); $this->smarty->assign('accountList', $accountList); $this->smarty->assign('secnev', '1'); //二级导航 $this->smarty->assign('username', $_SESSION['userName']); $this->smarty->display('exportXls.htm'); }