TestSend.php 3.96 KB
<?php
# New methods AMQPChannel::getPrefetchCount() and AMQPChannel::getPrefetchSize()
# Deprecate AMQPQueue::declare() in favor of AMQPQueue::declareQueue()
# Deprecate AMQPExchange::declare() in favor of AMQPExchange::declareExchange()
# Smaller fixes to our stubs

$mes = array(
    '你这想赚钱想的',
    '打字速度上去没?',
    '明天晚上上自习不',
    '这不能让你的学生饿着啊',
    '用电脑打的快',
    '王玲也学会聊扣扣啦',
    '不送',
    '与时俱进',
    '娃只送美女阿',
    '对,他发的厉害',
    '天天累的跟孙子似的',
    '得了吧,俺这才叫要饭呢',
    '跟你这个刘老板比我就是讨饭的',
    '这年头生意难做这呢',
    '谦虚啥里',
    '变成妹子一枚,娃就投怀送抱了,流量那都是小事',
    '也就不打工强一些',
    '就是你后来增加那人'
);

include_once "Bootstrap.php";
$imagePath = 'yhfair-im.03f6c27e66d442eb9b2a74ed2a87655f.jpg';
$amqp = new YHMIm_Relay();
$amqp->exchange($config->exchangeName);
$mesData = array(
    'to' => 'user:1',
    'from' => 'user:6',
    'type' => 'yhm-image',
    'body' => array(
        'text' => '图片',
        'image_path' => $imagePath
    )
);
$mesTag = array_rand($mes, 1);
$mesData = array(
    'to' => 'user:1',
    'from' => 'user:0',
    'type' => 'yhm-text',
    'body' => array(
        'text' => $mes[$mesTag]
    )
);
$mesData1 = array(
    'type' => 'yhm-message-read',
    'body' => array(
        'talk_id' => '540c5b3cfa7f51e47e0041a7'
    )
);
$image = 'yhfair-product.0654d247aa29816e52f73fdb584fa9e2.jpg';
$mesData1 = array(
    'to' => 'user:7,6',
    'from' => 'user:8',
    'type' => 'yhm-product',
    'body' => array(
        'product_skc' => 22,
        'product_name' => '你猜',
        'image_url' => YHMUpload_Images::template($image, 'yhfair-product'),
        'market_price' => '0.00',
        'sale_price' => '90.00',
        'stock_number' => 1,
        'sale_number' => 10
    )
);

$mesData = array(
    'to' => 'user:7,6',
    'from' => 'user:8',
    'type' => 'yhm-product-change-price',
    'body' => array(
        'product_skc' => 22,
        'product_name' => '测试商品',
        'image_url' => YHMUpload_Images::template($image, 'yhfair-product'),
        'sale_price' => '80.00',
        'agreement_price' => '60.00',
        'agreement_id' => 12121
    )
);

$mesData = array(
    'to' => 'user:7',
    'from' => 'user:8',
    'type' => 'yhm-order-info',
    'body' => array(
        'product_skc' => 22,
        'product_name' => '订单商品',
        'image_url' => YHMUpload_Images::template($image, 'yhfair-product'),
        'sale_price' => '100.00',
        'stock_number' => 1,
        'size_name' => 'XL',
        'order_code' => 1901921891889
    )
);
$mesData2 = array(
    'to' => 'user:7',
    'from' => 'user:0',
    'type' => 'yhm-order-close',
    'body' => array(
        'text' => '订单关闭',
        'product_skc' => 22,
        'product_name' => '测试',
        'image_url' => YHMUpload_Images::template($image, 'yhfair-product'),
        'sale_price' => '100.00',
        'size_name' => 'XL',
        'buy_number' => 1,
        'order_code' => 1901921891889
    )
);

$mesData2 = array(
    'to' => 'user:7',
    'from' => 'user:0',
    'type' => 'yhm-product-reduce-price',
    'body' => array(
        'text' => '降价了',
        'product_skc' => 22,
        'product_name' => '测试',
        'image_url' => YHMUpload_Images::template($image, 'yhfair-product'),
        'sale_price' => '100.00',
        'size_name' => 'XL',
        'collection_price' => '80.00'
    )
);

$mesData = YHMIm_Agreement::factory($mesData)->getQueuePackageData();
$amqp->publish($mesData, $config->routeName);

/**
 * $mesData = array(
 * 'to' => 'user:1',
 * 'from' => 'user:0',
 * 'type' => 'yhm-text',
 * 'body' => array(
 * 'text' => '测试系统消息'
 * )
 * );
 * $mesData = YHMIm_Agreement::factory($mesData)->getPackage();
 * $amqp->publish($mesData, $config->routeName);
 **/
$amqp->disconnect();