Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
_milo
Great Teamwork
提交
4d63b86f
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看板
提交
4d63b86f
编写于
5月 04, 2023
作者:
M
MicroMilo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
运动模块接口实现
上级
948ff4ad
变更
18
隐藏空白更改
内联
并排
Showing
18 changed file
with
622 addition
and
270 deletion
+622
-270
alpha/admin/.hbuilderx/launch.json
alpha/admin/.hbuilderx/launch.json
+1
-1
alpha/admin/pages/demo/table/table.vue
alpha/admin/pages/demo/table/table.vue
+0
-9
alpha/admin/pages/system/mustgo-user/list.vue
alpha/admin/pages/system/mustgo-user/list.vue
+247
-207
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-register/index.js
...admin/uniCloud-aliyun/cloudfunctions/fe-register/index.js
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/index.js
...in/uniCloud-aliyun/cloudfunctions/fe-sport-index/index.js
+38
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-index/package.json
...niCloud-aliyun/cloudfunctions/fe-sport-index/package.json
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/index.js
...uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/index.js
+30
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-rank/package.json
...loud-aliyun/cloudfunctions/fe-sport-run-rank/package.json
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
...uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
+53
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/package.json
...loud-aliyun/cloudfunctions/fe-sport-run-save/package.json
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/index.js
...niCloud-aliyun/cloudfunctions/fe-sport-walk-rank/index.js
+30
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-rank/package.json
...oud-aliyun/cloudfunctions/fe-sport-walk-rank/package.json
+1
-1
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
...niCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
+53
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
...oud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
+7
-0
alpha/admin/uniCloud-aliyun/cloudfunctions/object-authentication/index.obj.js
...-aliyun/cloudfunctions/object-authentication/index.obj.js
+0
-27
alpha/admin/uniCloud-aliyun/database/mustgo-running-record.schema.json
...niCloud-aliyun/database/mustgo-running-record.schema.json
+62
-1
alpha/admin/uniCloud-aliyun/database/mustgo-user.schema.json
alpha/admin/uniCloud-aliyun/database/mustgo-user.schema.json
+34
-19
alpha/admin/uniCloud-aliyun/database/mustgo-walking-record.schema.json
...niCloud-aliyun/database/mustgo-walking-record.schema.json
+62
-1
未找到文件。
alpha/admin/.hbuilderx/launch.json
浏览文件 @
4d63b86f
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
},
},
"h5"
:
"h5"
:
{
{
"launchtype"
:
"
remote
"
"launchtype"
:
"
local
"
},
},
"type"
:
"uniCloud"
"type"
:
"uniCloud"
}
}
...
...
alpha/admin/pages/demo/table/table.vue
浏览文件 @
4d63b86f
...
@@ -46,15 +46,6 @@
...
@@ -46,15 +46,6 @@
<
script
>
<
script
>
import
tableData
from
'
./tableData.js
'
import
tableData
from
'
./tableData.js
'
// uniCloud.callFunction({
// name: 'auth',
// data: {
// phone: '15860855025',
// password: '123456'
// }
// })
// .then(res => {console.log(res);});
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
...
...
alpha/admin/pages/system/mustgo-user/list.vue
浏览文件 @
4d63b86f
<
template
>
<
template
>
<view>
<view>
<view
class=
"uni-header"
>
<view
class=
"uni-header"
>
<view
class=
"uni-group"
>
<view
class=
"uni-group"
>
<view
class=
"uni-title"
></view>
<view
class=
"uni-title"
></view>
<view
class=
"uni-sub-title"
></view>
<view
class=
"uni-sub-title"
></view>
</view>
</view>
<view
class=
"uni-group"
>
<view
class=
"uni-group"
>
<input
class=
"uni-search"
type=
"text"
v-model=
"query"
@
confirm=
"search"
placeholder=
"请输入搜索内容"
/>
<input
class=
"uni-search"
type=
"text"
v-model=
"query"
@
confirm=
"search"
placeholder=
"请输入搜索内容"
/>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
@
click=
"search"
>
搜索
</button>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
@
click=
"search"
>
搜索
</button>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
@
click=
"navigateTo('./add')"
>
新增
</button>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
@
click=
"navigateTo('./add')"
>
新增
</button>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
:disabled=
"!selectedIndexs.length"
@
click=
"delTable"
>
批量删除
</button>
<button
class=
"uni-button"
type=
"default"
size=
"mini"
:disabled=
"!selectedIndexs.length"
<download-excel
class=
"hide-on-phone"
:fields=
"exportExcel.fields"
:data=
"exportExcelData"
:type=
"exportExcel.type"
:name=
"exportExcel.filename"
>
@
click=
"delTable"
>
批量删除
</button>
<button
class=
"uni-button"
type=
"primary"
size=
"mini"
>
导出 Excel
</button>
<download-excel
class=
"hide-on-phone"
:fields=
"exportExcel.fields"
:data=
"exportExcelData"
</download-excel>
:type=
"exportExcel.type"
:name=
"exportExcel.filename"
>
</view>
<button
class=
"uni-button"
type=
"primary"
size=
"mini"
>
导出 Excel
</button>
</view>
</download-excel>
<view
class=
"uni-container"
>
</view>
<unicloud-db
ref=
"udb"
:collection=
"collectionList"
field=
""
:where=
"where"
page-data=
"replace"
</view>
:orderby=
"orderby"
:getcount=
"true"
:page-size=
"options.pageSize"
:page-current=
"options.pageCurrent"
<view
class=
"uni-container"
>
v-slot:default=
"
{data,pagination,loading,error,options}" :options="options" loadtime="manual" @load="onqueryload">
<unicloud-db
ref=
"udb"
:collection=
"collectionList"
field=
""
:where=
"where"
page-data=
"replace"
<uni-table
ref=
"table"
:loading=
"loading"
:emptyText=
"error.message || '没有更多数据'"
border
stripe
type=
"selection"
@
selection-change=
"selectionChange"
>
:orderby=
"orderby"
:getcount=
"true"
:page-size=
"options.pageSize"
:page-current=
"options.pageCurrent"
<uni-tr>
v-slot:default=
"
{data,pagination,loading,error,options}" :options="options" loadtime="manual"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
@load="onqueryload">
sortable
@
sort-change=
"sortChange($event, 'name')"
>
用户名
</uni-th>
<uni-table
ref=
"table"
:loading=
"loading"
:emptyText=
"error.message || '没有更多数据'"
border
stripe
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
type=
"selection"
@
selection-change=
"selectionChange"
>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
性别
</uni-th>
<uni-tr>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
密码
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
用户名
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
手机号
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
性别
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
学校
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
密码
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
身份
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
手机号
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
跑步总量
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
学校
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
sortable
@
sort-change=
"sortChange($event, 'name')"
>
健走总量
</uni-th>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
身份
</uni-th>
<uni-th
align=
"center"
>
操作
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
</uni-tr>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
跑步总量
</uni-th>
<uni-th
align=
"center"
filter-type=
"search"
@
filter-change=
"filterChange($event, 'name')"
<uni-tr
v-for=
"(item,index) in data"
:key=
"index"
>
sortable
@
sort-change=
"sortChange($event, 'name')"
>
健走总量
</uni-th>
<uni-td
align=
"center"
>
{{
item
.
name
}}
</uni-td>
<uni-th
align=
"center"
>
操作
</uni-th>
<uni-td
align=
"center"
>
{{
item
.
gender
}}
</uni-td>
</uni-tr>
<uni-td
align=
"center"
>
{{
item
.
password
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
phone_num
}}
</uni-td>
<uni-tr
v-for=
"(item,index) in data"
:key=
"index"
>
<uni-td
align=
"center"
>
{{
item
.
school
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
name
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
type
[
0
].
identity
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
gender
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
total_running_distance
}}
km
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
password
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
total_walking_distance
}}
km
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
phone_num
}}
</uni-td>
<uni-td
align=
"center"
>
{{
item
.
school
}}
</uni-td>
<uni-td
align=
"center"
>
<uni-td
align=
"center"
>
{{
item
.
type
[
0
].
identity
}}
</uni-td>
<view
class=
"uni-group"
>
<uni-td
align=
"center"
>
{{
item
.
total_running_distance
}}
km
</uni-td>
<button
@
click=
"navigateTo('./edit?id='+item._id, false)"
class=
"uni-button"
size=
"mini"
type=
"primary"
>
修改
</button>
<uni-td
align=
"center"
>
{{
item
.
total_walking_distance
}}
km
</uni-td>
<button
@
click=
"confirmDelete(item._id)"
class=
"uni-button"
size=
"mini"
type=
"warn"
>
删除
</button>
</view>
<uni-td
align=
"center"
>
</uni-td>
<view
class=
"uni-group"
>
<button
@
click=
"navigateTo('./edit?id='+item._id, false)"
class=
"uni-button"
size=
"mini"
</uni-tr>
type=
"primary"
>
修改
</button>
</uni-table>
<button
@
click=
"confirmDelete(item._id)"
class=
"uni-button"
size=
"mini"
<view
class=
"uni-pagination-box"
>
type=
"warn"
>
删除
</button>
<uni-pagination
show-icon
:page-size=
"pagination.size"
v-model=
"pagination.current"
:total=
"pagination.count"
@
change=
"onPageChanged"
/>
</view>
</view>
</uni-td>
</unicloud-db>
</view>
</uni-tr>
</view>
</uni-table>
<view
class=
"uni-pagination-box"
>
<uni-pagination
show-icon
:page-size=
"pagination.size"
v-model=
"pagination.current"
:total=
"pagination.count"
@
change=
"onPageChanged"
/>
</view>
</unicloud-db>
</view>
</view>
</
template
>
</
template
>
<
script
>
<
script
>
import
{
enumConverter
,
filterToWhere
}
from
'
../../../js_sdk/validator/mustgo-user.js
'
;
import
{
enumConverter
,
filterToWhere
}
from
'
../../../js_sdk/validator/mustgo-user.js
'
;
uniCloud
.
callFunction
({
name
:
'
fe-sport-walk-rank
'
,
data
:
{
startTime
:
"
2023-04-28 11:13:54
"
,
duration
:
1000
,
feelings
:
"
good
"
,
userId
:
"
644a643a0c801ca878983559
"
,
distance
:
5.98
,
pace
:
5.1
,
startPoint
:
{
"
longitude
"
:
116.39
,
"
latitude
"
:
39.9
},
endPoint
:
{
"
longitude
"
:
117.9891
,
"
latitude
"
:
40.98
},
pathLine
:
[{
"
longitude
"
:
116.39
,
"
latitude
"
:
39.9
},
{
"
longitude
"
:
117.9891
,
"
latitude
"
:
40.98
}]
}
})
.
then
(
res
=>
{
console
.
log
(
res
);
});
const
db
=
uniCloud
.
database
()
const
db
=
uniCloud
.
database
()
// 表查询配置
// 表查询配置
const
dbOrderBy
=
''
// 排序字段
const
dbOrderBy
=
''
// 排序字段
const
dbSearchFields
=
[]
// 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name
const
dbSearchFields
=
[]
// 模糊搜索字段,支持模糊搜索的字段列表。联表查询格式: 主表字段名.副表字段名,例如用户表关联角色表 role.role_name
// 分页配置
// 分页配置
const
pageSize
=
20
const
pageSize
=
20
const
pageCurrent
=
1
const
pageCurrent
=
1
const
orderByMapping
=
{
const
orderByMapping
=
{
"
ascending
"
:
"
asc
"
,
"
ascending
"
:
"
asc
"
,
"
descending
"
:
"
desc
"
"
descending
"
:
"
desc
"
}
}
export
default
{
export
default
{
data
()
{
data
()
{
return
{
return
{
collectionList
:
"
mustgo-user,mustgo-role
"
,
collectionList
:
"
mustgo-user,mustgo-role
"
,
query
:
''
,
query
:
''
,
where
:
''
,
where
:
''
,
orderby
:
dbOrderBy
,
orderby
:
dbOrderBy
,
orderByFieldName
:
""
,
orderByFieldName
:
""
,
selectedIndexs
:
[],
selectedIndexs
:
[],
options
:
{
options
:
{
pageSize
,
pageSize
,
pageCurrent
,
pageCurrent
,
filterData
:
{},
filterData
:
{},
...
enumConverter
...
enumConverter
},
},
imageStyles
:
{
imageStyles
:
{
width
:
64
,
width
:
64
,
height
:
64
height
:
64
},
},
exportExcel
:
{
exportExcel
:
{
"
filename
"
:
"
mustgo-user.xls
"
,
"
filename
"
:
"
mustgo-user.xls
"
,
"
type
"
:
"
xls
"
,
"
type
"
:
"
xls
"
,
"
fields
"
:
{}
"
fields
"
:
{}
},
},
exportExcelData
:
[]
exportExcelData
:
[]
}
}
},
},
onLoad
()
{
onLoad
()
{
this
.
_filter
=
{}
this
.
_filter
=
{}
},
},
onReady
()
{
onReady
()
{
this
.
$refs
.
udb
.
loadData
()
this
.
$refs
.
udb
.
loadData
()
},
},
methods
:
{
methods
:
{
onqueryload
(
data
)
{
onqueryload
(
data
)
{
this
.
exportExcelData
=
data
this
.
exportExcelData
=
data
},
},
getWhere
()
{
getWhere
()
{
const
query
=
this
.
query
.
trim
()
const
query
=
this
.
query
.
trim
()
if
(
!
query
)
{
if
(
!
query
)
{
return
''
return
''
}
}
const
queryRe
=
new
RegExp
(
query
,
'
i
'
)
const
queryRe
=
new
RegExp
(
query
,
'
i
'
)
return
dbSearchFields
.
map
(
name
=>
queryRe
+
'
.test(
'
+
name
+
'
)
'
).
join
(
'
||
'
)
return
dbSearchFields
.
map
(
name
=>
queryRe
+
'
.test(
'
+
name
+
'
)
'
).
join
(
'
||
'
)
},
},
search
()
{
search
()
{
const
newWhere
=
this
.
getWhere
()
const
newWhere
=
this
.
getWhere
()
this
.
where
=
newWhere
this
.
where
=
newWhere
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
loadData
()
this
.
loadData
()
})
})
},
},
loadData
(
clear
=
true
)
{
loadData
(
clear
=
true
)
{
this
.
$refs
.
udb
.
loadData
({
this
.
$refs
.
udb
.
loadData
({
clear
clear
})
})
},
},
onPageChanged
(
e
)
{
onPageChanged
(
e
)
{
this
.
selectedIndexs
.
length
=
0
this
.
selectedIndexs
.
length
=
0
this
.
$refs
.
table
.
clearSelection
()
this
.
$refs
.
table
.
clearSelection
()
this
.
$refs
.
udb
.
loadData
({
this
.
$refs
.
udb
.
loadData
({
current
:
e
.
current
current
:
e
.
current
})
})
},
},
navigateTo
(
url
,
clear
)
{
navigateTo
(
url
,
clear
)
{
// clear 表示刷新列表时是否清除页码,true 表示刷新并回到列表第 1 页,默认为 true
// clear 表示刷新列表时是否清除页码,true 表示刷新并回到列表第 1 页,默认为 true
uni
.
navigateTo
({
uni
.
navigateTo
({
url
,
url
,
events
:
{
events
:
{
refreshData
:
()
=>
{
refreshData
:
()
=>
{
this
.
loadData
(
clear
)
this
.
loadData
(
clear
)
}
}
}
}
})
})
},
},
// 多选处理
// 多选处理
selectedItems
()
{
selectedItems
()
{
var
dataList
=
this
.
$refs
.
udb
.
dataList
var
dataList
=
this
.
$refs
.
udb
.
dataList
return
this
.
selectedIndexs
.
map
(
i
=>
dataList
[
i
].
_id
)
return
this
.
selectedIndexs
.
map
(
i
=>
dataList
[
i
].
_id
)
},
},
// 批量删除
// 批量删除
delTable
()
{
delTable
()
{
this
.
$refs
.
udb
.
remove
(
this
.
selectedItems
(),
{
this
.
$refs
.
udb
.
remove
(
this
.
selectedItems
(),
{
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
this
.
$refs
.
table
.
clearSelection
()
this
.
$refs
.
table
.
clearSelection
()
}
}
})
})
},
},
// 多选
// 多选
selectionChange
(
e
)
{
selectionChange
(
e
)
{
this
.
selectedIndexs
=
e
.
detail
.
index
this
.
selectedIndexs
=
e
.
detail
.
index
},
},
confirmDelete
(
id
)
{
confirmDelete
(
id
)
{
this
.
$refs
.
udb
.
remove
(
id
,
{
this
.
$refs
.
udb
.
remove
(
id
,
{
success
:
(
res
)
=>
{
success
:
(
res
)
=>
{
this
.
$refs
.
table
.
clearSelection
()
this
.
$refs
.
table
.
clearSelection
()
}
}
})
})
},
},
sortChange
(
e
,
name
)
{
sortChange
(
e
,
name
)
{
this
.
orderByFieldName
=
name
;
this
.
orderByFieldName
=
name
;
if
(
e
.
order
)
{
if
(
e
.
order
)
{
this
.
orderby
=
name
+
'
'
+
orderByMapping
[
e
.
order
]
this
.
orderby
=
name
+
'
'
+
orderByMapping
[
e
.
order
]
}
else
{
}
else
{
this
.
orderby
=
''
this
.
orderby
=
''
}
}
this
.
$refs
.
table
.
clearSelection
()
this
.
$refs
.
table
.
clearSelection
()
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
udb
.
loadData
()
this
.
$refs
.
udb
.
loadData
()
})
})
},
},
filterChange
(
e
,
name
)
{
filterChange
(
e
,
name
)
{
this
.
_filter
[
name
]
=
{
this
.
_filter
[
name
]
=
{
type
:
e
.
filterType
,
type
:
e
.
filterType
,
value
:
e
.
filter
value
:
e
.
filter
}
}
let
newWhere
=
filterToWhere
(
this
.
_filter
,
db
.
command
)
let
newWhere
=
filterToWhere
(
this
.
_filter
,
db
.
command
)
if
(
Object
.
keys
(
newWhere
).
length
)
{
if
(
Object
.
keys
(
newWhere
).
length
)
{
this
.
where
=
newWhere
this
.
where
=
newWhere
}
else
{
}
else
{
this
.
where
=
''
this
.
where
=
''
}
}
this
.
$nextTick
(()
=>
{
this
.
$nextTick
(()
=>
{
this
.
$refs
.
udb
.
loadData
()
this
.
$refs
.
udb
.
loadData
()
})
})
}
}
}
}
}
}
</
script
>
</
script
>
<
style
>
<
style
>
</
style
>
</
style
>
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-register/index.js
浏览文件 @
4d63b86f
...
@@ -10,7 +10,7 @@ exports.main = async (event, context) => {
...
@@ -10,7 +10,7 @@ exports.main = async (event, context) => {
name
:
event
.
username
,
name
:
event
.
username
,
gender
:
event
.
gender
,
gender
:
event
.
gender
,
password
:
event
.
password
,
password
:
event
.
password
,
phone_num
:
event
.
phone
_num
,
phone_num
:
event
.
phone
,
team_id
:
""
,
team_id
:
""
,
school
:
event
.
school
,
school
:
event
.
school
,
type
:
"
644a64c228064a7587cd79bf
"
,
type
:
"
644a64c228064a7587cd79bf
"
,
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/
auth
/index.js
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-index
/index.js
浏览文件 @
4d63b86f
...
@@ -4,31 +4,34 @@ exports.main = async (event, context) => {
...
@@ -4,31 +4,34 @@ exports.main = async (event, context) => {
console
.
log
(
'
event :
'
,
event
)
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
const
db
=
uniCloud
.
database
();
let
fieldName
;
if
(
event
.
type
==
"
跑步
"
)
{
fieldName
=
"
total_running_distance
"
;
}
else
{
fieldName
=
"
total_walking_distance
"
;
}
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
// let {phone, password} = event
// let queryStringParameters = event.queryStringParameters
// let phone = queryStringParameters['phone']
// let password = queryStringParameters['password']
let
res
=
await
collection
.
where
({
let
res
=
await
collection
.
orderBy
(
fieldName
,
"
desc
"
).
get
()
phone_num
:
event
.
phone
console
.
log
(
res
)
}).
get
()
console
.
log
(
res
.
data
[
0
])
if
(
res
.
data
[
0
][
"
password
"
]
==
event
.
password
)
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
return
{
if
(
res
.
data
[
i
][
"
_id
"
]
==
event
.
userId
)
{
code
:
200
,
return
{
message
:
"
登录成功
"
,
code
:
200
,
data
:
{
message
:
"
查询成功
"
,
userId
:
res
.
data
[
0
][
"
_id
"
]
data
:{
totalRunningDistance
:
res
.
data
[
i
][
fieldName
],
totalRunningRank
:
i
+
1
}
}
}
}
}
}
//返回数据给客户端
//返回数据给客户端
return
{
return
{
code
:
4
00
,
code
:
5
00
,
message
:
"
用户名或密码
错误
"
,
message
:
"
服务器
错误
"
,
data
:
{
data
:
{
}
}
}
}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/
register
/package.json
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-index
/package.json
浏览文件 @
4d63b86f
{
{
"name"
:
"
register
"
,
"name"
:
"
fe-sport-run-index
"
,
"dependencies"
:
{},
"dependencies"
:
{},
"extensions"
:
{
"extensions"
:
{
"uni-cloud-jql"
:
{}
"uni-cloud-jql"
:
{}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/
login
/index.js
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-run-rank
/index.js
浏览文件 @
4d63b86f
...
@@ -2,29 +2,29 @@
...
@@ -2,29 +2,29 @@
exports
.
main
=
async
(
event
,
context
)
=>
{
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
const
db
=
uniCloud
.
database
();
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
where
({
let
res
=
await
collection
.
orderBy
(
"
total_running_distance
"
,
"
desc
"
).
get
()
phone_num
:
event
.
phone
console
.
log
(
res
)
}).
get
()
console
.
log
(
res
.
data
[
0
])
let
userlist
=
new
Array
;
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
if
(
res
.
data
[
0
][
"
password
"
]
==
event
.
password
)
let
user
=
{
return
{
"
icon
"
:
res
.
data
[
i
][
"
icon
"
],
code
:
200
,
"
username
"
:
res
.
data
[
i
][
"
name
"
],
message
:
"
登录成功
"
,
"
distance
"
:
res
.
data
[
i
][
"
total_running_distance
"
]
data
:
{
userId
:
res
.
data
[
0
][
"
_id
"
]
}
}
}
userlist
.
push
(
user
)
}
//返回数据给客户端
//返回数据给客户端
return
{
return
{
code
:
4
00
,
"
code
"
:
2
00
,
message
:
"
用户名或密码错误
"
,
"
message
"
:
"
成功返回跑步累计排名
"
,
data
:
{
"
data
"
:
{
}
"
userList
"
:
userlist
}
}
};
}
};
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/
object-authentication
/package.json
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-run-rank
/package.json
浏览文件 @
4d63b86f
{
{
"name"
:
"
object-register
"
,
"name"
:
"
fe-sport-run-rank
"
,
"dependencies"
:
{},
"dependencies"
:
{},
"extensions"
:
{
"extensions"
:
{
"uni-cloud-jql"
:
{}
"uni-cloud-jql"
:
{}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js
0 → 100644
浏览文件 @
4d63b86f
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
collection
=
db
.
collection
(
'
mustgo-running-record
'
);
let
res
=
await
collection
.
add
({
start_date
:
event
.
startTime
,
duration
:
event
.
duration
,
feelings
:
event
.
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
)
// 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
:
{
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/
auth
/package.json
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-run-save
/package.json
浏览文件 @
4d63b86f
{
{
"name"
:
"
auth
"
,
"name"
:
"
fe-sport-run-save
"
,
"dependencies"
:
{},
"dependencies"
:
{},
"extensions"
:
{
"extensions"
:
{
"uni-cloud-jql"
:
{}
"uni-cloud-jql"
:
{}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/
register
/index.js
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-walk-rank
/index.js
浏览文件 @
4d63b86f
...
@@ -2,33 +2,29 @@
...
@@ -2,33 +2,29 @@
exports
.
main
=
async
(
event
,
context
)
=>
{
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
const
db
=
uniCloud
.
database
();
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
const
collection
=
db
.
collection
(
'
mustgo-user
'
);
let
res
=
await
collection
.
add
({
let
res
=
await
collection
.
orderBy
(
"
total_walking_distance
"
,
"
desc
"
).
get
()
name
:
event
.
username
,
console
.
log
(
res
)
gender
:
event
.
gender
,
password
:
event
.
password
,
let
userlist
=
new
Array
;
phone_num
:
event
.
phone_num
,
for
(
let
i
=
0
;
i
<
res
.
data
.
length
;
i
++
)
{
school
:
event
.
school
let
user
=
{
})
"
icon
"
:
res
.
data
[
i
][
"
icon
"
],
console
.
log
(
res
.
updated
)
"
username
"
:
res
.
data
[
i
][
"
name
"
],
"
distance
"
:
res
.
data
[
i
][
"
total_walking_distance
"
]
if
(
res
.
updated
>
0
)
return
{
code
:
200
,
message
:
"
注册成功
"
,
data
:
{
}
}
}
userlist
.
push
(
user
)
}
//返回数据给客户端
//返回数据给客户端
return
{
return
{
code
:
4
00
,
"
code
"
:
2
00
,
message
:
"
注册失败
"
,
"
message
"
:
"
成功返回健走累计排名
"
,
data
:
{
"
data
"
:
{
}
"
userList
"
:
userlist
}
}
};
}
};
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/
login
/package.json
→
alpha/admin/uniCloud-aliyun/cloudfunctions/
fe-sport-walk-rank
/package.json
浏览文件 @
4d63b86f
{
{
"name"
:
"
auth
"
,
"name"
:
"
fe-sport-walk-rank
"
,
"dependencies"
:
{},
"dependencies"
:
{},
"extensions"
:
{
"extensions"
:
{
"uni-cloud-jql"
:
{}
"uni-cloud-jql"
:
{}
...
...
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js
0 → 100644
浏览文件 @
4d63b86f
'
use strict
'
;
exports
.
main
=
async
(
event
,
context
)
=>
{
//event为客户端上传的参数
console
.
log
(
'
event :
'
,
event
)
const
db
=
uniCloud
.
database
();
let
collection
=
db
.
collection
(
'
mustgo-walking-record
'
);
let
res
=
await
collection
.
add
({
start_date
:
event
.
startTime
,
duration
:
event
.
duration
,
feelings
:
event
.
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
)
// 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
:
{
}
}
//返回数据给客户端
return
{
code
:
500
,
message
:
"
服务器错误
"
,
data
:
{
}
}
};
alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/package.json
0 → 100644
浏览文件 @
4d63b86f
{
"name"
:
"fe-sport-walk-save"
,
"dependencies"
:
{},
"extensions"
:
{
"uni-cloud-jql"
:
{}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/cloudfunctions/object-authentication/index.obj.js
已删除
100644 → 0
浏览文件 @
948ff4ad
// 云对象教程: 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
()
{
// 通用预处理器
},
/**
* register 方法描述
*/
login
(
phone
,
password
)
{
phone
=
phone
.
trim
()
password
=
password
.
trim
()
if
(
!
phone
||
!
password
)
{
return
{
code
:
'
400
'
,
message
:
'
用户名或密码错误
'
}
}
// 业务逻辑
// 返回结果
return
{
code
:
'
200
'
,
message
:
'
登录成功
'
}
}
}
alpha/admin/uniCloud-aliyun/database/mustgo-running-record.schema.json
浏览文件 @
4d63b86f
{
"bsonType"
:
"object"
,
"required"
:[],
"permission"
:{
"read"
:
false
,
"create"
:
false
,
"update"
:
false
,
"delete"
:
false
},
"properties"
:{
"_id"
:{
"description"
:
"ID,系统自动生成"
}}}
{
\ No newline at end of file
"bsonType"
:
"object"
,
"required"
:
[],
"permission"
:
{
"read"
:
true
,
"create"
:
true
,
"update"
:
true
,
"delete"
:
true
},
"properties"
:
{
"_id"
:
{
"title"
:
"id"
,
"description"
:
"ID,系统自动生成"
},
"start_date"
:
{
"bsonType"
:
"string"
,
"title"
:
"开始时间"
,
"description"
:
"运动开始时间"
},
"duration"
:
{
"bsonType"
:
"int"
,
"title"
:
"持续时间"
,
"description"
:
"运动持续时间"
},
"feelings"
:
{
"bsonType"
:
"string"
,
"title"
:
"感受"
,
"description"
:
"运动感受"
},
"owner_id"
:
{
"bsonType"
:
"string"
,
"title"
:
"用户id"
,
"description"
:
"用户id"
,
"foreignKey"
:
"mustgo-user._id"
},
"distance"
:
{
"bsonType"
:
"double"
,
"title"
:
"距离"
,
"description"
:
"运动距离"
},
"pace"
:
{
"bsonType"
:
"double"
,
"title"
:
"配速"
,
"description"
:
"运动配速"
},
"start_point"
:
{
"bsonType"
:
"object"
,
"title"
:
"起始地点"
,
"description"
:
"运动起始地点,经纬度"
},
"end_point"
:
{
"bsonType"
:
"object"
,
"title"
:
"结束地点"
,
"description"
:
"运动结束地点,经纬度"
},
"path_line"
:
{
"bsonType"
:
"array"
,
"title"
:
"路线"
,
"description"
:
"运动路线"
}
}
}
\ No newline at end of file
alpha/admin/uniCloud-aliyun/database/mustgo-user.schema.json
浏览文件 @
4d63b86f
<<<<<<<
HEAD
{
"bsonType"
:
"object"
,
"required"
:[],
"permission"
:{
"read"
:
false
,
"create"
:
true
,
"update"
:
false
,
"delete"
:
false
},
"properties"
:{
"_id"
:{
"description"
:
"ID,系统自动生成"
},
"name"
:{
"bsonType"
:
"string"
},
"icon"
:{
"bsonType"
:
"string"
},
"gender"
:{
"bsonType"
:
"string"
},
"password"
:{
"bsonType"
:
"string"
},
"phone_num"
:{
"bsonType"
:
"string"
},
"team_id"
:{
"bsonType"
:
"string"
,
"defaultValue"
:
""
},
"school"
:{
"bsonType"
:
"string"
},
"type"
:{
"bsonType"
:
"string"
,
"foreignKey"
:
"mustgo-role._id"
},
"total_running_distance"
:{
"bsonType"
:
"double"
,
"defaultValue"
:
0
},
"total_walking_distance"
:{
"bsonType"
:
"double"
,
"defaultValue"
:
0
}}}
=======
{
{
"bsonType"
:
"object"
,
"bsonType"
:
"object"
,
"required"
:
[],
"required"
:
[],
"permission"
:
{
"permission"
:
{
"read"
:
fals
e
,
"read"
:
tru
e
,
"create"
:
true
,
"create"
:
true
,
"update"
:
fals
e
,
"update"
:
tru
e
,
"delete"
:
fals
e
"delete"
:
tru
e
},
},
"properties"
:
{
"properties"
:
{
"_id"
:
{
"_id"
:
{
"title"
:
"id"
,
"description"
:
"ID,系统自动生成"
"description"
:
"ID,系统自动生成"
},
},
"name"
:
{
"name"
:
{
"bsonType"
:
"string"
"bsonType"
:
"string"
,
"title"
:
"姓名"
,
"description"
:
"用户姓名"
},
},
"icon"
:
{
"icon"
:
{
"bsonType"
:
"string"
,
"bsonType"
:
"string"
,
"
description"
:
"用户
头像"
,
"
title"
:
"
头像"
,
"de
faultValue"
:
"https://mp-6f6feaec-a026-4402-8e8d-18f7572890da.cdn.bspapp.com/cloudstorage/0510a534-dd8d-41f0-8341-601aa677e243.jpg
"
"de
scription"
:
"用户头像
"
},
},
"gender"
:
{
"gender"
:
{
"bsonType"
:
"string"
"bsonType"
:
"string"
,
"title"
:
"性别"
,
"description"
:
"用户性别"
},
},
"password"
:
{
"password"
:
{
"bsonType"
:
"string"
"bsonType"
:
"string"
,
"title"
:
"密码"
,
"description"
:
"用户密码"
},
},
"phone_num"
:
{
"phone_num"
:
{
"bsonType"
:
"string"
"bsonType"
:
"string"
,
"title"
:
"手机号码"
,
"description"
:
"用户手机号码"
},
},
"team_id"
:
{
"team_id"
:
{
"bsonType"
:
"string"
,
"bsonType"
:
"string"
,
"defaultValue"
:
""
"defaultValue"
:
""
,
"title"
:
"小队id"
,
"description"
:
"用户所属小队id"
},
},
"school"
:
{
"school"
:
{
"bsonType"
:
"string"
"bsonType"
:
"string"
,
"title"
:
"学校"
,
"description"
:
"用户所属学校"
},
},
"type"
:
{
"type"
:
{
"bsonType"
:
"string"
,
"bsonType"
:
"string"
,
"foreignKey"
:
"mustgo-role._id"
"foreignKey"
:
"mustgo-role._id"
,
"title"
:
"类型"
,
"description"
:
"用户类型"
},
},
"total_running_distance"
:
{
"total_running_distance"
:
{
"bsonType"
:
"double"
,
"bsonType"
:
"double"
,
"defaultValue"
:
0
"defaultValue"
:
0
,
"title"
:
"总跑步距离"
,
"description"
:
"用户总跑步距离"
},
},
"total_walking_distance"
:
{
"total_walking_distance"
:
{
"bsonType"
:
"double"
,
"bsonType"
:
"double"
,
"defaultValue"
:
0
"defaultValue"
:
0
,
"title"
:
"总健走距离"
,
"description"
:
"用户总健走距离"
}
}
}
}
}
}
>>>>>>>
9039
ca
03
ce
0
a
452
fbd
2
b
009e72
becba
2
ca
46
c
23
b
\ No newline at end of file
alpha/admin/uniCloud-aliyun/database/mustgo-walking-record.schema.json
浏览文件 @
4d63b86f
{
"bsonType"
:
"object"
,
"required"
:[],
"permission"
:{
"read"
:
false
,
"create"
:
false
,
"update"
:
false
,
"delete"
:
false
},
"properties"
:{
"_id"
:{
"description"
:
"ID,系统自动生成"
}}}
{
\ No newline at end of file
"bsonType"
:
"object"
,
"required"
:
[],
"permission"
:
{
"read"
:
true
,
"create"
:
true
,
"update"
:
true
,
"delete"
:
true
},
"properties"
:
{
"_id"
:
{
"title"
:
"id"
,
"description"
:
"ID,系统自动生成"
},
"start_date"
:
{
"bsonType"
:
"string"
,
"title"
:
"开始时间"
,
"description"
:
"运动开始时间"
},
"duration"
:
{
"bsonType"
:
"int"
,
"title"
:
"持续时间"
,
"description"
:
"运动持续时间"
},
"feelings"
:
{
"bsonType"
:
"string"
,
"title"
:
"感受"
,
"description"
:
"运动感受"
},
"owner_id"
:
{
"bsonType"
:
"string"
,
"title"
:
"用户id"
,
"description"
:
"用户id"
,
"foreignKey"
:
"mustgo-user._id"
},
"distance"
:
{
"bsonType"
:
"double"
,
"title"
:
"距离"
,
"description"
:
"运动距离"
},
"steps"
:
{
"bsonType"
:
"int"
,
"title"
:
"步数"
,
"description"
:
"健走步数"
},
"start_point"
:
{
"bsonType"
:
"object"
,
"title"
:
"起始地点"
,
"description"
:
"运动起始地点,经纬度"
},
"end_point"
:
{
"bsonType"
:
"object"
,
"title"
:
"结束地点"
,
"description"
:
"运动结束地点,经纬度"
},
"path_line"
:
{
"bsonType"
:
"array"
,
"title"
:
"路线"
,
"description"
:
"运动路线"
}
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录