付智勇

no message

@@ -48,7 +48,7 @@ router.post('/upLoadDoc',uploaddemo, async (ctx, next) => { @@ -48,7 +48,7 @@ router.post('/upLoadDoc',uploaddemo, async (ctx, next) => {
48 }else { 48 }else {
49 let oldAttachment2one = await attachmentModel.findOne({where:{businessId:businessId,category:2,siteId:siteId}}) 49 let oldAttachment2one = await attachmentModel.findOne({where:{businessId:businessId,category:2,siteId:siteId}})
50 if(oldAttachment2one){ 50 if(oldAttachment2one){
51 - let oldAttachment = await attachmentModel.update({path:path},{where:{businessId:businessId,category:2,siteId:siteId}}) 51 + let oldAttachment = await attachmentModel.update({path:path},{where:{id:oldAttachment2one.id}})
52 }else{ 52 }else{
53 let attachment = await attachmentModel.create(attachmentData) 53 let attachment = await attachmentModel.create(attachmentData)
54 } 54 }
@@ -85,6 +85,20 @@ router.post('/getImgBySiteId',async(ctx, next)=>{ @@ -85,6 +85,20 @@ router.post('/getImgBySiteId',async(ctx, next)=>{
85 status.catchError(ctx,400,e.message); 85 status.catchError(ctx,400,e.message);
86 } 86 }
87 }) 87 })
  88 +router.post('/getImgBySiteId',async(ctx, next)=>{
  89 + try{
  90 + let img = await attachmentModel.findAll({
  91 + where:{
  92 + siteId:ctx.request.body.siteId,
  93 + category:2
  94 + }
  95 + });
  96 + status.successTemp(ctx,200,img);
  97 + }catch(e){
  98 + console.log(e)
  99 + status.catchError(ctx,400,e.message);
  100 + }
  101 +})
88 102
89 router.post('/tgpCallback', async (ctx, next) => { 103 router.post('/tgpCallback', async (ctx, next) => {
90 104