mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 14:01:07 +00:00
【程序目录】更新清除语言缓存方法,修复发送图文消息问题
This commit is contained in:
parent
41c417a267
commit
eee9cee2e3
@ -220,7 +220,7 @@ class KefuServices extends BaseServices
|
||||
->setTrigger('crmeb_chat')->send('mssage_num', [
|
||||
'uid' => $userInfo['uid'],
|
||||
'num' => $num,
|
||||
'recored' => $data['recored']
|
||||
'recored' => $data['record']
|
||||
], [$toUid]);
|
||||
ChannelService::instance()
|
||||
->setTrigger('crmeb_chat')->send('reply', $data, [$toUid]);
|
||||
|
||||
@ -5,6 +5,7 @@ namespace app\services\system\lang;
|
||||
use app\dao\system\lang\LangCodeDao;
|
||||
use app\services\BaseServices;
|
||||
use crmeb\exceptions\AdminException;
|
||||
use crmeb\services\CacheService;
|
||||
|
||||
class LangCodeServices extends BaseServices
|
||||
{
|
||||
@ -57,11 +58,11 @@ class LangCodeServices extends BaseServices
|
||||
*/
|
||||
public function langCodeInfo($code)
|
||||
{
|
||||
$list = $this->dao->selectList(['code' => $code], '*', 0, 0, '', true)->toArray();
|
||||
if (!$list) throw new AdminException(100026);
|
||||
if (!$code) throw new AdminException(100026);
|
||||
/** @var LangTypeServices $langTypeServices */
|
||||
$langTypeServices = app()->make(LangTypeServices::class);
|
||||
$typeList = $langTypeServices->getColumn([['status', '=', 1], ['is_del', '=', 0]], 'language_name,file_name,id', 'id');
|
||||
$list = $this->dao->selectList([['code', '=', $code], ['type_id', 'in', array_column($typeList, 'id')]])->toArray();
|
||||
foreach ($list as &$item) {
|
||||
$item['language_name'] = $typeList[$item['type_id']]['language_name'] . '(' . $typeList[$item['type_id']]['file_name'] . ')';
|
||||
}
|
||||
@ -91,6 +92,7 @@ class LangCodeServices extends BaseServices
|
||||
}
|
||||
}
|
||||
$this->dao->saveAll($saveData);
|
||||
$this->clearLangCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -103,7 +105,24 @@ class LangCodeServices extends BaseServices
|
||||
{
|
||||
$code = $this->dao->value(['id' => $id], 'code');
|
||||
$res = $this->dao->delete(['code' => $code]);
|
||||
if($res) return true;
|
||||
$this->clearLangCache();
|
||||
if ($res) return true;
|
||||
throw new AdminException(100008);
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除语言缓存
|
||||
* @return bool
|
||||
*/
|
||||
public function clearLangCache()
|
||||
{
|
||||
/** @var LangTypeServices $langTypeServices */
|
||||
$langTypeServices = app()->make(LangTypeServices::class);
|
||||
$typeList = $langTypeServices->getColumn(['status' => 1, 'is_del' => 0], 'file_name');
|
||||
foreach ($typeList as $value) {
|
||||
$langStr = 'api_lang_' . str_replace('-', '_', $value);
|
||||
CacheService::redisHandler()->delete($langStr);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user