const system=require("../../../system");
const Dao=require("../../dao.base");
class LabourDao extends Dao{
  constructor(){
    super(Dao.getModelName(LabourDao));
  }

     //更新审核状态 
     async updatestatus(id, cur_type, t) {
      var sql = [];
      var cur_status = "";
      if (cur_type == 1){
        cur_status = "展示中";
      }
      else if (cur_type == 2){
        cur_status = "已下架";
      }
      else if (cur_type == 3){
        cur_status = "已过期";
      }
      else if (cur_type == 4){
        cur_status = "审核未通过";
      }
      // UPDATE xgg_merchant_account SET available_amt = available_amt - :amt, frozen_amt = frozen_amt + :amt WHERE id = 1 AND available_amt - :amt >= 0
      sql.push("UPDATE");
      sql.push("labour_info");
      sql.push("SET");
      sql.push("cur_type = :cur_type, cur_status = :cur_status");
      sql.push("WHERE id = :id");
      return await this.customUpdate(sql.join(" "), {
        id: id,
        cur_type: cur_type,
        cur_status: cur_status,
      }, t);
    }

}
module.exports=LabourDao;

