views: Fix type of tenant pk

This commit is contained in:
Fam Zheng 2025-08-16 19:48:11 +01:00
parent e9d32b739d
commit 6d3b0fe683
3 changed files with 15 additions and 5 deletions

View File

@ -1287,7 +1287,7 @@ class MiniProgContentView(BaseView):
sc = get_object_or_404(SerialCode, code=code)
if not sc.tenant:
return http404('code has no tenant')
pk = sc.tenant.pk
pk = str(sc.tenant.pk)
if not pk or not pk.isnumeric():
x = get_object_or_404(MiniProgramContent, tenant=None)
else:

View File

@ -45,9 +45,10 @@ Page({
return c;
},
load_content(tenant_id, code) {
var url = app.globalData.server_url + '/api/v1/mini-program-content/';
console.log("load_content", tenant_id, code);
var url = app.globalData.server_url + '/api/v1/mini-program-content/?';
if (tenant_id) {
url += "?tenant=" + tenant_id;
url += "tenant=" + tenant_id;
}
if (code) {
url += "&code=" + code;
@ -95,7 +96,9 @@ Page({
}
var code = null;
if (options.q) {
console.log("options.q", options.q);
code = extract_code_from_url(decodeURIComponent(options.q));
console.log("code", code);
}
this.load_content(options.tenant, code);
},

View File

@ -2,12 +2,19 @@
"condition": {
"miniprogram": {
"list": [
{
"name": "index-with-q",
"pathName": "pages/index/index",
"query": "q=https%3A%2F%2Fthemblem.com%2Fapi%2Fmini-prog-entry%2F%3Fcode%3D1292648384767%0A",
"scene": null,
"launchMode": "default"
},
{
"name": "pages/camera/camera",
"pathName": "pages/camera/camera",
"query": "",
"scene": null,
"launchMode": "default"
"launchMode": "default",
"scene": null
}
]
}