Example #1
0
//AWS SES
require_once WEB_PATH . 'lib/SimpleEmailService.php';
require_once WEB_PATH . 'lib/SimpleEmailServiceRequest.php';
require_once WEB_PATH . 'lib/SimpleEmailServiceMessage.php';
set_time_limit(0);
//$tpl_obj   		= new CommonModel('msg_aliEDMcstpl');
$aliMark_obj = new AliMarketModel();
$EDMDatas = $aliMark_obj->getAllEDMData();
//获取Excell信息
unset($aliMark_obj);
foreach ($EDMDatas as $data) {
    $seller = $data['seller_id'];
    $customer_s = $data['customer_s'];
    $gmail = $data['gmail'];
    $shopnum = $data['shopnum'];
    $aliMark_obj = new AliMarketModel();
    $orderDatas = $aliMark_obj->getOrderinfo($seller);
    //查询订单系统,获取买家邮箱和姓名
    if ($seller !== 'babyhouse' && $seller !== 'Etime') {
        echo "{$seller}\n";
        continue;
    }
    foreach ($orderDatas as $order) {
        $counter = 0;
        if ($counter++ > 20) {
            sleep(3);
        }
        if (empty($order['ebay_usermail'])) {
            continue;
        }
        //print_r($order);exit;
Example #2
0
require_once WEB_PATH . 'lib/class.phpmailer.php';
require_once WEB_PATH . 'model/amazonmessage.model.php';
use PhpAmqpLib\Connection\AMQPConnection;
date_default_timezone_set('PRC');
$connection = new AMQPConnection(MQ_SERVER, 5672, 'guest', '123456', 'valsun_message');
$channel = $connection->channel();
$channel->exchange_declare('ex_aliEDM', 'fanout', false, true, false);
$channel->basic_qos(null, 1, null);
//该设置让一个繁忙中的消费者不再接收邮件
//list($queue_name, ,) = $channel->queue_declare("message", false, false, true, false);
$channel->queue_declare('que_aliEDM', false, true, false, false);
$channel->queue_bind('que_aliEDM', 'ex_aliEDM');
echo ' [*] Waiting for messages. To exit press CTRL+C', "\n";
$callback = function ($msg) {
    $msg_obj = new amazonmessageModel();
    $aliMark_obj = new AliMarketModel();
    $ms = json_decode($msg->body, true);
    extract($ms);
    $receive = preg_split('/@/', $sendid)[0];
    $mail = new PHPMailer();
    //建立邮件发送类
    $mail->SMTPDebug = 1;
    $mail->CharSet = "UTF-8";
    $mail->IsSMTP();
    // 设定使用SMTP服务
    $mail->SMTPAuth = true;
    // 启用 SMTP 验证功能
    $mail->SMTPSecure = "ssl";
    // SMTP 安全协议
    $mail->Host = "smtp.gmail.com";
    // SMTP 服务器
Example #3
0
 /** 
  * 速卖通EDM营销数据导入处理
  * tags 
  * @param unknowtype 
  * @return return_type 
  * @author xuzhaoyang 
  * @date 2014-7-3下午2:51:34 
  * @version v1.0.0 
  */
 public function view_processEDMData()
 {
     $uploadfile = date("Y") . date("m") . date("d") . rand(1, 100) . ".xlsx";
     $path = WEB_PATH . 'html/template/upload/EDMData/';
     if (move_uploaded_file($_FILES['upfile']['tmp_name'], $path . $uploadfile)) {
         echo "<script>alert('导入完成!');</script>";
         $ismark = 'yes';
     } else {
         echo "<script>alert('导入失败!');</script>";
         $ismark = 'no';
     }
     $data = array();
     $fileName = $path . $uploadfile;
     $filePath = $fileName;
     $PHPExcel = new PHPExcel();
     $PHPReader = new PHPExcel_Reader_Excel2007();
     if (!$PHPReader->canRead($filePath)) {
         $PHPReader = new PHPExcel_Reader_Excel5();
         if (!$PHPReader->canRead($filePath)) {
             echo 'no Excel';
             return;
         }
     }
     $PHPExcel = $PHPReader->load($filePath);
     $sheetcount = $PHPExcel->getSheetCount();
     //Excell文件中的表数量
     $counter = 0;
     $inserterrorarr = array();
     $aliMarkObj = new AliMarketModel();
     for ($i = 0; $i < $sheetcount; $i++) {
         $c = 2;
         $sheet = $PHPExcel->getSheet($i);
         $sheetname = $PHPExcel->getSheetNames($i);
         while (true) {
             $aa = 'A' . $c;
             //店铺账号
             $bb = 'B' . $c;
             //客服名字
             $cc = 'C' . $c;
             //邮箱
             $dd = 'D' . $c;
             //店铺数字
             //获取要写入数据库的数据
             $seller_id = trim($sheet->getCell($aa)->getValue());
             if (empty($seller_id)) {
                 break;
             }
             $data['seller_id'] = isset($seller_id) ? addslashes($seller_id) : '';
             $customer_s = trim($sheet->getCell($bb)->getValue());
             $data['customer_s'] = isset($customer_s) ? addslashes($customer_s) : '';
             $gmail = trim($sheet->getCell($cc)->getValue());
             $data['gmail'] = isset($gmail) ? addslashes($gmail) : '';
             $shopnum = trim($sheet->getCell($dd)->getValue());
             $data['shopnum'] = isset($shopnum) ? addslashes($shopnum) : '';
             $data['pushtime'] = time();
             //导入时间
             $data['sendtime'] = '';
             //推送时间
             $data['sendstatus'] = 0;
             //推送状态
             $data['failure_reason'] = '';
             //推送失败原因
             //将数据写入数据库
             $InsertResult = $aliMarkObj->insertEDMData($data);
             if ($InsertResult === 'failure') {
                 $inserterrorarr[] = $c;
             } else {
                 $counter++;
             }
             $c++;
         }
     }
     if (!empty($inserterrorarr)) {
         $errorstr = implode(',', $inserterrorarr);
         echo "<script>alert('总共导入{$counter}条数据,导入失败行数为{$errorstr}');</script>";
     } else {
         echo "<script>alert('总共导入{$counter}条数据,无导入失败数据');</script>";
     }
     echo "<script>location.href='index.php?mod=aliMarket&act=index';</script>";
     $sec_menue = '4';
     $this->smarty->assign('sec_menue', $sec_menue);
     $this->smarty->assign('toptitle', '速卖通营销');
     $this->smarty->display('aliMarket.htm');
 }