TestSend.php
3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?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();