This commit is contained in:
苏尹岚
2020-12-31 10:49:02 +08:00
parent 1a954ad675
commit 29cd7f3952
2 changed files with 31 additions and 10 deletions

View File

@@ -421,13 +421,6 @@ func AcceptJob(ctx *jxcontext.Context, jobID, dropShippingDeliveryID, dropShippi
JobTimers.s.Unlock()
}
dao.Commit(db)
content := new(strings.Builder)
content.WriteString("您已接取任务:")
content.WriteString(job.Title)
content.WriteString("。已发布成功,已扣除您的余额:")
content.WriteString(utils.Float64ToStr(jxutils.IntPrice2Standard(int64(job.TotalPrice))))
content.WriteString("元")
event.SendSysMessageSimple(content.String(), job.UserID)
return jobOrder.JobOrderID, errCode, err
}
@@ -444,6 +437,15 @@ func CancelAcceptJob(ctx *jxcontext.Context, jobID int, jobOrderID int64) (err e
job := &model.Job{}
job.ID = jobID
err = dao.GetEntity(db, job)
//系统消息
content := new(strings.Builder)
content.WriteString("您接取的任务:")
content.WriteString(job.Title)
if ctx.GetUserName() == "jxadmin" {
content.WriteString(",因超时未完成已被系统自动取消。")
} else {
content.WriteString(",已被取消。")
}
dao.Begin(db)
defer func() {
if r := recover(); r != nil {
@@ -491,6 +493,7 @@ func CancelAcceptJob(ctx *jxcontext.Context, jobID int, jobOrderID int64) (err e
return err
}
dao.Commit(db)
event.SendSysMessageSimple(content.String(), jobOrder.UserID)
return err
}
@@ -547,8 +550,7 @@ func UpdateLimitJobOrders(db *dao.DaoDB, timer *time.Timer, jobID int, jobOrderI
if jobOrder.Status > model.JobOrderStatusAccept {
return
}
jobOrder.Status = model.JobOrderStatusCancel
if _, err := dao.UpdateEntity(db, jobOrder, "Status"); err == nil {
if err := CancelAcceptJob(jxcontext.AdminCtx, jobID, jobOrderID); err == nil {
jobTimer.Status = model.JobTimerStatusFinish
dao.UpdateEntity(db, jobTimer, "Status")
}
@@ -665,6 +667,11 @@ func SubmitJob(ctx *jxcontext.Context, jobOrder *model.JobOrder) (err error) {
JobTimers.JobAuditTimerMap[jobOrder2.JobOrderID] = timer
JobTimers.s.Unlock()
}
content := new(strings.Builder)
content.WriteString("您的任务:")
content.WriteString(job.Title)
content.WriteString("。已有人提交了审核,请及时审核!")
event.SendSysMessageSimple(content.String(), job.UserID)
return err
}
@@ -695,6 +702,15 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
jobOrder.AuditAt = time.Now()
jobOrder.LastOperator = ctx.GetUserName()
userBillJobOrder, err := dao.GetUserBill(db, jobOrder.UserID, "")
//系统消息
content := new(strings.Builder)
content.WriteString("您接取的任务:")
content.WriteString(job.Title)
if ctx.GetUserName() == "jxadmin" {
content.WriteString(",因超时未审核已被系统自动审核")
} else {
content.WriteString(",已被审核")
}
dao.Begin(db)
defer func() {
if r := recover(); r != nil {
@@ -707,6 +723,7 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
return
}
if status == model.JobOrderStatusAuditPass {
content.WriteString("通过,")
if job.JobCategoryID != model.JobCategoryIDDropShipping {
var price int
if job.CashbackType == model.JobCashbackPrice {
@@ -724,7 +741,6 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
} else if len(messageGroupMembers) == 1 {
if messageGroupsResult, err := dao.GetMessageGroups(db, "", messageGroupMembers[0].GroupID, model.GroupTypeMulit, false, ""); err == nil {
if len(messageGroupsResult) == 1 {
//不分成
if messageGroupsResult[0].DividePercentage != 0 {
if userBillGroupMaster, err := dao.GetUserBill(db, messageGroupsResult[0].UserID, ""); err == nil {
if err = financial.AddIncomeUpdateAccount(db, userBillGroupMaster, model.BillTypeDivide, price*messageGroupsResult[0].DividePercentage/100, job.ID); err != nil {
@@ -759,6 +775,8 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
dao.Rollback(db)
return err
}
content.WriteString(utils.Float64ToStr(jxutils.IntPrice2Standard(int64(price))))
content.WriteString("元已存入您的余额中!")
} else {
//一件代发处理,审核相当于发货
jobOrder.VendorWaybillID = vendorWaybillID
@@ -774,6 +792,7 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
}
}
} else {
content.WriteString("不通过,请确认!")
if job.Status < 0 {
if job.CashbackType == model.JobCashbackPrice {
userBill, err := dao.GetUserBill(db, job.UserID, "")
@@ -807,6 +826,7 @@ func AuditJob(ctx *jxcontext.Context, jobOrderID, status int, comment, vendorWay
jobTimer.Status = model.JobTimerStatusFinish
dao.UpdateEntity(db, jobTimer, "Status")
}
event.SendSysMessageSimple(content.String(), jobOrder.UserID)
return err
}

View File

@@ -678,6 +678,7 @@ func UpdateUser(ctx *jxcontext.Context, payload map[string]interface{}) (err err
//发短信,公众号消息通知
smsmsg.SendSMSMsg([]string{*user.Mobile}, globals.SMSSignName, globals.SMSPopSuccessTemplate, nil)
// weixinmsg.SendMsgToUser(userID, templateID, data)
event.SendSysMessageSimple("您好您已成功邀请4人加入我们成功免费获得1个月会员", user.UserID)
}
user.PopFlag = model.YES
dao.UpdateEntity(db, user, "PopFlag")