This commit is contained in:
孟帅
2023-05-10 23:54:50 +08:00
parent bbe655a4d8
commit 49a96750bf
314 changed files with 15138 additions and 6244 deletions

View File

@@ -0,0 +1,49 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// CashViewInp 获取信息
type CashViewInp struct {
Id int64 `json:"id" v:"required#提现ID不能为空" dc:"提现ID"`
}
type CashViewModel struct {
entity.AdminCash
MemberCash
}
// CashListInp 获取列表
type CashListInp struct {
form.PageReq
form.RangeDateReq
form.StatusReq
MemberId int64 `json:"memberId"`
CreatedAt []int64 `json:"created_at"`
}
type CashListModel struct {
MemberUser string `json:"memberUser"`
MemberName string `json:"memberName"`
entity.AdminCash
}
// CashApplyInp 申请提现
type CashApplyInp struct {
Money float64 `json:"money" description:"提现金额"`
MemberId int64
}
// CashPaymentInp 提现打款处理
type CashPaymentInp struct {
Id int64 `json:"id" description:"ID"`
Status int64 `json:"status" description:"状态码"`
Msg string `json:"msg" description:"处理结果"`
}

View File

@@ -0,0 +1,153 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.5.3
// @AutoGenerate Date 2023-04-15 15:59:58
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/net/ghttp"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/library/location"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// CreditsLogSaveBalanceInp 更新余额
type CreditsLogSaveBalanceInp struct {
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Num float64 `json:"num" dc:"变动数据"`
Ip string `json:"ip" description:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Remark string `json:"remark" dc:"备注"`
}
func (in *CreditsLogSaveBalanceInp) Filter(ctx context.Context) (err error) {
if in.Num == 0 {
err = gerror.New("更新余额不能为0")
}
if in.AppId == "" {
in.AppId = contexts.GetModule(ctx)
}
if in.CreditGroup == "" {
if in.Num > 0 {
in.CreditGroup = consts.CreditGroupIncr
} else {
in.CreditGroup = consts.CreditGroupDecr
}
}
if in.Ip == "" {
in.Ip = location.GetClientIp(ghttp.RequestFromCtx(ctx))
}
return
}
type CreditsLogSaveBalanceModel struct {
}
// CreditsLogSaveIntegralInp 更新积分
type CreditsLogSaveIntegralInp struct {
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Num float64 `json:"num" dc:"变动数据"`
Ip string `json:"ip" description:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Remark string `json:"remark" dc:"备注"`
}
func (in *CreditsLogSaveIntegralInp) Filter(ctx context.Context) (err error) {
if in.Num == 0 {
err = gerror.New("更新积分不能为0")
}
if in.AppId == "" {
in.AppId = contexts.GetModule(ctx)
}
if in.CreditGroup == "" {
if in.Num > 0 {
in.CreditGroup = consts.CreditGroupIncr
} else {
in.CreditGroup = consts.CreditGroupDecr
}
}
if in.Ip == "" {
in.Ip = location.GetClientIp(ghttp.RequestFromCtx(ctx))
}
return
}
type CreditsLogSaveIntegralModel struct {
}
// CreditsLogListInp 获取资产变动列表
type CreditsLogListInp struct {
form.PageReq
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
}
func (in *CreditsLogListInp) Filter(ctx context.Context) (err error) {
return
}
type CreditsLogListModel struct {
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
BeforeNum float64 `json:"beforeNum" dc:"变动前"`
Num float64 `json:"num" dc:"变动数据"`
AfterNum float64 `json:"afterNum" dc:"变动后"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
// CreditsLogExportModel 导出资产变动
type CreditsLogExportModel struct {
Id int64 `json:"id" dc:"变动ID"`
MemberId int64 `json:"memberId" dc:"管理员ID"`
AppId string `json:"appId" dc:"应用id"`
AddonsName string `json:"addonsName" dc:"插件名称"`
CreditType string `json:"creditType" dc:"变动类型"`
CreditGroup string `json:"creditGroup" dc:"变动的组别"`
BeforeNum float64 `json:"beforeNum" dc:"变动前"`
Num float64 `json:"num" dc:"变动数据"`
AfterNum float64 `json:"afterNum" dc:"变动后"`
Remark string `json:"remark" dc:"备注"`
Ip string `json:"ip" dc:"操作人IP"`
MapId int64 `json:"mapId" dc:"关联ID"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}

View File

@@ -3,11 +3,11 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package adminin
import (
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
// DeptNameUniqueInp 名称是否唯一
@@ -73,3 +73,11 @@ type DeptStatusInp struct {
entity.AdminDept
}
type DeptStatusModel struct{}
type DeptOptionInp struct {
form.PageReq
}
type DeptOptionModel struct {
List []*DeptTree `json:"list"`
}

View File

@@ -3,13 +3,16 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package adminin
import (
"context"
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/frame/g"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/library/contexts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
)
@@ -109,15 +112,6 @@ type MemberNameUniqueModel struct {
IsUnique bool
}
// MemberMaxSortInp 最大排序
type MemberMaxSortInp struct {
Id int64 `json:"id" dc:"用户ID"`
}
type MemberMaxSortModel struct {
Sort int
}
// MemberEditInp 修改/新增管理员
type MemberEditInp struct {
Id int64 `json:"id" dc:""`
@@ -188,6 +182,7 @@ type MemberListInp struct {
form.PageReq
form.RangeDateReq
form.StatusReq
RoleId int `json:"roleId" dc:"角色ID"`
DeptId int `json:"deptId" dc:"部门ID"`
Mobile int `json:"mobile" dc:"手机号"`
Username string `json:"username" dc:"用户名"`
@@ -227,6 +222,7 @@ type LoginMemberInfoModel struct {
RealName string `json:"realName" dc:"姓名"`
Avatar string `json:"avatar" dc:"头像"`
Balance float64 `json:"balance" dc:"余额"`
Integral float64 `json:"integral" dc:"积分"`
Sex int `json:"sex" dc:"性别"`
Qq string `json:"qq" dc:"qq"`
Email string `json:"email" dc:"邮箱"`
@@ -236,6 +232,7 @@ type LoginMemberInfoModel struct {
Address string `json:"address" dc:"联系地址"`
Cash *MemberCash `json:"cash" dc:"收款信息"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
OpenId string `json:"openId" dc:"本次登录的openId"` // 区别与绑定的微信openid
*MemberLoginStatModel
}
@@ -251,7 +248,7 @@ type MemberCash struct {
// MemberStatusInp 更新状态
type MemberStatusInp struct {
entity.AdminPost
entity.AdminMember
}
type MemberStatusModel struct{}
@@ -276,3 +273,89 @@ type MemberLoginStatModel struct {
LastLoginAt *gtime.Time `json:"lastLoginAt" dc:"最后登录时间"`
LastLoginIp string `json:"lastLoginIp" dc:"最后登录IP"`
}
// MemberAddBalanceInp 增加余额
type MemberAddBalanceInp struct {
Id int64 `json:"id" v:"required#用户ID不能为空" dc:"管理员ID"`
OperateMode int64 `json:"operateMode" v:"in:1,2#输入的操作方式是无效的" dc:"操作方式"`
Num float64 `json:"num" dc:"操作数量"`
AppId string `json:"-"`
AddonsName string `json:"-"`
SelfNum float64 `json:"-"`
SelfCreditGroup string `json:"-"`
OtherNum float64 `json:"-"`
OtherCreditGroup string `json:"-"`
Remark string `json:"-"`
}
func (in *MemberAddBalanceInp) Filter(ctx context.Context) (err error) {
if in.Num <= 0 {
err = gerror.New("操作数量必须大于0")
return
}
if in.OperateMode == 1 {
// 加款
in.SelfNum = -in.Num
in.SelfCreditGroup = consts.CreditGroupOpIncr
in.OtherNum = in.Num
in.OtherCreditGroup = consts.CreditGroupIncr
in.Remark = fmt.Sprintf("增加余额:%v", in.OtherNum)
} else {
// 扣款
in.SelfNum = in.Num
in.SelfCreditGroup = consts.CreditGroupOpDecr
in.OtherNum = -in.Num
in.OtherCreditGroup = consts.CreditGroupDecr
in.Remark = fmt.Sprintf("扣除余额:%v", in.OtherNum)
}
in.AppId = contexts.GetModule(ctx)
in.AddonsName = contexts.GetAddonName(ctx)
return
}
type MemberAddBalanceModel struct{}
// MemberAddIntegralInp 增加积分
type MemberAddIntegralInp struct {
Id int64 `json:"id" v:"required#用户ID不能为空" dc:"管理员ID"`
OperateMode int64 `json:"operateMode" dc:"操作方式"`
Num float64 `json:"num" dc:"操作数量"`
AppId string `json:"-"`
AddonsName string `json:"-"`
SelfNum float64 `json:"-"`
SelfCreditGroup string `json:"-"`
OtherNum float64 `json:"-"`
OtherCreditGroup string `json:"-"`
Remark string `json:"-"`
}
func (in *MemberAddIntegralInp) Filter(ctx context.Context) (err error) {
if in.Num <= 0 {
err = gerror.New("操作数量必须大于0")
return
}
if in.OperateMode == 1 {
// 加款
in.SelfNum = -in.Num
in.SelfCreditGroup = consts.CreditGroupOpIncr
in.OtherNum = in.Num
in.OtherCreditGroup = consts.CreditGroupIncr
in.Remark = fmt.Sprintf("增加积分:%v", in.OtherNum)
} else {
// 扣款
in.SelfNum = in.Num
in.SelfCreditGroup = consts.CreditGroupOpDecr
in.OtherNum = -in.Num
in.OtherCreditGroup = consts.CreditGroupDecr
in.Remark = fmt.Sprintf("扣除积分:%v", in.OtherNum)
}
in.AppId = contexts.GetModule(ctx)
in.AddonsName = contexts.GetAddonName(ctx)
return
}
type MemberAddIntegralModel struct{}

View File

@@ -0,0 +1,153 @@
// Package adminin
// @Link https://github.com/bufanyun/hotgo
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
package adminin
import (
"context"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"hotgo/internal/model/input/payin"
"hotgo/utility/validate"
)
// OrderAcceptRefundInp 受理申请退款
type OrderAcceptRefundInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
RejectRefundReason string `json:"rejectRefundReason" dc:"拒绝退款原因"`
Status int64 `json:"status" dc:"状态"`
Remark string `json:"remark" dc:"退款备注"`
}
func (in *OrderAcceptRefundInp) Filter(ctx context.Context) (err error) {
if !validate.InSliceInt64(consts.OrderStatusSlice, in.Status) {
err = gerror.Newf("订单状态不正确")
return
}
if in.Status == consts.OrderStatusReturnReject && in.Remark == "" {
in.Remark = "退款申请被拒绝"
}
return
}
type OrderAcceptRefundModel struct {
}
// OrderApplyRefundInp 申请退款
type OrderApplyRefundInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
RefundReason string `json:"refundReason" v:"required#退款原因不能为空" dc:"退款原因"`
}
func (in *OrderApplyRefundInp) Filter(ctx context.Context) (err error) {
return
}
type OrderApplyRefundModel struct {
}
// OrderCreateInp 创建充值订单
type OrderCreateInp struct {
PayType string `json:"payType" dc:"支付方式"`
TradeType string `json:"tradeType" dc:"交易类型"`
OrderType string `json:"orderType" dc:"订单类型"`
ProductId int64 `json:"productId" dc:"产品id"`
Money float64 `json:"money" dc:"充值金额"`
Remark string `json:"remark" dc:"备注"`
ReturnUrl string `json:"returnUrl" dc:"买家付款成功跳转地址"`
}
func (in *OrderCreateInp) Filter(ctx context.Context) (err error) {
return
}
type OrderCreateModel struct {
Order *payin.CreateOrderModel `json:"order"`
}
// OrderEditInp 修改/新增充值订单
type OrderEditInp struct {
entity.AdminOrder
}
func (in *OrderEditInp) Filter(ctx context.Context) (err error) {
return
}
type OrderEditModel struct{}
// OrderDeleteInp 删除充值订单
type OrderDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OrderDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type OrderDeleteModel struct{}
// OrderViewInp 获取指定充值订单信息
type OrderViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *OrderViewInp) Filter(ctx context.Context) (err error) {
return
}
type OrderViewModel struct {
entity.AdminOrder
}
// OrderListInp 获取充值订单列表
type OrderListInp struct {
form.PageReq
MemberId uint64 `json:"memberId" dc:"用户id"`
OrderSn string `json:"orderSn" dc:"业务订单号"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
PayLogOutTradeNo string `json:"payLogOutTradeNo" dc:"商户订单号"`
}
func (in *OrderListInp) Filter(ctx context.Context) (err error) {
return
}
type OrderListModel struct {
entity.AdminOrder
OutTradeNo string `json:"payLogOutTradeNo" dc:"商户订单号"`
PayType string `json:"payLogPayType" dc:"支付类型"`
}
// OrderExportModel 导出充值订单
type OrderExportModel struct {
Id int64 `json:"id" dc:"主键"`
MemberId uint64 `json:"memberId" dc:"用户id"`
OrderType string `json:"orderType" dc:"订单类型"`
ProductId int64 `json:"productId" dc:"产品id"`
OrderSn string `json:"orderSn" dc:"关联订单号"`
Money float64 `json:"money" dc:"充值金额"`
Remark string `json:"remark" dc:"备注"`
Status int `json:"status" dc:"状态"`
CreatedAt *gtime.Time `json:"createdAt" dc:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" dc:"修改时间"`
}
// OrderStatusInp 更新充值订单状态
type OrderStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *OrderStatusInp) Filter(ctx context.Context) (err error) {
return
}
type OrderStatusModel struct{}