Commit b0daf055 by 王昆

gsb

parent 24e4f652
......@@ -89,7 +89,7 @@ class LaoActionApi extends APIBase {
}
async testUrl(pobj) {
let j = {userName:"1111", companyName: "123", mchtId:"1250717023940415489"};
let j = {userName:"18817222007", companyName: "测试商户1(待删除)", mchtId:"1103667243432067073"};
let str = JSON.stringify(j);
console.log("str: " + str);
console.log("str object: " + JSON.parse(str));
......@@ -1491,6 +1491,29 @@ class LaoActionApi extends APIBase {
}
}
async workloadDel(obj) {
try {
if (!obj.userId) {
return system.getResult(null, "用户未登录");
}
let workload = await this.workloadSve.findById(obj.id);
if (!workload) {
return system.getResultSuccess();
}
if (obj.userId != workload.user_id) {
return system.getResult(null, "删除失败");
}
if (workload.status) {
return system.getResult(null, "工作量已确认,不允许删除");
}
let rs = await this.workloadSve.delById(obj.id);
return system.getResultSuccess(rs);
} catch (e) {
console.log(e);
return system.getErrResult2("您的网络不稳, 请稍后重试")
}
}
async workLoadPage2(obj) {
// if (!obj.userId) {
// return system.getResult(null, "用户未登录");
......
......@@ -6,6 +6,11 @@ class WorkloadDao extends Dao {
super(Dao.getModelName(WorkloadDao));
}
async delById(id) {
let sql = `DELETE FROM workload_info WHERE id = :id AND status = 0`;
return await this.customUpdate(sql, {id: id});
}
async countHistory(params) {
var sql = [];
sql.push("SELECT COUNT(DISTINCT(id_nu)) AS num FROM `workload_info` WHERE status = 1");
......
......@@ -10,6 +10,10 @@ class WorkloadService extends ServiceBase {
this.usersSve = system.getObject("service.operator.usersSve");
}
async delById(id) {
return await this.dao.delById(id);
}
async pageByCondition(params) {
var currentPage = Number(params.currentPage || 1);
var pageSize = Number(params.pageSize || 10);
......
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