consumerm模块完成度90%,完善消费者和商家端数据库表,商品、聊天、订单数据对接好了supabase,和商家端对接了聊天功能,安卓端编译通过了css样式,剩余几个页面在处理函数规范问题
This commit is contained in:
@@ -28,16 +28,18 @@ export async function ensureUserProfile(sessionUser: UTSJSONObject): Promise<Use
|
||||
|
||||
console.log('ensureUserProfile check ak_users:', {
|
||||
status: checkRes.status,
|
||||
hasData: checkRes.data != null,
|
||||
hasError: (checkRes as any).error != null,
|
||||
error: (checkRes as any).error
|
||||
hasData: checkRes.data != null
|
||||
})
|
||||
|
||||
if (checkRes.status >= 200 && checkRes.status < 300 && checkRes.data != null) {
|
||||
// 用户已存在,返回现有资料(H5 下 checkRes.data 可能是 plain object,不一定是 UTSJSONObject)
|
||||
const existingUser = (typeof (checkRes.data as any).getString === 'function')
|
||||
? (checkRes.data as UTSJSONObject)
|
||||
: new UTSJSONObject(checkRes.data as any)
|
||||
const data = checkRes.data
|
||||
let existingUser: UTSJSONObject
|
||||
if (data instanceof UTSJSONObject) {
|
||||
existingUser = data
|
||||
} else {
|
||||
existingUser = new UTSJSONObject(data)
|
||||
}
|
||||
return {
|
||||
id: existingUser.getString('id') ?? '',
|
||||
username: existingUser.getString('username') ?? '',
|
||||
@@ -67,17 +69,13 @@ export async function ensureUserProfile(sessionUser: UTSJSONObject): Promise<Use
|
||||
.single()
|
||||
.execute()
|
||||
|
||||
console.log('ensureUserProfile insert ak_users:', {
|
||||
status: insertRes.status,
|
||||
hasData: insertRes.data != null,
|
||||
hasError: (insertRes as any).error != null,
|
||||
error: (insertRes as any).error
|
||||
})
|
||||
console.log('ensureUserProfile insert ak_users status:', insertRes.status)
|
||||
|
||||
if (insertRes.status >= 200 && insertRes.status < 300 && insertRes.data != null) {
|
||||
const newUser = (typeof (insertRes.data as any).getString === 'function')
|
||||
? (insertRes.data as UTSJSONObject)
|
||||
: new UTSJSONObject(insertRes.data as any)
|
||||
const rawData = insertRes.data
|
||||
const newUser = (rawData instanceof UTSJSONObject)
|
||||
? (rawData as UTSJSONObject)
|
||||
: new UTSJSONObject(rawData)
|
||||
return {
|
||||
id: newUser.getString('id') ?? '',
|
||||
username: newUser.getString('username') ?? '',
|
||||
|
||||
Reference in New Issue
Block a user