Esempio n. 1
0
    public function view_fetchAliOrderDetailByOrderId()
    {
        $orderid = isset($_GET['orid']) ? trim($_GET['orid']) : FALSE;
        $account = isset($_GET['account']) ? trim($_GET['account']) : FALSE;
        $receiverid = $account;
        if (empty($receiverid)) {
            $returndata['errCode'] = 3;
            $returndata['errMsg'] = '缺少卖家账号!';
            echo json_encode($returndata);
            exit;
        }
        if (empty($orderid)) {
            //订单号不存在
            $returndata['errCode'] = 3;
            $returndata['errMsg'] = '缺少订单号!';
            echo json_encode($returndata);
            exit;
        }
        $tokenfilepath = WEB_PATH . "lib/ali_keys/config_{$receiverid}.php";
        if (!file_exists($tokenfilepath)) {
            $returndata['errCode'] = 2;
            $returndata['errMsg'] = '没找到messsage信息!';
            echo json_encode($returndata);
            exit;
        }
        include_once '' . $tokenfilepath;
        include_once WEB_PATH . 'lib/AliMessage.class.php';
        $ali_obj = new AliMessage();
        $ali_obj->setConfig($appKey, $appSecret, $refresh_token);
        $ali_obj->doInit();
        //$orderid = '60637623549259';
        $detail = $ali_obj->fetchOrderdetail($orderid);
        if ($detail == FALSE) {
            //获取消息失败
            $returndata['errCode'] = 4;
            $returndata['errMsg'] = '获取订单详情失败!';
            echo json_encode($returndata);
            exit;
        }
        //print_r($detail);exit;
        $alimsg_obj = new AliOderMessageModel();
        $time = $detail['gmtCreate'];
        $year = substr($time, 0, 4);
        //年
        $month = substr($time, 4, 2);
        //月
        $day = substr($time, 6, 2);
        //日
        $time = $month . '/' . $day . '/' . $year;
        $timeend = $month . '/' . (intval($day) + 1) . '/' . $year;
        $skustr = '';
        foreach ($detail['childOrderList'] as $sku) {
            $skucode = substr($sku['skuCode'], 0, strlen($sku['skuCode']) - 1);
            $tmpstr = $skucode;
            $hstr = strrchr($tmpstr, '*');
            //处理组合料号
            $tmpstr = $hstr === FALSE ? $tmpstr : ltrim($hstr, '*');
            $spu = explode('_', $tmpstr);
            $spu = $spu[0];
            $attr = json_decode($sku[productAttributes], TRUE);
            $skuimgurl = getSkuImg($spu, $tmpstr, 'G');
            $attrinfo = json_decode($sku['productAttributes'], TRUE);
            $attrstr = array();
            if (isset($sku['productAttributes']) && !empty($attrinfo['sku'])) {
                foreach ($attrinfo['sku'] as $attrval) {
                    $attrstr[] = $attrval['pName'] . ':' . $attrval['pValue'];
                }
            }
            $attrstr = implode('<br>', $attrstr);
            $skustr .= <<<EOF
\t\t\t\t<tr>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t<img src="{$skuimgurl}" width="50" height="50">
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td align="left">
\t\t\t\t\t\t<a href="http://www.aliexpress.com/item/something/{$sku['productId']}.html" target="_blank">{$sku['productName']}</a>
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t          {$attrstr}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t        {$skucode}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t        {$sku['productCount']}
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t           {$sku[productPrice][currency][symbol]}{$sku[productPrice][amount]}
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
EOF;
        }
        $skulist = <<<EOF
\t\t\t\t\t<tr class="title">
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t图片
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t标题
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td style="width:60px;">
\t\t\t\t\t\t\t属性
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\tSKU
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td style="width:60px;">
\t\t\t\t\t\t\t数量
\t\t\t\t\t\t</td>
\t\t\t\t\t\t<td>
\t\t\t\t\t\t\t单价
\t\t\t\t\t\t</td>
\t\t\t\t\t</tr>
                    {$skustr}
EOF;
        //计算倒计时
        $timeStr = '';
        if ($detail['orderStatus'] == 'RISK_CONTROL') {
            //计算风控倒计时
            $paytimestamp = aliTranslateTime($detail['gmtPaySuccess']);
            //付款时间戳
            $riskendtime = $paytimestamp + 86400;
            $timeStr = date('m/d/Y H:i:s', $riskendtime);
            //风控结束时间字符串表示
            $timeStr = $riskendtime;
        } elseif ($detail['logisticsStatus'] == 'SELLER_SEND_GOODS' && $detail['orderStatus'] != 'FINISH') {
            $sendTimeStamp = aliTranslateTime($detail['logisticInfoList'][0]['gmtSend']);
            //发货时间戳
            $days = $alimsg_obj->culculateCountdown($receiverid, $detail['logisticInfoList'][0]['logisticsTypeCode'], $detail['receiptAddress']['country']);
            if ($days === FALSE) {
                $timeStr = AliOderMessageModel::$errMsg;
            } else {
                $endtime = $sendTimeStamp + $days * 86400;
                $timeStr = $endtime;
            }
        }
        //物流信息
        $shipstr = '';
        if (isset($detail['logisticInfoList'][0])) {
            $shipstr .= '运输方式:' . $detail['logisticInfoList'][0]['logisticsTypeCode'] . '<br>';
            $carrier = $detail['logisticInfoList'][0]['logisticsTypeCode'];
            $tracksn = $detail['logisticInfoList'][0]['logisticsNo'];
            $trackstr = <<<EOF
            <a href="javascript:queryExpressInfo('aliexpress', '{$carrier}', '{$tracksn}', 'zh')">{$tracksn}</a>
EOF;
            $shipstr .= '跟踪号:' . $trackstr . '<br>';
        }
        $returndata['errCode'] = 5;
        $returndata['errMsg'] = '成功!';
        $returndata['data'] = array('buyer' => $detail['buyerInfo']['firstName'] . $detail['buyerInfo']['lastName'], 'seller' => $detail['sellerOperatorLoginId'], 'orderId' => $orderid, 'createtime' => formateAliTime($detail['gmtCreate']), 'paytime' => !empty($detail['gmtPaySuccess']) ? formateAliTime($detail['gmtPaySuccess']) : '未付款', 'initOderAmount' => $detail['initOderAmount']['currency']['symbol'] . $detail['initOderAmount']['amount'], 'OderAmount' => $detail['orderAmount']['currency']['symbol'] . $detail['orderAmount']['amount'], 'paytype' => '-----', 'fundStatus' => $this->status2str($detail['fundStatus']), 'loanStatus' => $this->status2str($detail['loanStatus']), 'issueStatus' => $this->status2str($detail['issueStatus']), 'issuscolor' => $detail['issueStatus'] == 'NO_ISSUE' ? 'green' : 'red', 'orderstatus' => $this->status2str($detail['orderStatus']), 'logisticsStatus' => $this->status2str($detail['logisticsStatus']), 'logisticsMoney' => $detail['logisticsAmount']['amount'], 'mobileNo' => $detail['receiptAddress']['mobileNo'], 'phoneNumber' => $detail['receiptAddress']['phoneArea'] . '-' . $detail['receiptAddress']['phoneNumber'], 'address' => $detail['receiptAddress']['detailAddress'] . ' ' . $detail['receiptAddress']['city'] . ' ' . $detail['receiptAddress']['province'] . ' ' . $detail['receiptAddress']['country'], 'skulist' => $skulist, 'refund' => isset($detail['refundInfo']) ? '退款状态' . $detail['refundInfo']['refundStatus'] . '<br>' . '退款类型' . $detail['refundInfo']['refundType'] : '', 'logisticInfo' => $shipstr, 'buyerSignerFullname' => isset($detail['buyerSignerFullname']) ? $detail['buyerSignerFullname'] : '', 'zip' => isset($detail['receiptAddress']['zip']) ? $detail['receiptAddress']['zip'] : '', 'email' => isset($detail['buyerInfo']['email']) ? $detail['buyerInfo']['email'] : '', 'timestr' => $timeStr, 'commission' => '$' . round($detail['orderAmount']['amount'] * 0.05, 2), 'profit' => '$' . round($detail['orderAmount']['amount'] * 0.95, 2));
        if (isset($detail['logisticInfoList'][0]['gmtSend'])) {
            $timeinfo = extractAliTimeInfo($detail['logisticInfoList'][0]['gmtSend']);
            $returndata['data']['shippedtime'] = $timeinfo['year'] . '-' . $timeinfo['month'] . '-' . $timeinfo['day'] . ' ' . $timeinfo['hour'] . ':' . $timeinfo['minit'] . ':' . $timeinfo['second'];
        } else {
            $returndata['data']['shippedtime'] = '';
        }
        $accountname = aliAccountf2Name($detail['sellerOperatorLoginId']);
        if ($accountname == FALSE) {
            //没找到对应关系
            $accountname == '';
        }
        $accountname = aliAccountf2Name($account);
        if ($accountname == FALSE) {
            //没找到对应关系
            $accountname == '';
        }
        $result_sys = getOpenSysApi('aliExpressOrderInfo', array('type' => 'orderinfo', 'recordnumber' => $orderid, 'selleraccount' => $accountname));
        if (!empty($result_sys['data'])) {
            $returndata['data']['systemnum'] = $result_sys['data'][0]['ebay_id'];
            //系统编号
            $returndata['data']['syscarrer'] = $result_sys['data'][0]['ebay_carrier'];
            //运输方式
            $returndata['data']['systracknumber'] = $result_sys['data'][0]['ebay_tracknumber'];
            //跟踪号
            //     		$returndata['data']['shippedtime']    = empty($result_sys['data'][0]['ShippedTime']) ? '' : date('Y-m-d H:i:s', $result_sys['data'][0]['ShippedTime']);  //发货时间
            $returndata['data']['status'] = $result_sys['data'][0]['catename'];
            //发货状态
            $returndata['data']['ebay_note'] = $result_sys['data'][0]['note'];
            //订单留言
        } else {
            $returndata['data']['systemnum'] = '';
            //系统编号
            $returndata['data']['syscarrer'] = '';
            //运输方式
            $returndata['data']['systracknumber'] = '';
            //跟踪号
            //     	    $returndata['data']['shippedtime']    = '';                 //发货时间
            $returndata['data']['status'] = '';
            //发货状态
            $returndata['data']['ebay_note'] = '';
        }
        //             	print_r($returndata);exit;
        echo json_encode($returndata);
    }
Esempio n. 2
0
 public function getSupportedCarrier()
 {
     $result = getOpenSysApi('trans.track.carrier.name.get', array('id' => 1), 'http://idc.gw.open.valsun.cn/router/rest?');
     return $result;
 }
Esempio n. 3
0
    function view_getOderInfo()
    {
        $buyer = isset($_GET['buyer']) ? $_GET['buyer'] : FALSE;
        //买家账号
        $seller = isset($_GET['seller']) ? $_GET['seller'] : FALSE;
        //卖家账号
        $mid = isset($_GET['mid']) ? $_GET['mid'] : FALSE;
        if (${$buyer} === FALSE) {
            $data = array('errCode' => 10045, 'errMsg' => '缺少参数');
            echo json_encode($data);
            exit;
        }
        $buyer = urlencode($buyer);
        $result = getOpenSysApi(OPENGETORDER, array('type' => 'orderinfo', 'buyeraccount' => $buyer, 'selleraccount' => $seller));
        // print_r($result);exit;
        if ($result === FALSE) {
            //获取开发系统出错
            $data = array('errCode' => 10046, 'errMsg' => '访问出错!');
            echo json_encode($data);
            exit;
        }
        if (isset($result['data']['totalbuy'])) {
            unset($result['data']['totalbuy']);
        }
        if (isset($result['data']['totalnum'])) {
            unset($result['data']['totalnum']);
        }
        $historystr = '';
        //         print_r($result);exit;
        /* ----- 生成历史记录  -----*/
        $tbtitle = <<<EOF
                        <tr class="title">
                            <td>订单编号</td>
                            <td>买家账号</td>
                            <td>SKU</td>
                            <td>Itemid</td>
                            <td>数量</td>
                            <td>单价</td>
                            <td>总金额</td>
                            <td>订单状态</td>
                            <td>付款时间</td>
                            <td>发货时间</td>
                            <td>运输方式</td>
                            <td>跟踪号</td>
                            <td>评价</td>
                        </tr>
EOF;
        $default_addr = FALSE;
        $listInTwomonth = '';
        $listMoreTwomonth = '';
        $counter = 0;
        if (!empty($result['data'])) {
            foreach ($result['data'] as $value) {
                $counter++;
                // print_r($value);exit;
                $paytime = isset($value['ebay_paidtime']) && !empty($value['ebay_paidtime']) ? date('Y-m-d H:i:s', $value['ebay_paidtime']) : '';
                //付款日期
                $shiptime = isset($value['scantime']) && !empty($value['scantime']) ? date('Y-m-d H:i:s', $value['scantime']) : '';
                //发货日期
                $couny = isset($value['ebay_currency']) && !empty($value['ebay_currency']) ? $value['ebay_currency'] : '';
                //发货日期
                // echo $paytime;exit;
                $address = $value['ebay_username'] . ',&nbsp;' . $value['ebay_street'] . '&nbsp;' . $value['ebay_street1'] . '&nbsp;' . $value['ebay_city'] . '&nbsp;' . $value['ebay_state'] . ',&nbsp;' . $value['ebay_postcode'] . ',&nbsp;' . $value['ebay_countryname'];
                if ($default_addr === FALSE) {
                    $default_addr = $address;
                }
                $address = str_replace('"', '\\"', $address);
                $buyer_account = isset($value['ebay_userid']) ? $value['ebay_userid'] : '';
                //买家账号
                $money = isset($value['ebay_total']) ? $value['ebay_total'] : '';
                //金额
                $status = isset($value['ebay_status']) ? $value['ebay_status'] : '';
                //状态
                $tracknumber = isset($value['ebay_tracknumber']) ? $value['ebay_tracknumber'] : '';
                //跟踪号
                $catename = isset($value['catename']) ? $value['catename'] : '';
                //状态
                $orderid = isset($value['ebay_id']) ? $value['ebay_id'] : '';
                //订单号
                $carrier = isset($value['ebay_carrier']) ? $value['ebay_carrier'] : '';
                //运输方式
                if (!empty($tracknumber)) {
                    $trackstr = "\n                    <a href='javascript:void(0)'" . " onclick=queryExpressInfo('ebay','{$tracknumber}','zh','{$counter}')>{$tracknumber}</a>";
                }
                $skurow = '';
                if (isset($value['orderdetail'])) {
                    foreach ($value['orderdetail'] as $skuitem) {
                        switch (strtolower($skuitem['ebay_feedback'])) {
                            case 'positive':
                                $feedback = '<image src="images/positive.gif">';
                                break;
                            case 'neutral':
                                $feedback = '<image src="images/neutral.gif">';
                                break;
                            case 'negative':
                                $feedback = '<image src="images/negative.gif">';
                                break;
                            default:
                                $feedback = '';
                                break;
                        }
                        if (empty($listInTwomonth) || time() - $value['ebay_createdtime'] < 5184000) {
                            $listInTwomonth .= <<<EOF
                        \t<tr style="background-color:#ffffff">
                                <td>{$orderid}</td>
                                <td>{$buyer_account}</td>
                                <td>{$skuitem['sku']}</td>
                                <td><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item={$skuitem['ebay_itemid']}" target="_blank">{$skuitem['ebay_itemid']}</a></td>
                                <td>{$skuitem['ebay_amount']}</td>
                                <td>{$skuitem['ebay_itemprice']}</td>
                                <td>{$money}({$couny})</td>
                                <td>{$catename}</td>
                                <td>{$paytime}</td>
                                <td>{$shiptime}</td>
                                <td id="carrier_{$counter}">{$carrier}</td>
                                <td>{$trackstr}</td>
                                <td>{$feedback}</td>
                            </tr>
EOF;
                        } else {
                            $listMoreTwomonth .= <<<EOF
                        \t<tr style="background-color:#ffffff">
                                <td>{$orderid}</td>
                                <td>{$buyer_account}</td>
                                <td>{$skuitem['sku']}</td>
                                <td><a href="http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item={$skuitem['ebay_itemid']}" target="_blank">{$skuitem['ebay_itemid']}</a></td>
                                <td>{$skuitem['ebay_amount']}</td>
                                <td>{$skuitem['ebay_itemprice']}</td>
                                <td>{$money}({$couny})</td>
                                <td>{$catename}</td>
                                <td>{$paytime}</td>
                                <td>{$shiptime}</td>
                                <td id="carrier_{$counter}">{$carrier}</td>
                                <td>{$trackstr}</td>
                                <td>{$feedback}</td>
                            </tr>
EOF;
                        }
                    }
                }
            }
        }
        //         print_r($return);exit;
        $data = array('errCode' => 10047, 'errMsg' => 'OK', 'list1' => $tbtitle . $listInTwomonth, 'list2' => $listMoreTwomonth, 'title' => $tbtitle, 'defaddr' => $default_addr);
        echo json_encode($data);
        exit;
    }
Esempio n. 4
0
 /**
  * 根据ItemID检索买家订单数据
  * Enter description here ...
  * @param unknown_type $itemId
  */
 public function getBuyerInfo($itemId)
 {
     $result = getOpenSysApi('msg.getBuyerOrderInfoByItemId', array('itemId' => $itemId));
     if ($result === FALSE) {
         return false;
     } else {
         return $result;
     }
 }
Esempio n. 5
0
function process_message($msg)
{
    $dbalive = mysql_ping();
    if ($dbalive !== TRUE) {
        //数据库连接失效 重连
        echo "reconnecting DB ! \n";
    }
    global $remsg_obj, $msg_obj, $rm_obj, $remsgque_obj, $dbConn;
    $message_body = json_decode($msg->body, TRUE);
    if ($message_body == FALSE || !is_array($message_body) || !isset($message_body['id'])) {
        echo 'invalid message ! --- ' . $msg->body . "\n";
        return;
    }
    $id = $message_body['id'];
    $sql = "select * from msg_replyqueue where id={$id}  limit 1";
    $row = $dbConn->fetch_first($sql);
    if (empty($row)) {
        //没找到信息 直接return
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        //删除队列信息
        return;
    }
    $infor = unserialize($row['parameter']);
    // 反序列化其他扩展信息
    /*----- 根据账号来加载账号信息 -----*/
    $ebayaccount = $row['account'];
    //所属账号
    $token_file = WEB_PATH . "lib/ebaylibrary/keys/keys_" . $ebayaccount . ".php";
    if (!file_exists($token_file)) {
        echo formatetime() . '---' . $token_file . " does not exists!!! at code line--" . __LINE__ . "\n";
        // 密码文件不存在
        $remsgque_obj->delAQueueRecords($row['id']);
        //数据不对直接删除
        $msg_obj->updateMessageStatus(array($row['messageid']), 0);
        //重置message为0的状态
        $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
        //删除队列信息
        return;
        // 退出
    }
    include '' . $token_file;
    /*----- 导出为全局变量 ugly code -----*/
    $GLOBALS['siteID'] = $siteID;
    $GLOBALS['production'] = $production;
    $GLOBALS['compatabilityLevel'] = $compatabilityLevel;
    $GLOBALS['devID'] = $devID;
    $GLOBALS['appID'] = $appID;
    $GLOBALS['certID'] = $certID;
    $GLOBALS['serverUrl'] = $serverUrl;
    $GLOBALS['userToken'] = $userToken;
    /*----- 根据账号来加载账号信息 -----*/
    $msgid = $row['messageid'];
    //对应的message表的主键id
    if ($row['replytype'] == 1) {
        //带有回复内容的message回复
        $content = $row['retext'];
        //回复内容
        $copytosender = $infor['iscopy'];
        // 是否抄送 改值只能为0、1
        /*----- 推送回复到线上 -----*/
        $result = $rm_obj->replyMessage($msgid, $content, $copytosender);
        //回复 并返回结果
        if ($result == TRUE) {
            //执行成功则标记为已经读取
            $result = $rm_obj->markAsRead($msgid, 'Read');
            if (!$result) {
                echo ReplyMessageModel::$errMsg . " --- 回邮件发送成功, 标记已读失败!\n";
            }
        }
    } else {
        //只标及为回复状态 没有回复内容的
        /*----- 发送请求 -----*/
        $result = $rm_obj->markAsRead($msgid, 'Read');
    }
    if ($result == TRUE) {
        // 发送成功 删除该回复队列记录
        $remsgque_obj->delAQueueRecords($row['id']);
        $status = 2;
        // 默认为正常回复
        if ($row['replytype'] == 2) {
            //为标记回复
            $status = 3;
        }
        $msg_obj->updateMessageStatus(array($msgid), $status);
        //将message状态改为回复成功
        echo 'success!  ' . date('Y:m:d H:i:s', time()) . "\n";
    } else {
        // 发送失败
        echo date('Y-m-d H:i:s', time()) . '---' . __LINE__ . '---' . __FILE__ . '---' . ReplyMessageModel::$errMsg . "\n";
        $errcontent = ReplyMessageModel::$sendMsg;
        if (ReplyMessageModel::$sender != NULL) {
            $usrmod_obj = new GetLoacalUserModel();
            $userinfo = $usrmod_obj->getUserInfoBySysId(ReplyMessageModel::$sender);
            if (!empty($userinfo)) {
                /*发送邮件*/
                $result_sys = getOpenSysApi('notice.send.message', array('content' => $errcontent, 'from' => 'tuxinglong', 'to' => $userinfo['global_user_login_name'], 'type' => 'email'));
            }
        }
        $remsgque_obj->plusCountById($row['id']);
        // 将失败次数加一
    }
    //确认收到
    $msg->delivery_info['channel']->basic_ack($msg->delivery_info['delivery_tag']);
    //确认收到
    // Send a message with the string "quit" to cancel the consumer.
    if ($msg->body === 'quit') {
        $msg->delivery_info['channel']->basic_cancel($msg->delivery_info['consumer_tag']);
    }
}
Esempio n. 6
0
         $classid = -1;
     } else {
         $classid = $result[0]['id'];
     }
 }
 if (preg_match('/\\d{3}-\\d{7}-\\d{7}/', $subjet, $ordernum)) {
 } else {
     preg_match('/\\d{3}-\\d{7}-\\d{7}/', $body, $ordernum);
 }
 $ordernum = $ordernum[0];
 //通过订单号或者发件人邮箱获取买家和卖家信息
 echo "获取买家卖家信息中···\n";
 $email = $from;
 $buyer = '';
 $seller = '';
 $buyerandseller = getOpenSysApi(OPENGETAMAZONORDER, array('email' => $email, 'ordernumber' => $ordernum));
 print_r($buyerandseller);
 $buyer = $buyerandseller[0]['ebay_userid'];
 $seller = $buyerandseller[0]['ebay_account'];
 if (!preg_match('/<\\S+>/', $body)) {
     $body = "<pre>" . $body . "</pre>";
 }
 $mailinfo = array('message_id' => preg_split('/@/', $to)[0] . $message_id, 'recieveid' => $to, 'receivename' => $toName, 'sendid' => $from, 'sendname' => mysql_escape_string($fromName), 'subject' => mysql_escape_string($subjet), 'sendtime' => strtotime($sendtime), 'classid' => $classid, 'amazon_account' => $amazon_account[0]['amazon_account'], 'recievetimestamp' => strtotime($pushtime), 'from_platform' => $from_platform, 'messagepath' => mysql_escape_string($path . $fname), 'attachpath' => '', 'attachname' => '', 'ordernum' => $ordernum, 'buyer' => mysql_escape_string($buyer), 'seller' => mysql_escape_string($seller));
 /* $atpath	  =  WEB_PATH.'crontab/gmailattach/'.$mailinfo['msg_id'].'/';
 			if($mailAttach=$mail->getAttach($message_id,$atpath)){
 				echo "附件下载成功\r\n";
 				$atpath.= $mailAttach[0];
 				$mailinfo['attachname'] = $mailAttach[0];
 				$mailinfo['attachpath'] = $atpath;
 				imap_clearflag_full($connect,$message_id , '\\Seen',ST_UID);
 			} else {
Esempio n. 7
0
<?php

date_default_timezone_set('Asia/Shanghai');
include_once __DIR__ . '/../framework.php';
// 加载框架
Core::getInstance();
// 初始化框架对象
include_once WEB_PATH . 'crontab/scriptcommon.php';
//脚本公共文件
include_once WEB_PATH . 'lib/opensys_functions.php';
include_once WEB_PATH . 'lib/xmlhandle.php';
set_time_limit(0);
error_reporting(0);
$tpl_obj = new CommonModel('msg_ebaycstpl');
$Orderlist = getOpenSysApi(OPENGETOVERSEAORDER, array('vitualarg' => 'v'));
$UPS = $Orderlist['data1'];
//需要以UPS、USPS、SurePost模板发送的相关订单
$Letter = $Orderlist['data2'];
//需要以Letter模板发送的相关订单
$AllOrder = array_merge($UPS, $Letter);
//print_r($AllOrder);
//根据不同订单使用对应模板发送站内信
foreach ($AllOrder as $k => $v) {
    switch ($v['ebay_carrier']) {
        case "SurePost":
            $Track_website = "www.ups.com";
            break;
        case "UPS":
            $Track_website = "www.ups.com";
            break;
        case "USPS":
Esempio n. 8
0
$returnData = array('code' => 'fail', 'msg' => '', 'itemid' => '');
$trackTempl = array();
$trackNum = array();
foreach ($BuyerData as $k => $v) {
    $trackArr = array();
    $sellId = $v['seller_id'];
    $itemId = $v['item_id'];
    $tranSubject = $v['transaction_item'];
    $id = $v['id'];
    $tranDate = date("Y-m-d", $v['transaction_date']);
    $delayArriveTime = date('Y-m-d', $v['delay_arrive_time']);
    $buyerId = $v['buyer_id'];
    $buyerTryOpenTime = date('Y-m-d', $v['buyer_try_open_time']);
    $buyerCountry = '';
    //调用接口获取订单信息
    $orderData = getOpenSysApi(OPENGETORDER, array('type' => 'orderinfo', 'buyeraccount' => $buyerId, 'selleraccount' => $sellId));
    $orderMainData = isset($orderData['data']) ? $orderData['data'] : '';
    if (!empty($orderMainData)) {
        $mark = 0;
        foreach ($orderMainData as $kk => $vv) {
            if ($kk === 'totalbuy' || $kk === 'totalnum') {
                break;
            }
            $ebayId = isset($vv['ebay_id']) ? $vv['ebay_id'] : '';
            $trackNum = isset($vv['ebay_tracknumber']) ? $vv['ebay_tracknumber'] : '';
            $carrier = isset($vv['ebay_carrier']) ? $vv['ebay_carrier'] : '';
            $buyerCountry = $vv['ebay_couny'];
            if (empty($trackNum)) {
                $trackArr[] = 0;
            } else {
                $trackArr[] = 1;