schangxiang@126.com
2025-09-09 3d8966ba2c81e7e0365c8b123e861d18ee4f94f5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { default as BaseController } from "../../baseController";
import { Post } from "egg-shell-decorators";
import { BaseConsignorContract } from "../../../entity/basicInfo/consignor/baseConsignorContract";
 
export default class ConsignorContractController extends BaseController {
  //#region 修改合同状态
  @Post()
  public async updateSatus() {
    let { ctx } = this;
    let body = ctx.request.body;
    let contract_Ids = body.selectIDs;
    let contractSatus = body.contractSatus;
    let userInfo = await ctx.helper.userInfo();
    try {
      for (let contract_Id of contract_Ids) {
        let data = await this.dbRead.findOne(BaseConsignorContract, {
          contract_Id: contract_Id,
          userProduct_Id: userInfo.userProduct_Id
        });
        if (data) {
          await this.dbWrite.update(
            BaseConsignorContract,
            {
              contract_Id: contract_Id
            },
            {
              contractSatus: contractSatus
            }
          );
        }
      }
      this.info.result = true;
      this.info.msg = "修改成功";
    } catch (error) {
      this.info.result = false;
      this.info.msg = error.message;
    }
    ctx.body = this.info;
  }
  //#endregion
}