fix(wallet): enforce consistent withdrawal accounting
This commit is contained in:
@@ -7,8 +7,7 @@ import (
|
||||
"git.apinb.com/bsm-sdk/core/errcode"
|
||||
"git.apinb.com/bsm-sdk/core/infra"
|
||||
"git.apinb.com/heqiapp/platforms/backend/api/internal/impl"
|
||||
clientcommon "git.apinb.com/heqiapp/platforms/backend/api/internal/logic/client/common"
|
||||
base "git.apinb.com/heqiapp/platforms/backend/api/internal/logic/common"
|
||||
common "git.apinb.com/heqiapp/platforms/backend/api/internal/logic/common"
|
||||
"git.apinb.com/heqiapp/platforms/backend/api/internal/models"
|
||||
"github.com/gin-gonic/gin"
|
||||
"gorm.io/gorm"
|
||||
@@ -16,7 +15,7 @@ import (
|
||||
|
||||
// Attendance 上下班打卡;存在进行中任务时禁止下班。
|
||||
func Attendance(ctx *gin.Context) {
|
||||
account, ok := clientcommon.StaffAccount(ctx)
|
||||
account, ok := common.StaffAccount(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -44,7 +43,7 @@ func Attendance(ctx *gin.Context) {
|
||||
}
|
||||
}
|
||||
record := models.StaffAttendance{
|
||||
Entity: base.NewEntity(base.StatusEnable), StaffAccountID: account.ID, RoleCode: account.RoleCode,
|
||||
Entity: common.NewEntity(common.StatusEnable), StaffAccountID: account.ID, RoleCode: account.RoleCode,
|
||||
Action: request.Action, OccurredAt: request.OccurredAt, Longitude: request.Longitude,
|
||||
Latitude: request.Latitude, DeviceIdentity: request.DeviceIdentity, RequestNo: request.RequestNo,
|
||||
}
|
||||
@@ -71,7 +70,7 @@ func Attendance(ctx *gin.Context) {
|
||||
|
||||
// ListTickets 仅返回分派给当前人员且与岗位匹配的工单。
|
||||
func ListTickets(ctx *gin.Context) {
|
||||
account, ok := clientcommon.StaffAccount(ctx)
|
||||
account, ok := common.StaffAccount(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -84,27 +83,27 @@ func ListTickets(ctx *gin.Context) {
|
||||
return
|
||||
}
|
||||
var list []models.CsTicket
|
||||
if err := impl.DBService.Where("staff_account_id = ? AND category IN ? AND status <> ?", account.ID, categories, base.StatusArchived).
|
||||
if err := impl.DBService.Where("staff_account_id = ? AND category IN ? AND status <> ?", account.ID, categories, common.StatusArchived).
|
||||
Order("created_at desc").Find(&list).Error; err != nil {
|
||||
infra.Response.Error(ctx, err)
|
||||
return
|
||||
}
|
||||
infra.Response.Success(ctx, base.ResourceResponse(list))
|
||||
infra.Response.Success(ctx, common.ResourceResponse(list))
|
||||
}
|
||||
|
||||
// GetTicket 按公开 identity 返回当前工作人员被分派的单一工单。
|
||||
func GetTicket(ctx *gin.Context) {
|
||||
account, ok := clientcommon.StaffAccount(ctx)
|
||||
account, ok := common.StaffAccount(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
var ticket models.CsTicket
|
||||
if impl.DBService.Where("identity = ? AND staff_account_id = ? AND status <> ?", ctx.Param("identity"), account.ID, base.StatusArchived).
|
||||
if impl.DBService.Where("identity = ? AND staff_account_id = ? AND status <> ?", ctx.Param("identity"), account.ID, common.StatusArchived).
|
||||
First(&ticket).Error != nil {
|
||||
infra.Response.Error(ctx, errcode.ErrRecordNotFound)
|
||||
return
|
||||
}
|
||||
infra.Response.Success(ctx, base.ResourceResponse(ticket))
|
||||
infra.Response.Success(ctx, common.ResourceResponse(ticket))
|
||||
}
|
||||
|
||||
// StartTicket 将本人已分派工单置为处理中。
|
||||
@@ -124,7 +123,7 @@ func RecoverTicket(ctx *gin.Context) {
|
||||
|
||||
// SubmitTicketResult 追加现场证据并提交用户确认;不合格或高风险结果必须进入异常。
|
||||
func SubmitTicketResult(ctx *gin.Context) {
|
||||
account, ok := clientcommon.StaffAccount(ctx)
|
||||
account, ok := common.StaffAccount(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
@@ -185,7 +184,7 @@ func SubmitTicketResult(ctx *gin.Context) {
|
||||
now := time.Now()
|
||||
for _, item := range request.Evidences {
|
||||
record := models.CsTicketEvidence{
|
||||
Entity: base.NewEntity(base.StatusEnable), CsTicketID: ticket.ID, EvidenceType: item.EvidenceType,
|
||||
Entity: common.NewEntity(common.StatusEnable), CsTicketID: ticket.ID, EvidenceType: item.EvidenceType,
|
||||
MediaType: item.MediaType, FileURI: item.FileURI, CapturedAt: item.CapturedAt, ReceivedAt: now,
|
||||
Longitude: item.Longitude, Latitude: item.Latitude, Source: "app",
|
||||
IntegrityStatus: "unverified", OperatorIdentity: account.Identity, RequestNo: item.RequestNo,
|
||||
@@ -212,7 +211,7 @@ func SubmitTicketResult(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
func updateTicketStatus(ctx *gin.Context, from, to int, extra map[string]any) {
|
||||
account, ok := clientcommon.StaffAccount(ctx)
|
||||
account, ok := common.StaffAccount(ctx)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user