Qyexternal.php
3.8 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
<?php
namespace addons\qyexternal;
use app\common\library\Menu;
use think\Addons;
use think\Route;
/**
* 插件
*/
class Qyexternal extends Addons
{
/**
* 插件安装方法
* @return bool
*/
public function install()
{
$menu = [
[
'name' => 'qywx',
'title' => '企业微信客户',
'icon' => 'fa fa-id-badge',
'remark' => '企业微信客户管理,支持微信用户。',
'sublist' => [
[
"name" => "qywx/corp",
"title" => "企业微信列表",
'icon' => 'fa fa-window-restore',
"sublist" => [
["name" => "qywx/corp/index", "title" => "查看"],
["name" => "qywx/corp/add", "title" => "添加"],
["name" => "qywx/corp/edit", "title" => "编辑"],
["name" => "qywx/corp/del", "title" => "删除"],
["name" => "qywx/corp/multi", "title" => "批量更新"],
["name" => "qywx/corp/sync", "title" => "数据同步"],
]
], [
"name" => "qywx/follow",
"title" => "成员列表",
'icon' => 'fa fa-id-badge',
"sublist" => [
["name" => "qywx/follow/index", "title" => "查看"],
["name" => "qywx/follow/data", "title" => "近30天数据"],
]
], [
"name" => "qywx/contacts",
"title" => "客户列表",
'icon' => 'fa fa-users',
"sublist" => [
["name" => "qywx/contacts/index", "title" => "查看"],
]
], [
"name" => "qywx/group",
"title" => "客户群列表",
'icon' => 'fa fa-group',
"sublist" => [
["name" => "qywx/group/index", "title" => "查看"],
]
], [
"name" => "qywx/dashboard",
"title" => "数据统计",
"icon" => "fa fa-dashboard",
"sublist" => [
["name" => "qywx/dashboard/index", "title" => "查看"],
]
]
],
]
];
Menu::create($menu);
return true;
}
/**
* 插件卸载方法
* @return bool
*/
public function uninstall()
{
Menu::delete("qywx");
return true;
}
/**
* 插件启用方法
* @return bool
*/
public function enable()
{
Menu::enable("qywx");
return true;
}
/**
* 插件禁用方法
* @return bool
*/
public function disable()
{
Menu::disable("qywx");
return true;
}
/**
* 应用初始化
*/
public function appInit()
{
\think\Loader::addNamespace('Weasy\\External', ADDON_PATH . 'qyexternal' . DS . 'library' . DS . 'External' . DS);
\think\Loader::addNamespace('Weasy\\Core', ADDON_PATH . 'qyexternal' . DS . 'library' . DS . 'Core' . DS);
\think\Loader::addNamespace('Weasy\\Rboot\\Plugins\\Qywx', ADDON_PATH . 'qyexternal' . DS . 'library' . DS . 'Rboot' . DS);
Route::any('qywx', 'addons\\qyexternal\\controller\\Index@index');
Route::post('qywx/sync', 'addons\\qyexternal\\controller\\Index@sync');
}
}