fix(api): 修正userId字段JSON键名

- 修改JSON_CONTAINS中字段键名由'user_id'为'userId'
- 保证用户ID匹配逻辑正确执行
- 防止因键名错误导致的查询失败
This commit is contained in:
zhouyonggao 2025-12-18 22:04:33 +08:00
parent 962d1c0ae3
commit 8868051767
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ func (a *YMTMerchantsAPI) list(w http.ResponseWriter, r *http.Request) {
args := []interface{}{} args := []interface{}{}
if userIDStr != "" { if userIDStr != "" {
// user_id 匹配 或者 operation_user JSON 中包含该 user_id // user_id 匹配 或者 operation_user JSON 中包含该 user_id
sql1 += " AND (user_id = ? OR JSON_CONTAINS(operation_user, JSON_OBJECT('user_id', CAST(? AS SIGNED))))" sql1 += " AND (user_id = ? OR JSON_CONTAINS(operation_user, JSON_OBJECT('userId', CAST(? AS SIGNED))))"
args = append(args, userIDStr, userIDStr) args = append(args, userIDStr, userIDStr)
} }
if like != "" { if like != "" {