通过id来写修改数据的接口

// 获取上下文和应用
const { ctx, app } = this

const { moment } = app
const { formData } = data
//获取用户信息

let curUser = await ctx.getCurrentUser();
let userId = curUser.user_info.userinfo.userid
let userName = curUser.user_info.userinfo.name
// 获取qmproc数据库实例
const knex = app.getKnex('qmproc')

app.logger.info('urgenttasks==传过来的参数', formData)

// 通过id来查询表中的所有字段
var sql = `select * from tm_checklist where id='${formData.id}'`
var result = await knex.raw(sql)
result = result[0][0]


var dynamic_attributes = JSON.parse(result.dynamic_attributes)
// 当前时间
const now = moment()
const nowDate = now.toDate()
const nowStr = now.format('YYYY-MM-DD HH:mm:ss')

const ods = {
  modified_date: nowDate,
  modified_user_id: userId,
  modified_user_name: userName
}
upd(formData, ods)

//修改方法
async function upd(data, ods) {
  var info = {
    // id: ctx.helper.getId(18),
    // 更改审计结果
   
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值