Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
_milo
Great Teamwork
提交
13825a23
Great Teamwork
项目概览
_milo
/
Great Teamwork
通知
13
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Great Teamwork
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
13825a23
编写于
5月 25, 2023
作者:
M
MicroMilo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
云对象重构
上级
55a14365
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
198 addition
and
308 deletion
+198
-308
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/fe-sport-feelings.param.json
...dfunctions/fe-sport-feelings/fe-sport-feelings.param.json
+0
-7
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/index.js
...uniCloud-aliyun/cloudfunctions/fe-sport-feelings/index.js
+0
-36
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/package.json
...loud-aliyun/cloudfunctions/fe-sport-feelings/package.json
+0
-7
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/index.js
...in/uniCloud-aliyun/cloudfunctions/fe-sport-index/index.js
+0
-38
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/package.json
...niCloud-aliyun/cloudfunctions/fe-sport-index/package.json
+0
-7
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/fe-sport-object.param.js
...n/cloudfunctions/fe-sport-object/fe-sport-object.param.js
+11
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js
...iCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js
+186
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/package.json
...iCloud-aliyun/cloudfunctions/fe-sport-object/package.json
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/index.js
...uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/index.js
+0
-31
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/package.json
...loud-aliyun/cloudfunctions/fe-sport-run-rank/package.json
+0
-8
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
...uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
+0
-64
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/index.js
...niCloud-aliyun/cloudfunctions/fe-sport-walk-rank/index.js
+0
-31
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/package.json
...oud-aliyun/cloudfunctions/fe-sport-walk-rank/package.json
+0
-7
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
...niCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
+0
-64
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
...oud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
+0
-7
未找到文件。
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/fe-sport-feelings.param.json
已删除
100644 → 0
浏览文件 @
55a14365
//
本文件中的json内容将在云函数【运行】时作为参数传给云函数。
//
配置教程参考:https://uniapp.dcloud.net.cn/uniCloud/rundebug.html#runparam
{
"type"
:
"跑步"
,
"id"
:
"645b8a67e1a35c371b015038"
,
"feeling"
:
"good"
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
table
;
if
(
event
.
type
==
'
跑步
'
)
table
=
'
mustgo-running-record
'
;
else
table
=
'
mustgo-walking-record
'
;
const
collection
=
db
.
collection
(
table
);
let
res
=
await
collection
.
doc
(
event
.
id
).
update
({
feelings
:
event
.
feeling
})
if
(
res
.
updated
>
0
)
{
return
{
code
:
200
,
message
:
"
保存成功
"
,
data
:
{
}
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-feelings/package.json
已删除
100644 → 0
浏览文件 @
55a14365
{
"name"
:
"fe-sport-feelings"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
fieldName
;
if
(
event
.
type
==
"
跑步
"
)
{
fieldName
=
"
total_running_distance
"
;
}
else
{
fieldName
=
"
total_walking_distance
"
;
}
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
orderBy
(
fieldName
,
"
desc
"
).
get
()
console
.
log
(
res
)
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
if
(
res
.
data
[
i
][
"
_id
"
]
==
event
.
userId
)
{
return
{
code
:
200
,
message
:
"
查询成功
"
,
data
:{
totalRunningDistance
:
res
.
data
[
i
][
fieldName
],
totalRunningRank
:
i
+
1
}
}
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/package.json
已删除
100644 → 0
浏览文件 @
55a14365
{
"name"
:
"fe-sport-run-index"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/fe-sport-object.param.js
0 → 100644
浏览文件 @
13825a23
feelings
({
type
:
"
跑步
"
,
id
:
"
645cddc5f5cf3a2df4bdb9a3
"
,
feeling
:
"
normal
"
})
index
({
type
:
"
跑步
"
,
userId
:
"
645c972809e298919852519f
"
});
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js
0 → 100644
浏览文件 @
13825a23
// 云对象教程: https://uniapp.dcloud.net.cn/uniCloud/cloud-obj
// jsdoc语法提示教程:https://ask.dcloud.net.cn/docs/#//ask.dcloud.net.cn/article/129
module
.
exports
=
{
_before
:
function
()
{
// 通用预处理器
},
async
index
(
event
)
{
// 参数校验,如无参数则不需要
if
(
!
event
.
type
)
{
return
{
code
:
400
,
message
:
"
客户端错误
"
,
data
:
{}
}
}
// 业务逻辑
const
db
=
uniCloud
.
database
();
let
fieldName
;
if
(
event
.
type
==
"
跑步
"
)
{
fieldName
=
"
total_running_distance
"
;
}
else
{
fieldName
=
"
total_walking_distance
"
;
}
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
orderBy
(
fieldName
,
"
desc
"
).
get
()
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
if
(
res
.
data
[
i
][
"
_id
"
]
==
event
.
userId
)
{
return
{
code
:
200
,
message
:
"
查询成功
"
,
data
:
{
totalRunningDistance
:
res
.
data
[
i
][
fieldName
],
totalRunningRank
:
i
+
1
}
}
}
}
// 返回结果
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{}
}
},
async
rank
(
event
)
{
const
db
=
uniCloud
.
database
();
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
fieldName
;
if
(
event
.
type
==
"
跑步
"
)
{
fieldName
=
"
total_running_distance
"
;
}
else
{
fieldName
=
"
total_walking_distance
"
;
}
let
res
=
await
collection
.
orderBy
(
fieldName
,
"
desc
"
).
get
()
console
.
log
(
res
)
let
userlist
=
new
Array
;
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
let
user
=
{
"
rank
"
:
i
+
1
,
"
icon
"
:
res
.
data
[
i
][
"
icon
"
],
"
username
"
:
res
.
data
[
i
][
"
name
"
],
"
distance
"
:
res
.
data
[
i
][
fieldName
]
}
userlist
.
push
(
user
)
}
//返回数据给客户端
return
{
"
code
"
:
200
,
"
message
"
:
"
成功返回累计排名
"
,
"
data
"
:
{
"
userList
"
:
userlist
}
}
},
async
save
(
event
)
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
table
,
fieldName
;
if
(
event
.
type
==
"
跑步
"
)
{
table
=
"
mustgo-running-record
"
;
fieldName
=
"
total_running_distance
"
;
}
else
{
table
=
"
mustgo-walking-record
"
;
fieldName
=
"
total_walking_distance
"
;
}
let
collection
=
db
.
collection
(
table
);
if
(
event
.
distance
<
0.01
)
{
return
{
code
:
400
,
message
:
"
距离过短,不予保存
"
,
data
:
{
}
}
}
let
res
=
await
collection
.
add
({
start_date
:
event
.
startTime
,
duration
:
event
.
duration
,
feelings
:
""
,
owner_id
:
event
.
userId
,
distance
:
event
.
distance
,
pace
:
event
.
pace
,
start_point
:
event
.
startPoint
,
end_point
:
event
.
endPoint
,
path_line
:
event
.
pathLine
})
console
.
log
(
res
)
let
sportId
=
res
.
id
;
// userID
collection
=
db
.
collection
(
'
mustgo-user
'
);
res
=
await
collection
.
where
({
_id
:
event
.
userId
}).
get
()
// console.log(res)
let
cur
=
res
.
data
[
0
][
fieldName
];
cur
+=
event
.
distance
res
=
await
collection
.
doc
(
event
.
userId
).
update
({
total_walking_distance
:
cur
,
})
if
(
res
.
updated
>
0
)
return
{
code
:
200
,
message
:
"
保存成功
"
,
data
:
{
id
:
sportId
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
},
async
feelings
(
event
)
{
const
db
=
uniCloud
.
database
();
let
table
;
if
(
event
.
type
==
'
跑步
'
)
table
=
'
mustgo-running-record
'
;
else
table
=
'
mustgo-walking-record
'
;
const
collection
=
db
.
collection
(
table
);
let
res
=
await
collection
.
doc
(
event
.
id
).
update
({
feelings
:
event
.
feeling
})
if
(
res
.
updated
>
0
)
{
return
{
code
:
200
,
message
:
"
保存成功
"
,
data
:
{
}
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-
run-save
/package.json
→
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-
object
/package.json
浏览文件 @
13825a23
{
"name"
:
"fe-sport-
run-save
"
,
"name"
:
"fe-sport-
object
"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
orderBy
(
"
total_running_distance
"
,
"
desc
"
).
get
()
console
.
log
(
res
)
let
userlist
=
new
Array
;
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
let
user
=
{
"
rank
"
:
i
+
1
,
"
icon
"
:
res
.
data
[
i
][
"
icon
"
],
"
username
"
:
res
.
data
[
i
][
"
name
"
],
"
distance
"
:
res
.
data
[
i
][
"
total_running_distance
"
]
}
userlist
.
push
(
user
)
}
//返回数据给客户端
return
{
"
code
"
:
200
,
"
message
"
:
"
成功返回跑步累计排名
"
,
"
data
"
:
{
"
userList
"
:
userlist
}
}
};
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/package.json
已删除
100644 → 0
浏览文件 @
55a14365
{
"name"
:
"fe-sport-run-rank"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
collection
=
db
.
collection
(
'
mustgo-running-record
'
);
if
(
event
.
distance
<
0.01
)
{
return
{
code
:
400
,
message
:
"
距离过短,不予保存
"
,
data
:
{
}
}
}
let
res
=
await
collection
.
add
({
start_date
:
event
.
startTime
,
duration
:
event
.
duration
,
feelings
:
""
,
owner_id
:
event
.
userId
,
distance
:
event
.
distance
,
pace
:
event
.
pace
,
start_point
:
event
.
startPoint
,
end_point
:
event
.
endPoint
,
path_line
:
event
.
pathLine
})
console
.
log
(
res
)
let
sportId
=
res
.
id
;
// userID
collection
=
db
.
collection
(
'
mustgo-user
'
);
res
=
await
collection
.
where
({
_id
:
event
.
userId
}).
get
()
console
.
log
(
res
)
let
cur
=
res
.
data
[
0
][
"
total_running_distance
"
];
cur
+=
event
.
distance
res
=
await
collection
.
doc
(
event
.
userId
).
update
({
total_running_distance
:
cur
,
})
if
(
res
.
updated
>
0
)
return
{
code
:
200
,
message
:
"
保存成功
"
,
data
:
{
id
:
sportId
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
orderBy
(
"
total_walking_distance
"
,
"
desc
"
).
get
()
console
.
log
(
res
)
let
userlist
=
new
Array
;
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
let
user
=
{
"
rank
"
:
i
+
1
,
"
icon
"
:
res
.
data
[
i
][
"
icon
"
],
"
username
"
:
res
.
data
[
i
][
"
name
"
],
"
distance
"
:
res
.
data
[
i
][
"
total_walking_distance
"
]
}
userlist
.
push
(
user
)
}
//返回数据给客户端
return
{
"
code
"
:
200
,
"
message
"
:
"
成功返回健走累计排名
"
,
"
data
"
:
{
"
userList
"
:
userlist
}
}
};
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/package.json
已删除
100644 → 0
浏览文件 @
55a14365
{
"name"
:
"fe-sport-walk-rank"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
已删除
100644 → 0
浏览文件 @
55a14365
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
collection
=
db
.
collection
(
'
mustgo-walking-record
'
);
if
(
event
.
distance
<
0.01
)
{
return
{
code
:
400
,
message
:
"
距离过短,不予保存
"
,
data
:
{
}
}
}
let
res
=
await
collection
.
add
({
start_date
:
event
.
startTime
,
duration
:
event
.
duration
,
feelings
:
""
,
owner_id
:
event
.
userId
,
distance
:
event
.
distance
,
pace
:
event
.
pace
,
start_point
:
event
.
startPoint
,
end_point
:
event
.
endPoint
,
path_line
:
event
.
pathLine
})
console
.
log
(
res
)
let
sportId
=
res
.
id
;
// userID
collection
=
db
.
collection
(
'
mustgo-user
'
);
res
=
await
collection
.
where
({
_id
:
event
.
userId
}).
get
()
// console.log(res)
let
cur
=
res
.
data
[
0
][
"
total_walking_distance
"
];
cur
+=
event
.
distance
res
=
await
collection
.
doc
(
event
.
userId
).
update
({
total_walking_distance
:
cur
,
})
if
(
res
.
updated
>
0
)
return
{
code
:
200
,
message
:
"
保存成功
"
,
data
:
{
id
:
sportId
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
已删除
100644 → 0
浏览文件 @
55a14365
{
"name"
:
"fe-sport-walk-save"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录