From 41193d186d157937ba052e73dd04c12018e9ecab Mon Sep 17 00:00:00 2001 From: 祖安之光 <11848914+light-of-zuan@user.noreply.gitee.com> Date: 星期四, 07 八月 2025 10:38:42 +0800 Subject: [PATCH] 新增 --- /dev/null | 14 -------------- 1 files changed, 0 insertions(+), 14 deletions(-) diff --git a/cloud/getHazmatFlow/config.json b/cloud/getHazmatFlow/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getHazmatFlow/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getHazmatFlow/index.js b/cloud/getHazmatFlow/index.js deleted file mode 100644 index 69a9dad..0000000 --- a/cloud/getHazmatFlow/index.js +++ /dev/null @@ -1,70 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') - -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境 - -// 云函数入口函数 -exports.main = async (event, context) => { - // const wxContext = cloud.getWXContext() - // return { - // event, - // openid: wxContext.OPENID, - // appid: wxContext.APPID, - // unionid: wxContext.UNIONID, - // } - let {userInfo,hazmatId} = event - return cloud.database().collection("hazmatFlowList").aggregate() - .lookup({ - from: "userList", - localField: 'create_id', - foreignField: 'id', - as: 'user' - }) - .unwind({ - path: "$user", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "departmentList", - localField: "user.depart_id", - foreignField: "id", - as: "user.department" - }) - .unwind({ - path: "$user.department", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "hazmatBasic", - localField: 'basic_id', - foreignField: 'id', - as: 'hazmatBasic' - }) - .unwind({ - path: "$hazmatBasic", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "hazmatList", - localField: 'hazmat_id', - foreignField: 'id', - as: 'codeTemp' - }) - .addFields({ - code: { $arrayElemAt: ["$codeTemp.code", 0] } - }) - .project({ - codeTemp: 0 - }) - .match({ - hazmat_id: hazmatId - }) - .end({ - success: function (res) { - return res; - }, - fail(error) { - return error; - } - }) -} \ No newline at end of file diff --git a/cloud/getHazmatFlow/package.json b/cloud/getHazmatFlow/package.json deleted file mode 100644 index fa4cd74..0000000 --- a/cloud/getHazmatFlow/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "getHazmatFlow", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file diff --git a/cloud/getHazmatFlowByPage/config.json b/cloud/getHazmatFlowByPage/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getHazmatFlowByPage/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getHazmatFlowByPage/index.js b/cloud/getHazmatFlowByPage/index.js deleted file mode 100644 index f875b45..0000000 --- a/cloud/getHazmatFlowByPage/index.js +++ /dev/null @@ -1,95 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) - -// 云函数入口函数 -exports.main = async (event, context) => { - try { - const db = cloud.database() - const { pageNum = 1, pageSize = 10 } = event - - // 获取总数 - const countRes = await db.collection('hazmatFlowList').where({ - create_id: event.userId - }).count() - const total = countRes.total - - // 获取分页数据 - const listRes = await db.collection('hazmatFlowList').aggregate() - .lookup({ - from: "userList", - localField: "create_id", - foreignField: "id", - as: "user" - }) - .unwind({ - path: "$user", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "departmentList", - localField: "user.depart_id", - foreignField: "id", - as: "user.department" - }) - .unwind({ - path: "$user.department", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "companyList", - localField: "user.company_id", - foreignField: "id", - as: "user.company" - }) - .unwind({ - path: "$user.company", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "hazmatBasic", - localField: "basic_id", - foreignField: "id", - as: "hazmatBasic" - }) - .unwind({ - path: "$hazmatBasic", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "hazmatList", - localField: "hazmat_id", - foreignField: "id", - as: "codeTemp" - }) - .addFields({ - code: { $arrayElemAt: ["$codeTemp.code", 0] } - }) - .project({ - codeTemp: 0 - }) - .match({ - create_id: event.userId - }) - .addFields( - { sortTime: { $ifNull: [{ $toDate: "$update_time" }, { $toDate: "$create_time" }] } }) - .sort({ sortTime: -1 }) - .skip((pageNum - 1) * pageSize) - .limit(pageSize) - .end() - return { - list: listRes.list, - total, - pageNum: Number(pageNum), - pageSize: Number(pageSize), - hasMore: (pageNum * pageSize) < total - } - } catch (err) { - console.error('云函数异常:', err) - return { - code: 500, - message: '服务器异常', - error: err.message - } - } -} \ No newline at end of file diff --git a/cloud/getHazmatFlowByPage/package.json b/cloud/getHazmatFlowByPage/package.json deleted file mode 100644 index 1d0d6bd..0000000 --- a/cloud/getHazmatFlowByPage/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "getHazmatFlowByPage", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file diff --git a/cloud/getHazmatInfo/config.json b/cloud/getHazmatInfo/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getHazmatInfo/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getHazmatInfo/index.js b/cloud/getHazmatInfo/index.js deleted file mode 100644 index b3e1cdb..0000000 --- a/cloud/getHazmatInfo/index.js +++ /dev/null @@ -1,39 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') - -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境 - -// 云函数入口函数 -exports.main = async (event, context) => { - // const wxContext = cloud.getWXContext() - // return { - // event, - // openid: wxContext.OPENID, - // appid: wxContext.APPID, - // unionid: wxContext.UNIONID, - // } - - let {userInfo,code} = event - return cloud.database().collection("hazmatList").aggregate() - .lookup({ - from: "hazmatBasic", - localField: 'basic_id', - foreignField: 'id', - as: 'hazmatBasic' - }) - .unwind({ - path: "$hazmatBasic", - preserveNullAndEmptyArrays: true - }) - .match({ - code: code - }) - .end({ - success: function (res) { - return res; - }, - fail(error) { - return error; - } - }) -} \ No newline at end of file diff --git a/cloud/getHazmatInfo/package.json b/cloud/getHazmatInfo/package.json deleted file mode 100644 index 35695f2..0000000 --- a/cloud/getHazmatInfo/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "hetHazmatInfo", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file diff --git a/cloud/getProductFlow/config.json b/cloud/getProductFlow/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getProductFlow/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getProductFlow/index.js b/cloud/getProductFlow/index.js deleted file mode 100644 index d18b385..0000000 --- a/cloud/getProductFlow/index.js +++ /dev/null @@ -1,70 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') - -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境 - -// 云函数入口函数 -exports.main = async (event, context) => { - // const wxContext = cloud.getWXContext() - // return { - // event, - // openid: wxContext.OPENID, - // appid: wxContext.APPID, - // unionid: wxContext.UNIONID, - // } - let {userInfo,productId} = event - return cloud.database().collection("productFlowList").aggregate() - .lookup({ - from: "userList", - localField: 'create_id', - foreignField: 'id', - as: 'user' - }) - .unwind({ - path: "$user", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "departmentList", - localField: "user.depart_id", - foreignField: "id", - as: "user.department" - }) - .unwind({ - path: "$user.department", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "productBasic", - localField: 'basic_id', - foreignField: 'id', - as: 'productBasic' - }) - .unwind({ - path: "$productBasic", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "productList", - localField: 'product_id', - foreignField: 'id', - as: 'codeTemp' - }) - .addFields({ - code: { $arrayElemAt: ["$codeTemp.code", 0] } - }) - .project({ - codeTemp: 0 - }) - .match({ - product_id: productId - }) - .end({ - success: function (res) { - return res; - }, - fail(error) { - return error; - } - }) -} \ No newline at end of file diff --git a/cloud/getProductFlow/package.json b/cloud/getProductFlow/package.json deleted file mode 100644 index fa4cd74..0000000 --- a/cloud/getProductFlow/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "getHazmatFlow", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file diff --git a/cloud/getProductFlowByPage/config.json b/cloud/getProductFlowByPage/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getProductFlowByPage/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getProductFlowByPage/index.js b/cloud/getProductFlowByPage/index.js deleted file mode 100644 index a438608..0000000 --- a/cloud/getProductFlowByPage/index.js +++ /dev/null @@ -1,95 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) - -// 云函数入口函数 -exports.main = async (event, context) => { - try { - const db = cloud.database() - const { pageNum = 1, pageSize = 10 } = event - - // 获取总数 - const countRes = await db.collection('productFlowList').where({ - create_id: event.userId - }).count() - const total = countRes.total - - // 获取分页数据 - const listRes = await db.collection('productFlowList').aggregate() - .lookup({ - from: "userList", - localField: "create_id", - foreignField: "id", - as: "user" - }) - .unwind({ - path: "$user", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "departmentList", - localField: "user.depart_id", - foreignField: "id", - as: "user.department" - }) - .unwind({ - path: "$user.department", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "companyList", - localField: "user.company_id", - foreignField: "id", - as: "user.company" - }) - .unwind({ - path: "$user.company", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "productBasic", - localField: "basic_id", - foreignField: "id", - as: "productBasic" - }) - .unwind({ - path: "$productBasic", - preserveNullAndEmptyArrays: true - }) - .lookup({ - from: "productList", - localField: "product_id", - foreignField: "id", - as: "codeTemp" - }) - .addFields({ - code: { $arrayElemAt: ["$codeTemp.code", 0] } - }) - .project({ - codeTemp: 0 - }) - .match({ - create_id: event.userId - }) - .addFields( - { sortTime: { $ifNull: [{ $toDate: "$update_time" }, { $toDate: "$create_time" }] } }) - .sort({ sortTime: -1 }) - .skip((pageNum - 1) * pageSize) - .limit(pageSize) - .end() - return { - list: listRes.list, - total, - pageNum: Number(pageNum), - pageSize: Number(pageSize), - hasMore: (pageNum * pageSize) < total - } - } catch (err) { - console.error('云函数异常:', err) - return { - code: 500, - message: '服务器异常', - error: err.message - } - } -} \ No newline at end of file diff --git a/cloud/getProductFlowByPage/package.json b/cloud/getProductFlowByPage/package.json deleted file mode 100644 index 1d0d6bd..0000000 --- a/cloud/getProductFlowByPage/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "getHazmatFlowByPage", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file diff --git a/cloud/getProductInfo/config.json b/cloud/getProductInfo/config.json deleted file mode 100644 index 5ecc33e..0000000 --- a/cloud/getProductInfo/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "permissions": { - "openapi": [ - ] - } -} \ No newline at end of file diff --git a/cloud/getProductInfo/index.js b/cloud/getProductInfo/index.js deleted file mode 100644 index b7a2490..0000000 --- a/cloud/getProductInfo/index.js +++ /dev/null @@ -1,39 +0,0 @@ -// 云函数入口文件 -const cloud = require('wx-server-sdk') - -cloud.init({ env: cloud.DYNAMIC_CURRENT_ENV }) // 使用当前云环境 - -// 云函数入口函数 -exports.main = async (event, context) => { - // const wxContext = cloud.getWXContext() - // return { - // event, - // openid: wxContext.OPENID, - // appid: wxContext.APPID, - // unionid: wxContext.UNIONID, - // } - - let {userInfo,code} = event - return cloud.database().collection("productList").aggregate() - .lookup({ - from: "productBasic", - localField: 'basic_id', - foreignField: 'id', - as: 'productBasic' - }) - .unwind({ - path: "$productBasic", - preserveNullAndEmptyArrays: true - }) - .match({ - code: code - }) - .end({ - success: function (res) { - return res; - }, - fail(error) { - return error; - } - }) -} \ No newline at end of file diff --git a/cloud/getProductInfo/package.json b/cloud/getProductInfo/package.json deleted file mode 100644 index 35695f2..0000000 --- a/cloud/getProductInfo/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "hetHazmatInfo", - "version": "1.0.0", - "description": "", - "main": "index.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "wx-server-sdk": "~3.0.1" - } -} \ No newline at end of file -- Gitblit v1.9.2