Esempio n. 1
0
 public function view_ebayUpdateExport()
 {
     $start = isset($_GET['start']) ? post_check($_GET['start']) : '';
     $end = isset($_GET['end']) ? post_check($_GET['end']) : '';
     $account = isset($_GET['account']) ? post_check($_GET['account']) : '';
     if (!empty($start) && !empty($end)) {
         $start = strtotime($start);
         $end = strtotime($end);
         $wheretime = " and feedbacktime>'{$start}' and feedbacktime<'{$end}' ";
     } else {
         $wheretime = '';
     }
     if (!empty($account)) {
         $whereacc = "and account='{$account}' ";
     } else {
         $whereacc = "";
     }
     $select = " account, CommentingUser, ItemID, CommentType, status, feedbacktime ";
     $where = " where 1 {$whereacc} {$wheretime}";
     $upList = EbayFeedbackModel::getOrderList($select, $where);
     $exporter = new ExportDataExcel("browser", "ebayUpdate_" . date('Y-m-d') . ".xls");
     $exporter->initialize();
     $exporter->addRow(array('eBay帐号', '买家ID', 'itemId', '原始评价类型', '留评价日期', '添加请求日期'));
     foreach ($upList as $value) {
         $account = $value['account'];
         $CommentingUser = $value['CommentingUser'];
         $ItemID = $value['ItemID'];
         $CommentType = $value['CommentType'];
         $status = $value['status'];
         $feedbacktime = date("Y-m-d", $value['feedbacktime']);
         $select = " addTime ";
         $where = " where account='{$account}' and ebayUserId='{$CommentingUser}' ";
         $addTime = OmAvailableModel::getTNameList("fb_request_change_ebay", $select, $where);
         $addTime = $addTime[0]['addTime'];
         if (!empty($addTime)) {
             $addTime = date("Y-m-d", $addTime);
         } else {
             $addTime = "";
         }
         $des = NULL;
         if ($status == 0) {
             if ($CommentType == 'Negative') {
                 $des = '差评';
             } elseif ($CommentType == 'Neutral') {
                 $des = '中评';
             }
         } elseif ($status == '21') {
             $des = '中评';
         } elseif ($status == '31') {
             $des = '差评';
         }
         if (!empty($des)) {
             $data = array($account, $CommentingUser, $ItemID, $des, $feedbacktime, $addTime);
             $exporter->addRow($data);
         } else {
             continue;
         }
     }
     exit;
     $exporter->finalize();
     exit;
 }
Esempio n. 2
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;
            }
        }
    }