diff --git a/module/upgrade/config.php b/module/upgrade/config.php index e9a9099945..535ca9a301 100644 --- a/module/upgrade/config.php +++ b/module/upgrade/config.php @@ -17,5 +17,11 @@ $config->upgrade->lowerTables[$config->db->prefix . 'userGroup'] = $config- $config->upgrade->lowerTables[$config->db->prefix . 'userQuery'] = $config->db->prefix . 'userquery'; $config->upgrade->lowerTables[$config->db->prefix . 'userTPL'] = $config->db->prefix . 'usertpl'; +$config->upgrade->bearychat = array(); +$config->upgrade->bearychat['zh-cn'] = '倍洽'; +$config->upgrade->bearychat['zh-tw'] = '倍洽'; +$config->upgrade->bearychat['en'] = 'Bearychat'; +$config->upgrade->bearychat['de'] = 'Bearychat'; + $config->delete['10.6'][] = 'module/chat/ext/control/extensions.php'; $config->delete['10.6'][] = 'module/common/ext/model/xuanxuan.php'; diff --git a/module/upgrade/model.php b/module/upgrade/model.php index 10e2c1a319..5b7aee304e 100644 --- a/module/upgrade/model.php +++ b/module/upgrade/model.php @@ -3127,6 +3127,52 @@ class upgradeModel extends model return true; } + /** + * Adjust webhook type list when webhook use bearychat. + * + * @access public + * @return void + */ + public function adjustWebhookType() + { + $bearychatCount = $this->dao->select('count(*) as count')->from(TABLE_WEBHOOK)->where('type')->eq('bearychat')->fetch('count'); + if($bearychatCount) + { + $item = new stdclass(); + $item->module = 'webhook'; + $item->section = 'typeList'; + + foreach(array('zh-cn', 'zh-tw', 'en', 'de') as $currentLang) + { + $langFile = $this->app->getModuleRoot() . 'webhook' . DS . 'lang' . DS . $currentLang . '.php'; + if(!file_exists($langFile)) continue; + + $lang = new stdclass(); + $lang->webhook = new stdclass(); + $lang->productCommon = $this->config->productCommonList[$currentLang][0]; + $lang->projectCommon = $this->config->projectCommonList[$currentLang][0]; + + include $langFile; + if(isset($lang->webhook->typeList)) continue + + $item->lang = $currentLang; + $item->key = 'bearychat'; + $item->value = $this->config->upgrade->bearychat[$currentLang]; + $this->dao->replace(TABLE_LANG)->data($item)->exec(); + + foreach($lang->webhook->typeList as $typeKey => $typeName) + { + if(empty($typeKey)) continue; + $item->key = $typeKey; + $item->value = $typeName; + $this->dao->replace(TABLE_LANG)->data($item)->exec(); + } + } + } + + return true; + } + /** * Save Logs. * diff --git a/module/webhook/lang/de.php b/module/webhook/lang/de.php index 1260e91e12..8d8e753b65 100644 --- a/module/webhook/lang/de.php +++ b/module/webhook/lang/de.php @@ -33,7 +33,6 @@ $lang->webhook->data = 'Daten'; $lang->webhook->result = 'Ergebnis'; $lang->webhook->typeList[''] = ''; -$lang->webhook->typeList['bearychat'] = 'Bearychat'; $lang->webhook->typeList['dingding'] = 'Dingding'; $lang->webhook->typeList['default'] = 'SDtandard'; diff --git a/module/webhook/lang/en.php b/module/webhook/lang/en.php index 41d21098f9..93f3a16c43 100644 --- a/module/webhook/lang/en.php +++ b/module/webhook/lang/en.php @@ -33,7 +33,6 @@ $lang->webhook->data = 'Data'; $lang->webhook->result = 'Result'; $lang->webhook->typeList[''] = ''; -$lang->webhook->typeList['bearychat'] = 'Bearychat'; $lang->webhook->typeList['dingding'] = 'Dingding'; $lang->webhook->typeList['default'] = 'Others'; diff --git a/module/webhook/lang/zh-cn.php b/module/webhook/lang/zh-cn.php index 68a17f2bf6..7daa182a23 100644 --- a/module/webhook/lang/zh-cn.php +++ b/module/webhook/lang/zh-cn.php @@ -33,7 +33,6 @@ $lang->webhook->data = '数据'; $lang->webhook->result = '结果'; $lang->webhook->typeList[''] = ''; -$lang->webhook->typeList['bearychat'] = '倍洽'; $lang->webhook->typeList['dingding'] = '钉钉'; $lang->webhook->typeList['default'] = '其他';