Browse Source

fix: 推送,bug

master
zhang_li 8 months ago
parent
commit
4f62940075
  1. 1
      .env.development
  2. 42
      src/App.vue
  3. 1
      src/api/http.ts
  4. 3
      src/api/login.js
  5. 5
      src/api/repairOrder.js
  6. 1
      src/api/uploadHttp.ts
  7. 1
      src/components/search/index.vue
  8. 1
      src/pages/device/index.vue
  9. 3
      src/pages/deviceReport/addForm.vue
  10. 4
      src/pages/deviceReport/index.vue
  11. 2
      src/pages/deviceReport/myDeviceReport.vue
  12. 3
      src/pages/login.vue
  13. 3
      src/pages/overhaulOrder/addForm.vue
  14. 2
      src/pages/overhaulOrder/addServiceRecord.vue
  15. 56
      src/pages/repairOrder/detail.vue
  16. 2
      src/pages/repairOrder/index.vue
  17. 1
      src/pages/repairOrder/transfer.vue
  18. 1
      src/pages/spareParts/index.vue
  19. 1
      src/pages/sparePartsApplicationApprove/index.vue
  20. 4
      src/store/modules/countStore.ts
  21. 6
      src/uni_modules/uni-config-center/changelog.md
  22. 81
      src/uni_modules/uni-config-center/package.json
  23. 93
      src/uni_modules/uni-config-center/readme.md
  24. 1
      src/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/index.js
  25. 9
      src/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/package.json
  26. 32
      src/uni_modules/uni-id-common/changelog.md
  27. 84
      src/uni_modules/uni-id-common/package.json
  28. 3
      src/uni_modules/uni-id-common/readme.md
  29. 1
      src/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/index.js
  30. 16
      src/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/package.json
  31. 16
      uniCloud-aliyun/cloudfunctions/pushMessage/index.js
  32. 7
      uniCloud-aliyun/cloudfunctions/pushMessage/package.json
  33. 12
      uniCloud-aliyun/database/JQL查询.jql

1
.env.development

@ -1,3 +1,4 @@
VITE_BASE_URL=http://192.168.0.106:12080/admin-api
#VITE_BASE_URL=http://dev.ccwin-in.com:25202/api/admin-api
VITE_BASE_URL_IMAGE=http://localhost:12080/admin-api

42
src/App.vue

@ -51,29 +51,39 @@
})
}
// #endif
// #ifdef APP-PLUS
const notificationAuthorized = uni.getAppAuthorizeSetting().notificationAuthorized
if (notificationAuthorized == 'denied') {
uni.showModal({
title: '提示',
content: '是否前往打开通知权限',
success: res => {
if (res.confirm) {
// this.openTongZhi()
} else if (res.cancel) {
}
}
})
}
plus.push.addEventListener("click", function (data) {
// 02
if(data.payload.status == 0 || data.payload.status == 2){
uni.navigateTo({
url: (`/pages/repairOrder/detail?type=${data.payload.type}&number=${data.payload.number}`)
})
}
}, false);
uni.getPushClientId({
success: (res) => {
console.log(res);
console.log(res.cid);
uni.setStorageSync('cid',res.cid)
},
fail(err) {
console.log(err)
}
})
uni.onPushMessage((res)=>{
console.log(res)
// uni.createPushMessage({
// title: '',
// content: res.data,
// payload: {},
// success: () => {
// console.log("")
// },
// fail: () => {
// console.log("")
// }
// })
uni.onPushMessage((res) => {
})
// #endif
if (getAccessToken()) {
await store.GetPermissionInfo().then(res => {
}).catch(() => { })

1
src/api/http.ts

@ -103,7 +103,6 @@ instance.interceptors.response.use((v) => {
}
return Promise.reject(v)
},error=>{
console.log(error)
uni.showToast({
title: '网络错误',
icon: 'none'

3
src/api/login.js

@ -1,7 +1,7 @@
import http from './http'
// 登录方法
export function login(username, password, captchaVerification, tenantName, rememberMe, code, uuid) {
export function login(username, password, captchaVerification, tenantName, rememberMe, code, uuid,cid) {
const data = {
username,
password,
@ -10,6 +10,7 @@ export function login(username, password, captchaVerification, tenantName, remem
rememberMe,
code,
uuid,
cid
}
return http.post('/system/auth/login', data)
}

5
src/api/repairOrder.js

@ -13,6 +13,10 @@ export function repairOrderUpdate(data) {
export function repairOrderPage(params) {
return http.get('/eam/device-maintenance-job-main/getAppPage',{params})
}
// 获取维修工单详情信息
export function getDeviceRepairDetail(number) {
return http.get('eam/device-maintenance-job-main/getAppByNumber?number='+number)
}
// 操作工单
export function orderClick(params) {
return http.get('/eam/device-maintenance-job-main/orderClick',{params})
@ -45,3 +49,4 @@ export function repairOrderList(params) {
export function getDeviceRepairDetailsByNumber(params) {
return http.get('/eam/device-repair-request/getDetailsByNumber',{params})
}

1
src/api/uploadHttp.ts

@ -58,7 +58,6 @@ upload.interceptors.request.use((config) => {
})
}
console.log(11, headers)
return {
...config,
headers

1
src/components/search/index.vue

@ -34,7 +34,6 @@
}
});
function search() {
console.log( keyWord.value)
emits('search', keyWord.value)
}
//

1
src/pages/device/index.vue

@ -78,7 +78,6 @@
if (status.value == 'nomore') return;
status.value = 'loading';
proxy.$modal.loading('加载中')
console.log('params.value',params.value)
deviceApi.devicePage(params.value).then((res) => {
proxy.$modal.closeLoading()
if (res.data.list.length > 0) {

3
src/pages/deviceReport/addForm.vue

@ -138,7 +138,6 @@
type: type.value,
flag:1
}).then((res) => {
console.log(res)
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
@ -150,7 +149,6 @@
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((err) => {
console.log(err)
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''
@ -171,7 +169,6 @@
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((err) => {
console.log(err)
form.value.deviceName = ''
form.value.factoryAreaName = ''
form.value.factoryAreaNumber = ''

4
src/pages/deviceReport/index.vue

@ -117,10 +117,8 @@
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
// console.log(err.errMsg);
}
}
});
@ -137,7 +135,7 @@
})
}
})
onShow(() => {
onShow(async() => {
params.value.pageNo = 1
list.value = []
status.value = 'loadmore'

2
src/pages/deviceReport/myDeviceReport.vue

@ -90,10 +90,8 @@
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
// console.log(err.errMsg);
}
}
});

3
src/pages/login.vue

@ -55,7 +55,8 @@
captchaVerification: "",
rememberMe: false,
code: '1',
uuid: "APP"
uuid: "APP",
cid:uni.getStorageSync('cid')
})
import { storeToRefs } from 'pinia'

3
src/pages/overhaulOrder/addForm.vue

@ -272,7 +272,6 @@
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((error) => {
console.log(error)
msg.value = error.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''
@ -282,7 +281,6 @@
moldApi.getMoldDetailsByNumber({
number: form.value.deviceNumber
}).then((res) => {
console.log(22,res)
if (!res.data) {
msg.value = res.msg
form.value.deviceName = ''
@ -294,7 +292,6 @@
form.value.factoryAreaName = res.data.factoryAreaName
form.value.factoryAreaNumber = res.data.factoryAreaNumber
}).catch((error) => {
console.log(error)
msg.value = error.msg
form.value.deviceName = ''
form.value.factoryAreaName = ''

2
src/pages/overhaulOrder/addServiceRecord.vue

@ -464,7 +464,6 @@
}
//
function chooseDatetime(e) {
console.log(e)
let array1 = []
let array2 = []
if (formatValue.value.indexOf('YYYY') > -1) {
@ -488,7 +487,6 @@
let str = array1.join('-') + ' ' + array2.join(':')
formatDate.value = str
form.value[field.value] = e.timestamp*1000
console.log(form.value[field.value] )
}
onLoad(async(option) => {
if (option.type) type.value = option.type;

56
src/pages/repairOrder/detail.vue

@ -2,6 +2,7 @@
<!-- 详情 -->
<view class="detail-container">
<view class="info">
<view class="title">
<view>维修工单</view>
<view @click="transfer"
@ -81,6 +82,8 @@
<view>{{data.verifyer}}</view>
</view>
</view>
</view>
<div class="line"></div>
<view class="info" style="padding-bottom: 130rpx;">
@ -223,6 +226,7 @@
<u-select v-model="singleColumnShow" mode="single-column" :default-value='singleColumnDefaultValue'
:list="singleColumnList" @confirm="chooseSingleColumn"></u-select>
</view>
</template>
<script setup lang="ts">
@ -257,7 +261,7 @@
name: '设备信息',
value: 1
})
const data = ref()
const data = ref({})
const loading = ref(false)
const loading1 = ref(false)
const type = ref('')
@ -266,6 +270,7 @@
const orderCompleteResult = ref([]) //
const result = ref('TEMPORARILY')
const data1 = ref('')
const number = ref('')
const singleColumnShow = ref(false)
const singleColumnDefaultValue = ref([])
@ -391,13 +396,16 @@
loading.value = false
})
}
await repairOrderApi.orderClick(dataOne).then((res) => {
await repairOrderApi.orderClick(dataOne).then(async(res) => {
if (res.data) {
proxy.$modal.showToast('操作成功')
setTimeout(() => {
proxy.$tab.navigateBack()
await getDeviceRepairDetail(number.value)
await getDeviceRepairDetailsByNumber()
loading.value = false
}, 1500)
// setTimeout(() => {
// // proxy.$tab.navigateBack()
// }, 1500)
} else {
proxy.$modal.showToast('操作失败')
loading.value = false
@ -410,10 +418,10 @@
}
}
//
function getDeviceRepairDetailsByNumber() {
repairOrderApi.getDeviceRepairDetailsByNumber({
type: data.value.type,
requestNumber: data.value.requestNumber
async function getDeviceRepairDetailsByNumber() {
await repairOrderApi.getDeviceRepairDetailsByNumber({
type: type.value,
requestNumber: number.value
}).then((res) => {
if (res.data) {
data1.value = res.data
@ -423,7 +431,7 @@
//
function getRepairOrderDetaiList() {
repairOrderApi.repairOrderDetailList({
number: data.value.number
number: number.value
}).then((res) => {
if (res.data) {
serviceList.value = res.data
@ -450,10 +458,8 @@
longPressActions: {
itemList: ['发送给朋友', '保存图片', '收藏'],
success: function (data) {
console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
},
fail: function (err) {
console.log(err.errMsg);
}
}
});
@ -472,10 +478,8 @@
//
function chooseSingleColumn(e) {
data.value[field.value] = e[0].value
console.log(field.value)
if (field.value == 'classes') {
data.value.classesName = e[0].label
console.log(data.value.classesName)
}
if (field.value == 'faultType') {
data.value.faultTypeName = e[0].label
@ -514,11 +518,25 @@
})
})
}
async function getDeviceRepairDetail(number){
await repairOrderApi.getDeviceRepairDetail(number).then((res) => {
proxy.$modal.closeLoading()
data.value = res.data
if (res.data) {
}
loading.value = false
}).catch(() => {
proxy.$modal.closeLoading()
loading.value = false
})
}
//
onLoad(async (option) => {
if (option.type) type.value = option.type;
if (option.data) {
data.value = JSON.parse(decodeURIComponent(option.data))
if (option.number) {
number.value = option.number
await getDeviceRepairDetail(number.value)
await getDeviceRepairDetailsByNumber()
}
changeItem.value = list.value[current.value]
orderCompleteResult.value = await dictApi.getDict('order_complete_result')
@ -526,8 +544,8 @@
})
onShow(async () => {
if (data.value.requestNumber) {
getDeviceRepairDetailsByNumber()
if (number.value) {
list.value = [{
name: '设备信息',
value: 1

2
src/pages/repairOrder/index.vue

@ -81,7 +81,7 @@
const status = ref('loadmore') //
const list = ref([])
function itemClick(item, index) {
proxy.$tab.navigateTo(`/pages/repairOrder/detail?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)
proxy.$tab.navigateTo(`/pages/repairOrder/detail?type=${params.value.type}&number=${item.number}`)
}
function addForm(item) {
proxy.$tab.navigateTo(`/pages/repairOrder/addForm?type=${params.value.type}&data=${encodeURIComponent(JSON.stringify(item))}`)

1
src/pages/repairOrder/transfer.vue

@ -337,7 +337,6 @@
} else {
deviceMoldType.value = deviceMoldType1.value.filter(item => item.value == type.value)
}
console.log(deviceMoldType.value)
form.value.receiverType = deviceMoldType.value[0].value
form.value.receiverTypeTxt = deviceMoldType.value[0].label
selecUserList.value = []

1
src/pages/spareParts/index.vue

@ -81,7 +81,6 @@
proxy.$modal.loading('加载中')
sparePartsApi.getSparePartsPage(params.value).then((res) => {
proxy.$modal.closeLoading()
console.log(res)
if (res.data.list.length > 0) {
list.value = list.value.concat(res.data.list);
params.value.pageNo++;

1
src/pages/sparePartsApplicationApprove/index.vue

@ -72,7 +72,6 @@
const from = ref('')
function openDetail(item, index) {
console.log(from.value)
proxy.$tab.navigateTo(`/pages/sparePartsApplication/detail?number=${item.number}&from=${from.value}`)
}
function addForm(item) {

4
src/store/modules/countStore.ts

@ -37,8 +37,10 @@ const useStore = defineStore('storeId', {
const rememberMe = userInfo.rememberMe
const code = userInfo.code
const uuid = userInfo.uuid
const cid =userInfo.cid
return new Promise((resolve, reject) => {
login(username, password, captchaVerification, tenantName, rememberMe, code, uuid).then(
login(username, password, captchaVerification, tenantName, rememberMe, code, uuid,cid).then(
res => {
res = res.data;
// 设置 token

6
src/uni_modules/uni-config-center/changelog.md

@ -0,0 +1,6 @@
## 0.0.3(2022-11-11)
- 修复 config 方法获取根节点为数组格式配置时错误的转化为了对象的Bug
## 0.0.2(2021-04-16)
- 修改插件package信息
## 0.0.1(2021-03-15)
- 初始化项目

81
src/uni_modules/uni-config-center/package.json

@ -0,0 +1,81 @@
{
"id": "uni-config-center",
"displayName": "uni-config-center",
"version": "0.0.3",
"description": "uniCloud 配置中心",
"keywords": [
"配置",
"配置中心"
],
"repository": "",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "",
"type": "unicloud-template-function"
},
"directories": {
"example": "../../../scripts/dist"
},
"uni_modules": {
"dependencies": [],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
}
}
}
}
}

93
src/uni_modules/uni-config-center/readme.md

@ -0,0 +1,93 @@
# 为什么使用uni-config-center
实际开发中很多插件需要配置文件才可以正常运行,如果每个插件都单独进行配置的话就会产生下面这样的目录结构
```bash
cloudfunctions
└─────common 公共模块
├─plugin-a // 插件A对应的目录
│ ├─index.js
│ ├─config.json // plugin-a对应的配置文件
│ └─other-file.cert // plugin-a依赖的其他文件
└─plugin-b // plugin-b对应的目录
├─index.js
└─config.json // plugin-b对应的配置文件
```
假设插件作者要发布一个项目模板,里面使用了很多需要配置的插件,无论是作者发布还是用户使用都是一个大麻烦。
uni-config-center就是用了统一管理这些配置文件的,使用uni-config-center后的目录结构如下
```bash
cloudfunctions
└─────common 公共模块
├─plugin-a // 插件A对应的目录
│ └─index.js
├─plugin-b // plugin-b对应的目录
│ └─index.js
└─uni-config-center
├─index.js // config-center入口文件
├─plugin-a
│ ├─config.json // plugin-a对应的配置文件
│ └─other-file.cert // plugin-a依赖的其他文件
└─plugin-b
└─config.json // plugin-b对应的配置文件
```
使用uni-config-center后的优势
- 配置文件统一管理,分离插件主体和配置信息,更新插件更方便
- 支持对config.json设置schema,插件使用者在HBuilderX内编写config.json文件时会有更好的提示(后续HBuilderX会提供支持)
# 用法
在要使用uni-config-center的公共模块或云函数内引入uni-config-center依赖,请参考:[使用公共模块](https://uniapp.dcloud.net.cn/uniCloud/cf-common)
```js
const createConfig = require('uni-config-center')
const uniIdConfig = createConfig({
pluginId: 'uni-id', // 插件id
defaultConfig: { // 默认配置
tokenExpiresIn: 7200,
tokenExpiresThreshold: 600,
},
customMerge: function(defaultConfig, userConfig) { // 自定义默认配置和用户配置的合并规则,不设置的情况侠会对默认配置和用户配置进行深度合并
// defaudltConfig 默认配置
// userConfig 用户配置
return Object.assign(defaultConfig, userConfig)
}
})
// 以如下配置为例
// {
// "tokenExpiresIn": 7200,
// "passwordErrorLimit": 6,
// "bindTokenToDevice": false,
// "passwordErrorRetryTime": 3600,
// "app-plus": {
// "tokenExpiresIn": 2592000
// },
// "service": {
// "sms": {
// "codeExpiresIn": 300
// }
// }
// }
// 获取配置
uniIdConfig.config() // 获取全部配置,注意:uni-config-center内不存在对应插件目录时会返回空对象
uniIdConfig.config('tokenExpiresIn') // 指定键值获取配置,返回:7200
uniIdConfig.config('service.sms.codeExpiresIn') // 指定键值获取配置,返回:300
uniIdConfig.config('tokenExpiresThreshold', 600) // 指定键值获取配置,如果不存在则取传入的默认值,返回:600
// 获取文件绝对路径
uniIdConfig.resolve('custom-token.js') // 获取uni-config-center/uni-id/custom-token.js文件的路径
// 引用文件(require)
uniIDConfig.requireFile('custom-token.js') // 使用require方式引用uni-config-center/uni-id/custom-token.js文件。文件不存在时返回undefined,文件内有其他错误导致require失败时会抛出错误。
// 判断是否包含某文件
uniIDConfig.hasFile('custom-token.js') // 配置目录是否包含某文件,true: 文件存在,false: 文件不存在
```

1
src/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/index.js

File diff suppressed because one or more lines are too long

9
src/uni_modules/uni-config-center/uniCloud/cloudfunctions/common/uni-config-center/package.json

@ -0,0 +1,9 @@
{
"name": "uni-config-center",
"version": "0.0.3",
"description": "配置中心",
"main": "index.js",
"keywords": [],
"author": "DCloud",
"license": "Apache-2.0"
}

32
src/uni_modules/uni-id-common/changelog.md

@ -0,0 +1,32 @@
## 1.0.16(2023-04-25)
- 新增maxTokenLength配置,用于限制数据库用户记录token数组的最大长度
## 1.0.15(2023-04-06)
- 修复部分语言国际化出错的Bug
## 1.0.14(2023-03-07)
- 修复 admin用户包含其他角色时未包含在token的Bug
## 1.0.13(2022-07-21)
- 修复 创建token时未传角色权限信息生成的token不正确的bug
## 1.0.12(2022-07-15)
- 提升与旧版本uni-id的兼容性(补充读取配置文件时回退平台app-plus、h5),但是仍推荐使用新平台名进行配置(app、web)
## 1.0.11(2022-07-14)
- 修复 部分情况下报`read property 'reduce' of undefined`的错误
## 1.0.10(2022-07-11)
- 将token存储在用户表的token字段内,与旧版本uni-id保持一致
## 1.0.9(2022-07-01)
- checkToken兼容token内未缓存角色权限的情况,此时将查库获取角色权限
## 1.0.8(2022-07-01)
- 修复clientDB默认依赖时部分情况下获取不到uni-id配置的Bug
## 1.0.7(2022-06-30)
- 修复config文件不合法时未抛出具体错误的Bug
## 1.0.6(2022-06-28)
- 移除插件内的数据表schema
## 1.0.5(2022-06-27)
- 修复使用多应用配置时报`Cannot read property 'appId' of undefined`的Bug
## 1.0.4(2022-06-27)
- 修复使用自定义token内容功能报错的Bug [详情](https://ask.dcloud.net.cn/question/147945)
## 1.0.2(2022-06-23)
- 对齐旧版本uni-id默认配置
## 1.0.1(2022-06-22)
- 补充对uni-config-center的依赖
## 1.0.0(2022-06-21)
- 提供uni-id token创建、校验、刷新接口,简化旧版uni-id公共模块

84
src/uni_modules/uni-id-common/package.json

@ -0,0 +1,84 @@
{
"id": "uni-id-common",
"displayName": "uni-id-common",
"version": "1.0.16",
"description": "包含uni-id token生成、校验、刷新功能的云函数公共模块",
"keywords": [
"uni-id-common",
"uniCloud",
"token",
"权限"
],
"repository": "https://gitcode.net/dcloud/uni-id-common",
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
},
"sourcecode": {
"price": "0.00"
}
},
"contact": {
"qq": ""
},
"declaration": {
"ads": "无",
"data": "无",
"permissions": "无"
},
"npmurl": "",
"type": "unicloud-template-function"
},
"uni_modules": {
"dependencies": ["uni-config-center"],
"encrypt": [],
"platforms": {
"cloud": {
"tcb": "y",
"aliyun": "y"
},
"client": {
"Vue": {
"vue2": "u",
"vue3": "u"
},
"App": {
"app-vue": "u",
"app-nvue": "u"
},
"H5-mobile": {
"Safari": "u",
"Android Browser": "u",
"微信浏览器(Android)": "u",
"QQ浏览器(Android)": "u"
},
"H5-pc": {
"Chrome": "u",
"IE": "u",
"Edge": "u",
"Firefox": "u",
"Safari": "u"
},
"小程序": {
"微信": "u",
"阿里": "u",
"百度": "u",
"字节跳动": "u",
"QQ": "u",
"钉钉": "u",
"快手": "u",
"飞书": "u",
"京东": "u"
},
"快应用": {
"华为": "u",
"联盟": "u"
}
}
}
}
}

3
src/uni_modules/uni-id-common/readme.md

@ -0,0 +1,3 @@
# uni-id-common
文档请参考:[uni-id-common](https://uniapp.dcloud.net.cn/uniCloud/uni-id-common.html)

1
src/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/index.js

File diff suppressed because one or more lines are too long

16
src/uni_modules/uni-id-common/uniCloud/cloudfunctions/common/uni-id-common/package.json

@ -0,0 +1,16 @@
{
"name": "uni-id-common",
"version": "1.0.16",
"description": "uni-id token生成、校验、刷新",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id-common.html",
"repository": {
"type": "git",
"url": "git+https://gitee.com/dcloud/uni-id-common.git"
},
"author": "DCloud",
"license": "Apache-2.0",
"dependencies": {
"uni-config-center": "file:../../../../../uni-config-center/uniCloud/cloudfunctions/common/uni-config-center"
}
}

16
uniCloud-aliyun/cloudfunctions/pushMessage/index.js

@ -0,0 +1,16 @@
'use strict';
const uniPush = uniCloud.getPushManager({
appId: "__UNI__BD5EF27"
}) //注意这里需要传入你的应用appId,用于指定接收消息的客户端
exports.main = async (event, context) => {
let obj = JSON.parse(event.body)
const res = await uniPush.sendMessage({
"push_clientid": obj.cids, // 设备id,支持多个以数组的形式指定多个设备,如["cid-1","cid-2"],数组长度不大于1000
"title": obj.title, // 标题
"content": obj.content, // 内容
"payload": obj.payload, // 数据
"force_notification": true, // 服务端推送 需要加这一句
"request_id": obj.request_id //请求唯一标识号,10-32位之间;如果request_id重复,会导致消息丢失
})
return res //一定要return回去
};

7
uniCloud-aliyun/cloudfunctions/pushMessage/package.json

@ -0,0 +1,7 @@
{
"name": "pushMessage",
"dependencies": {},
"extensions": {
"uni-cloud-push": {}
}
}

12
uniCloud-aliyun/database/JQL查询.jql

@ -0,0 +1,12 @@
// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
// 如果文档中存在多条JQL语句,只有最后一条语句生效
// 如果混写了普通js,最后一条语句需是数据库操作语句
// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
// 不支持clientDB的action
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit
// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html
// 下面示例查询uni-id-users表的所有数据
db.collection('uni-id-users').get();
Loading…
Cancel
Save