1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict';
- const db = uniCloud.database();
- exports.main = async (event, context) => {
- let result = JSON.parse(event.body)
- //event为客户端上传的参数
- let formData = {
- "app_status": result.type,
- "user_name": result.phone,
- "user_brand": result.phoneType.brand,
- "user_model": result.phoneType.model,
- "api_src": result.request.url,
- "request_parameters": result.request.data,
- "response_parameters": result.response[1].data,
- "api_status": result.response[1].data.code,
- "error_info": "7"
- }
- const collection = db.collection('cyt-logs');
- let res = await collection.add(formData)
- // db.collection('cyt-logs').add(formData).then((res) => {
- // uni.showToast({
- // title: '新增成功'
- // })
- // }).catch((err) => {
- // uni.showModal({
- // content: err.message || '请求服务失败',
- // showCancel: false
- // })
- // })
- return {
- code: 200,
- msg: "成功",
- data: res.data
- }
- };
|