InstallController.class.php
1.33 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
<?php
namespace Rpc\Controller\Common;
use Common\Service\PluginService;
class InstallController extends AbstractController
{
// 应用表默认数据
const PLUGIN_DEFAULT_DATA = [
'integral_center' => [
'name' => '积分中心',
'url' => ''
],
];
/**
* 应用默认数据安装接口
* @author tangxingguo
*/
public function Index()
{
// 初始化 plugin 表数据
$this->initPluginData();
return true;
}
/**
* 初始化 plugin 表数据
*/
private function initPluginData()
{
// 查询 应用表数据
$pluginServ = new PluginService();
$pluginList = $pluginServ->list_by_conds([
'ap_key' => [
'integral_center'
]
]);
$pluginList = array_combine_by_key($pluginList, 'ap_key');
// 写入 应用表数据
$pluginInsertList = [];
foreach (self::PLUGIN_DEFAULT_DATA as $apKey => $item) {
if (!isset($pluginList[$apKey])) {
$pluginInsertList[] = [
'ap_key' => $apKey,
'name' => $item['name'],
'url' => $item['url']
];
}
}
$pluginServ->insert_all($pluginInsertList);
return true;
}
}