diff --git a/api/products/views.py b/api/products/views.py index 494d017..972398e 100644 --- a/api/products/views.py +++ b/api/products/views.py @@ -1773,43 +1773,6 @@ class LogReportView(BaseView): SystemLog.objects.create(log=json.dumps(log)) return JsonResponse({}) -class DebugUploadView(BaseView): - name = 'debug-upload' - - def post(self, request): - image, fn = get_image(request) - if not image: - return JsonResponse({"error": "image not found in request"}) - qrcode = request.data.get('qrcode').split("code=")[-1] - phonemodel = request.data.get('phonemodel') - phonemodel = phonemodel.split("<")[0].strip().replace(" ", "") - r = GlobalConfig.objects.filter(name='debug_upload_dir').first() - if r: - upload_dir = r.get_value() - else: - upload_dir = "default" - save_dir = "/emblem/data/debug-upload/{}/{}".format(upload_dir, phonemodel) - if not os.path.exists(save_dir): - os.makedirs(save_dir) - - r = GlobalConfig.objects.filter(name='debug_upload_neg_or_pos').first() - if r: - neg_or_pos = r.get_value(); - else: - neg_or_pos = "unknown" - with tempfile.NamedTemporaryFile(suffix=fn) as tf: - tf.write(image) - tf.flush() - ts = time.time() - save_file = os.path.join(save_dir, "{}_{}_{}_{}.jpg".format(qrcode, neg_or_pos, phonemodel, ts)) - url = 'http://alg:3028/alg/rectify' - with open(tf.name, 'rb') as tfr: - r = requests.post(url, data=tfr) - r.raise_for_status() - with open(save_file, 'wb') as sfw: - sfw.write(r.content) - return JsonResponse({"info": "ok"}) - def make_camera_rules(q): def make_camera_config_obj(cc): return { diff --git a/web/src/views/system-settings.vue b/web/src/views/system-settings.vue index 4fc3a24..8716973 100644 --- a/web/src/views/system-settings.vue +++ b/web/src/views/system-settings.vue @@ -5,18 +5,6 @@

-
-

数据采集模式配置

-
- 保存目录: - -
-
- 类别标签: - -
- -

默认验证模型配置

@@ -56,8 +44,6 @@ export default { }, data: function () { return { - debug_upload_dir: '', - debug_upload_neg_or_pos: '', verification_models: [], default_verification_model_id: '', }; @@ -66,36 +52,23 @@ export default { }, methods: { async reload() { - var r = await this.$root.api_get("/api/v1/global-config/?name=debug_upload_dir"); - this.debug_upload_dir = r.data.value || ''; - - r = await this.$root.api_get("/api/v1/global-config/?name=debug_upload_neg_or_pos"); - this.debug_upload_neg_or_pos = r.data.value || ''; - // Load verification models - r = await this.$root.api_get_all("/api/v1/verification-model/"); - this.verification_models = r; - - // Load default verification model try { - r = await this.$root.api_get("/api/v1/global-config/?name=default_verification_model"); + var r = await this.$root.api_get_all("/api/v1/verification-model/"); + this.verification_models = r; + } catch (e) { + this.verification_models = []; + } + + // Load default verification model - treat 404 as empty + try { + var r = await this.$root.api_get("/api/v1/global-config/?name=default_verification_model"); this.default_verification_model_id = r.data.value || ''; } catch (e) { + // 404 or any other error - treat as empty/default this.default_verification_model_id = ''; } }, - async save_debug_upload_configs() { - await this.$root.api_post("/api/v1/global-config/", { - name: 'debug_upload_dir', - value: this.debug_upload_dir, - }); - await this.$root.api_post("/api/v1/global-config/", { - name: 'debug_upload_neg_or_pos', - value: this.debug_upload_neg_or_pos, - }); - await this.reload(); - this.$root.notify("保存成功", "数据采集模式配置已更新"); - }, async save_default_verification_model() { await this.$root.api_post("/api/v1/global-config/", { name: 'default_verification_model',