Commit 5cec73bf by 王昆

gsb

parent 51915f05
......@@ -76,6 +76,26 @@ class EcontractDao extends Dao {
}
return rs;
}
async countSignTimes(params) {
// idno, begin, end
let sql = [];
sql.push("SELECT COUNT(1) AS num FROM `c_econtract` t1");
sql.push("INNER JOIN `p_user_eaccount` t2 ON t1.`usereaccount_id` = t2.`id`");
sql.push("WHERE t2.`personsSign` = :idno");
if (params.begin) {
sql.push("AND t1.`created_at` >= :begin");
}
if (params.end) {
sql.push("AND t1.`created_at` <= :begin");
}
let list = await this.customQuery(sql.join(" "), params);
if (!list || list.length == 0) {
return 0;
}
return list[0].num || 0;
}
}
module.exports = EcontractDao;
......@@ -1369,6 +1369,14 @@ class EcontractService extends ServiceBase {
});
}
let begin = moment().subtract(30, "days").format("YYYY-MM-DD HH:mm:ss");
let times = await this.dao.countSignTimes({idno: eaccount.personsSign, begin: begin}) || 0;
if (times > 5) {
let timesMsg = `该用户[${eaccount.personsSign}]签约次数过多,30天内已经签约${times}次`;
console.log(timesMsg);
return this.returnjson(-1, timesMsg);
}
// e签宝流程
if (isNeedCreate) {
var uidStr = await this.getUidStr(8, 36);
......
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