-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupmenu.php
74 lines (66 loc) · 1.39 KB
/
upmenu.php
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
<?php
/**
* 更新微信菜单
*
* @author Gavin<[email protected]>
*/
//~ require init.php
require (__DIR__.'/core/init.php');
SimPHP::I()->boot();
if (!defined('BR')) {
define('BR', IS_CLI ? "\n" : "<br>");
}
if (!IS_CLI) {
echo "该脚本请在服务器运行";
exit;
}
$json =<<<HEREDOC
{
"button" :
[
{
"type" : "view",
"name" : "多米商城",
"url" : "http://m.edmbuy.com/"
},
{
"type" : "view",
"name" : "商家入驻",
"url" : "http://m.edmbuy.com/user/merchant/checkin"
},
{
"name" : "我的",
"sub_button" : [
{
"type" : "view",
"name" : "会员中心",
"url" : "http://m.edmbuy.com/user"
},
{
"type" : "view",
"name" : "我的订单",
"url" : "http://m.edmbuy.com/trade/order/record?status=all"
},
{
"type" : "view",
"name" : "常见问题",
"url" : "http://m.edmbuy.com/about"
},
{
"type" : "click",
"name" : "官方客服",
"key" : "300"
}
]
}
]
}
HEREDOC;
$menuConfig = json_decode($json, TRUE);
config_set('wxmenu', $menuConfig, 'J');
$msg = 'update menu fail'.BR;
if((new Weixin([],'edmbuy'))->createMenu($menuConfig)){
$msg = 'update menu success'.BR;
}
echo $msg;
/*----- END FILE: upmenu.php -----*/