Platform upgrade: login auth fix, OCR/OSS upload, system menus and dicts, weather dashboard, weighing and invoice modules
This commit is contained in:
@@ -17,14 +17,17 @@ public record IdCardOcrResult(
|
||||
/// </summary>
|
||||
public interface IOcrService
|
||||
{
|
||||
/// <summary>识别身份证图片,side: front(正面)/ back(反面)</summary>
|
||||
Task<IdCardOcrResult> RecognizeAsync(Stream image, string side, string fileName = "idcard.jpg");
|
||||
/// <summary>
|
||||
/// 识别身份证图片,side: front(正面)/ back(反面)。
|
||||
/// storageKey 为已保存文件的存储 key(OSS 模式下可据此生成临时访问 URL 传给识别服务)。
|
||||
/// </summary>
|
||||
Task<IdCardOcrResult> RecognizeAsync(Stream image, string side, string fileName = "idcard.jpg", string? storageKey = null);
|
||||
}
|
||||
|
||||
/// <summary>默认 OCR 实现:未配置凭证时给出友好提示,图片仍会正常保存为附件</summary>
|
||||
public sealed class DisabledOcrService(IConfiguration cfg) : IOcrService
|
||||
{
|
||||
public Task<IdCardOcrResult> RecognizeAsync(Stream image, string side, string fileName = "idcard.jpg")
|
||||
public Task<IdCardOcrResult> RecognizeAsync(Stream image, string side, string fileName = "idcard.jpg", string? storageKey = null)
|
||||
{
|
||||
var message = cfg["Ocr:DisabledMessage"]
|
||||
?? "未配置 OCR 识别服务(待接入阿里云/百度 OCR 凭证),图片已保存为附件,识别字段请手动填写";
|
||||
|
||||
Reference in New Issue
Block a user