init: hgmj server initial commit

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-10-08 16:50:13 +08:00
co-authored by Claude Opus 4.7
commit 625e89c15d
1870 changed files with 254090 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
package withdrawctrl
import (
"91jd-server/common"
"91jd-server/common/stderr"
"91jd-server/models/v/txnactmod"
"github.com/gin-gonic/gin"
"go.mongodb.org/mongo-driver/bson/primitive"
)
func FindAct(ctx *gin.Context) {
q := txnactmod.Query{}
if err := ctx.ShouldBind(&q); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
infos, err := txnactmod.FindMany(q)
if err != nil {
common.ServeJSON(ctx, stderr.ErrDbQueryError, err.Error())
return
}
common.ServeJSON(ctx, stderr.Success, infos)
}
func EditAct(ctx *gin.Context) {
var p struct {
ID primitive.ObjectID `json:"id"`
txnactmod.TransactionActSelector
}
if err := ctx.ShouldBind(&p); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
c, err := txnactmod.Update(p.ID, &p.TransactionActSelector)
if err != nil || c < 0 {
common.ServeJSON(ctx, stderr.ErrDbUpdateError, err.Error())
return
}
common.ServeJSON(ctx, stderr.Success, "")
}
func DelAct(ctx *gin.Context) {
var p struct {
ID primitive.ObjectID `json:"id"`
}
if err := ctx.ShouldBind(&p); err != nil {
common.ServeJSON(ctx, stderr.ErrParamError, err.Error())
return
}
c, err := txnactmod.DeleteByID(p.ID)
if err != nil || c < 0 {
common.ServeJSON(ctx, stderr.ErrDbDeleteError, err.Error())
return
}
common.ServeJSON(ctx, stderr.Success, "")
}