Commit 074a39de by 王昆

gsb

parent 77358bd1
...@@ -77,24 +77,24 @@ class EcontractDao extends Dao { ...@@ -77,24 +77,24 @@ class EcontractDao extends Dao {
return rs; return rs;
} }
async countSignTimes(params) { async findSignedContractId(params) {
// idno, begin, end // idno, begin, end
let sql = []; let sql = [];
sql.push("SELECT COUNT(1) AS num FROM `c_econtract` t1"); sql.push("SELECT t1.id FROM `c_econtract` t1");
sql.push("INNER JOIN `p_user_eaccount` t2 ON t1.`usereaccount_id` = t2.`id`"); sql.push("INNER JOIN `p_user_eaccount` t2 ON t1.`usereaccount_id` = t2.`id`");
sql.push("WHERE t2.`personsSign` = :idno"); sql.push("WHERE t2.`personsSign` = :idno AND t1.eflowstatus = '2'");
if (params.begin) { if (params.ecid) {
sql.push("AND t1.`created_at` >= :begin"); sql.push("AND t1.`etemplate_id` = :ecid");
} }
if (params.end) { if (params.today) {
sql.push("AND t1.`created_at` <= :begin"); sql.push("AND t1.`end_at` >= :today AND t1.`begin_at` <= :today");
} }
let list = await this.customQuery(sql.join(" "), params); let list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) { if (!list || list.length == 0) {
return 0; return 0;
} }
return list[0].num || 0; return list[0].id || 0;
} }
} }
......
...@@ -1357,25 +1357,23 @@ class EcontractService extends ServiceBase { ...@@ -1357,25 +1357,23 @@ class EcontractService extends ServiceBase {
} }
// c_econtract // c_econtract
var econtract = await this.dao.findOne({ // var econtract = await this.dao.findOne({
eflowstatus: '2', // eflowstatus: '2',
usereaccount_id: eaccount.id, // usereaccount_id: eaccount.id,
etemplate_id: ecid, // etemplate_id: ecid,
}); // });
let contractId = await this.dao.findSignedContractId({idno: eaccount.personsSign, ecid: ecid}) || 0;
if (econtract) { if (contractId) {
return this.returnjson(0, "用户已经签约", { return this.returnjson(0, "用户已经签约", {
contractId: econtract.id contractId: contractId
}); });
} }
// let begin = moment().subtract(30, "days").format("YYYY-MM-DD HH:mm:ss");
let begin = moment().subtract(30, "days").format("YYYY-MM-DD HH:mm:ss"); // if (times > 5) {
let times = await this.dao.countSignTimes({idno: eaccount.personsSign, begin: begin}) || 0; // let timesMsg = `该用户[${eaccount.personsSign}]签约次数过多,30天内已经签约${times}次`;
if (times > 5) { // console.log(timesMsg);
let timesMsg = `该用户[${eaccount.personsSign}]签约次数过多,30天内已经签约${times}次`; // return this.returnjson(-1, timesMsg);
console.log(timesMsg); // }
return this.returnjson(-1, timesMsg);
}
// e签宝流程 // e签宝流程
if (isNeedCreate) { if (isNeedCreate) {
...@@ -1413,7 +1411,7 @@ class EcontractService extends ServiceBase { ...@@ -1413,7 +1411,7 @@ class EcontractService extends ServiceBase {
} }
// 创建合同 fileurl、esignUrl 怎么赋值???????????? // 创建合同 fileurl、esignUrl 怎么赋值????????????
econtract = { let econtract = {
name: ecompany.name, name: ecompany.name,
eflowstatusname: "签约中", eflowstatusname: "签约中",
eflowstatus: "1", eflowstatus: "1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment