*** Begin Patch *** Add File: application/common/service/account/GiftFlowRead.php + strlen($unsignedMax) + || (strlen($text) === strlen($unsignedMax) && strcmp($text, $unsignedMax) > 0)) { + throw new \UnexpectedValueException('GiftLog reference exceeds source UINT64'); + } + $phpMax = (string)PHP_INT_MAX; + return strlen($text) < strlen($phpMax) + || (strlen($text) === strlen($phpMax) && strcmp($text, $phpMax) <= 0) + ? (int)$text : $text; + } + + public static function accountTime($db, $value) + { + if (!self::isDm($db) || !is_string($value) + || !preg_match('/^(\d{4})-(\d{2})-(\d{2}) (\d{2}):(\d{2}):(\d{2})\.0{1,6}$/D', $value, $parts) + || (int)$parts[1] < 1000 + || !checkdate((int)$parts[2], (int)$parts[3], (int)$parts[1]) + || (int)$parts[4] > 23 || (int)$parts[5] > 59 || (int)$parts[6] > 59) { + return $value; + } + return substr($value, 0, 19); + } + + private static function isDm($db): bool + { + return ltrim((string)$db->getConfig('type'), '\\') === \app\cores\database\Dm::class; + } +} *** Update File: application/p/logic/AccountSetting.php @@ use app\common\service\account\GiftAccountPolicy; +use app\common\service\account\GiftFlowRead; @@ ->field( - 'log_id,user_id,scene,money,balance_before,balance_after,' + GiftFlowRead::project($db, 'log_id,user_id,scene,money,balance_before,balance_after,' . 'biz_type,biz_order_id,biz_order_no,describe,remark,' - . 'operator_name,create_time' + . 'operator_name,create_time') @@ foreach ($result['data'] as &$item) { + $item = GiftFlowRead::restore($db, $item, 'biz_order_id'); $staff = $staffMap[(int)$item['user_id']] ?? []; @@ - $item['create_time'] = $this->formatTimestamp($item['create_time']); + $item['create_time'] = $this->formatTimestamp( + GiftFlowRead::accountTime($db, $item['create_time']) + ); *** Update File: application/p/logic/WalletFlow.php @@ use app\common\service\onecard\UserGuard; +use app\common\service\account\GiftFlowRead; @@ - $query->field('log_id,user_id,scene,money,balance_before,balance_after,biz_order_id AS order_id,biz_order_no,describe,operator_name,create_time'); + $query->field(GiftFlowRead::project($db, 'log_id,user_id,scene,money,balance_before,balance_after,biz_order_id AS order_id,biz_order_no,describe,operator_name,create_time')); @@ private function normalizeRow(string $accountType, array $row): array { + if ($accountType === self::ACCOUNT_GIFT) { + $row = GiftFlowRead::restore(get_ai_db(), $row, 'order_id'); + } $money = (float)$row['money']; *** End Patch