think-orm
This commit is contained in:
@@ -75,7 +75,7 @@ class Ajax extends Backend
|
||||
public function getDatabaseConnectionList(): void
|
||||
{
|
||||
$quickSearch = $this->request->get("quickSearch/s", '');
|
||||
$connections = config('database.connections');
|
||||
$connections = config('think-orm.connections');
|
||||
$desensitization = [];
|
||||
foreach ($connections as $key => $connection) {
|
||||
$connection = TableManager::getConnectionConfig($key);
|
||||
|
||||
@@ -22,7 +22,7 @@ class Alioss extends Backend
|
||||
if(empty($file)) {
|
||||
$this->error('参数不能为空');
|
||||
}
|
||||
$commoninfo = Db::connect(config('database.search_library'));
|
||||
$commoninfo = Db::connect(config('think-orm.search_library'));
|
||||
$endpoint = $commoninfo->name('common_info')->where(['type' => 68])->find()['value'];
|
||||
$accessKeyId = $commoninfo->name('common_info')->where(['type' => 69])->find()['value'];
|
||||
$secretAccessKey = $commoninfo->name('common_info')->where(['type' => 70])->find()['value'];
|
||||
@@ -54,7 +54,7 @@ class Alioss extends Backend
|
||||
'Content-Encoding' => 'binary',
|
||||
];
|
||||
$res = $ossClient->putObject($bucket, $object, $content, $options);
|
||||
Log::write('上传文件结果' . json_encode($res));
|
||||
Log::info('上传文件结果' . json_encode($res));
|
||||
if(!empty($res['info'])) {
|
||||
return $this->ApiDataReturn(['data' => $befor_url . '/' . $object, 'msg' => 'success', 'code' => 0]);
|
||||
}else {
|
||||
@@ -68,7 +68,7 @@ class Alioss extends Backend
|
||||
// 获取阿里云oss存储相关配置
|
||||
public function getCredentials()
|
||||
{
|
||||
$commoninfo = Db::connect(config('database.search_library'));
|
||||
$commoninfo = Db::connect(config('think-orm.search_library'));
|
||||
$configItems = $commoninfo->name('common_info')->whereIn('type', [66, 67, 69, 70])
|
||||
->column('value', 'type');
|
||||
AlibabaCloud::accessKeyClient($configItems[69], $configItems[70])
|
||||
|
||||
@@ -38,7 +38,7 @@ class Common extends Backend
|
||||
if(empty($get['num'])) {
|
||||
$this->error('type 不能为空');
|
||||
}
|
||||
$data = convertToCamelCase(Db::connect(config('database.search_library'))->name('common_info')->where('type', $get['num'])->find());
|
||||
$data = convertToCamelCase(Db::connect(config('think-orm.search_library'))->name('common_info')->where('type', $get['num'])->find());
|
||||
$this->success('ok', $data);
|
||||
}
|
||||
}
|
||||
@@ -139,7 +139,7 @@ class Sys extends Backend
|
||||
->where('t.title', '签到奖励')
|
||||
->group('t.by_user_id');
|
||||
})->count();
|
||||
$v_db_name = config('database.connections.' . get_slave_connect_name() . '.database');
|
||||
$v_db_name = config('think-orm.connections.' . get_slave_connect_name() . '.database');
|
||||
$result = DatabaseRoute::paginateAllDbBySqlAutoCount(function () use($userId, $v_db_name) {
|
||||
return "select
|
||||
t1.by_user_id as userId,
|
||||
@@ -181,7 +181,7 @@ class Sys extends Backend
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$keywords = $params['keywords'];
|
||||
$v_db_name = config('database.connections.' . get_slave_connect_name() . '.database');
|
||||
$v_db_name = config('think-orm.connections.' . get_slave_connect_name() . '.database');
|
||||
$result = DatabaseRoute::paginateAllDb('tb_user', function ($query) use($keywords, $v_db_name) {
|
||||
return $query->alias('t1')
|
||||
->field([
|
||||
@@ -219,7 +219,7 @@ class Sys extends Backend
|
||||
from v_disc_spinning_record t1
|
||||
where t1.user_id = ".$userId);
|
||||
$count = $count[0]['count'];
|
||||
$v_db_name = config('database.connections.' . get_slave_connect_name() . '.database');
|
||||
$v_db_name = config('think-orm.connections.' . get_slave_connect_name() . '.database');
|
||||
$result = DatabaseRoute::paginateAllDbBySqlAutoCount(function () use($userId, $v_db_name) {
|
||||
return "select
|
||||
t1.id,
|
||||
|
||||
@@ -486,7 +486,7 @@ class Crud extends Backend
|
||||
{
|
||||
$table = $this->request->get('table');
|
||||
$connection = $this->request->get('connection');
|
||||
$connection = $connection ?: config('database.default');
|
||||
$connection = $connection ?: config('think-orm.default');
|
||||
|
||||
$crudLog = Db::name('crud_log')
|
||||
->where('table_name', $table)
|
||||
|
||||
@@ -283,7 +283,7 @@ class Helper
|
||||
return $data['id'];
|
||||
}
|
||||
|
||||
$connection = $data['table']['databaseConnection'] ?: config('database.default');
|
||||
$connection = $data['table']['databaseConnection'] ?: config('think-orm.default');
|
||||
$log = CrudLog::create([
|
||||
'table_name' => $data['table']['name'],
|
||||
'comment' => $data['table']['comment'],
|
||||
|
||||
@@ -139,7 +139,7 @@ class AdminLog extends Model
|
||||
$title = $title ?: $this->title;
|
||||
if (!$title) {
|
||||
|
||||
$slave_db = Db::connect(config('database.search_library'));
|
||||
$slave_db = Db::connect(config('think-orm.search_library'));
|
||||
$admin_rule = $slave_db->name('sys_menu');
|
||||
$controllerTitle = $admin_rule->where('url', $controller)->value('name');
|
||||
$title = $admin_rule->where('url', $path)->value('name');
|
||||
@@ -148,7 +148,7 @@ class AdminLog extends Model
|
||||
}
|
||||
|
||||
// 主库写入
|
||||
$master_db = Db::connect(config('database.z_library'));
|
||||
$master_db = Db::connect(config('think-orm.z_library'));
|
||||
$master_db->name('sys_log')->insert([
|
||||
'username' => $username,
|
||||
'method' => substr(request()->url(), 0, 1500),
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace app\admin\model;
|
||||
use app\common\library\DatabaseRoute;
|
||||
use ba\Exception;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use support\Log;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
@@ -69,7 +69,7 @@ class DiscSpinning extends Model
|
||||
->value('value');
|
||||
// 校验是否超过限制
|
||||
if ($drawCount > $maxDraws) {
|
||||
Log::write('超过限制' . $receive['id'] . '/' . $drawCount);
|
||||
Log::info('超过限制' . $receive['id'] . '/' . $drawCount);
|
||||
return false; // 超过次数限制,终止处理
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class DiscSpinning extends Model
|
||||
$record = $db->name('disc_spinning_record')->find($recordId);
|
||||
// 校验记录是否已处理
|
||||
if (!empty($record['target_id'])) {
|
||||
Log::write('记录已处理无需继续处理' . $record['id'] . '/' . $record['target_id']);
|
||||
Log::info('记录已处理无需继续处理' . $record['id'] . '/' . $record['target_id']);
|
||||
return false; // 已处理,终止处理
|
||||
}
|
||||
self::receiveAsync($record);
|
||||
@@ -94,7 +94,7 @@ class DiscSpinning extends Model
|
||||
|
||||
public static function receiveAsync($receive)
|
||||
{
|
||||
Log::write('正式补偿' . $receive['id']);
|
||||
Log::info('正式补偿' . $receive['id']);
|
||||
// 校验奖励类型(必须为2)
|
||||
if (($receive['type'] ?? 0) != 2) {
|
||||
Log::info("非现金转盘奖励,type={$receive['type']}");
|
||||
@@ -135,7 +135,7 @@ class DiscSpinning extends Model
|
||||
'target' => "2",
|
||||
'target_id' => $detailId
|
||||
]);
|
||||
Log::write('更新奖励' . $a);
|
||||
Log::info('更新奖励' . $a);
|
||||
Cash::updateAmount(1, $receive['user_id'], $receive['number'], $db);
|
||||
// 提交事务
|
||||
$db->commit();
|
||||
|
||||
Reference in New Issue
Block a user