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{}

View File

@@ -0,0 +1,17 @@
package commonin
// WechatAuthorizeInp 微信用户授权
type WechatAuthorizeInp struct {
Type string `json:"type" v:"required#授权类型不能为空" dc:"授权类型"`
SyncRedirect string `json:"syncRedirect" v:"required#同步跳转地址不能为空" dc:"同步跳转地址"`
}
type WechatAuthorizeModel struct{}
// WechatAuthorizeCallInp 微信用户授权回调
type WechatAuthorizeCallInp struct {
Code string `json:"code" dc:"code作为换取access_token的票据"`
State string `json:"state" dc:"state"`
}
type WechatAuthorizeCallModel struct{}

View File

@@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package form
import (
@@ -22,8 +21,7 @@ func DefaultPageSize(ctx context.Context) int {
if pageSize > 0 {
return pageSize
}
defaultPageSize := g.Cfg().MustGet(ctx, "hotgo.admin.defaultPageSize", 10)
pageSize = defaultPageSize.Int()
pageSize = g.Cfg().MustGet(ctx, "hotgo.admin.defaultPageSize", 10).Int()
if pageSize <= 0 {
pageSize = 10
}
@@ -35,8 +33,7 @@ func DefaultPage(ctx context.Context) int {
if page > 0 {
return page
}
defaultPage := g.Cfg().MustGet(ctx, "hotgo.admin.defaultPage", 1)
page = defaultPage.Int()
page = g.Cfg().MustGet(ctx, "hotgo.admin.defaultPage", 1).Int()
if page <= 0 {
page = 1
}
@@ -46,20 +43,20 @@ func DefaultPage(ctx context.Context) int {
// PageReq 分页
type PageReq struct {
Page int `json:"page" example:"10" d:"1" v:"min:1#页码最小值不能低于1" dc:"当前页码"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:200#|每页数量最小值不能低于1|最大值不能大于200" dc:"每页数量"`
PerPage int `json:"pageSize" example:"1" d:"10" v:"min:1|max:200#每页数量最小值不能低于1|最大值不能大于200" dc:"每页数量"`
}
type PageRes struct {
PageReq
PageCount int `json:"pageCount" example:"0" dc:"全部数据量"`
}
// RangeDateReq 时间查询
// RangeDateReq 时间范围查询
type RangeDateReq struct {
StartTime string `json:"start_time" v:"date#开始日期格式不正确" dc:"开始日期"`
EndTime string `json:"end_time" v:"date#结束日期格式不正确" dc:"结束日期"`
}
// StatusReq 状态查询
// StatusReq 通用状态查询
type StatusReq struct {
Status int `json:"status" v:"in:-1,0,1,2,3#输入的状态是无效的" dc:"状态"`
}
@@ -93,6 +90,7 @@ func CalPageCount(totalCount int, perPage int) int {
// Selects 选项
type Selects []*Select
type Select struct {
Value interface{} `json:"value"`
Label string `json:"label"`
@@ -102,9 +100,11 @@ type Select struct {
func (p Selects) Len() int {
return len(p)
}
func (p Selects) Swap(i, j int) {
p[i], p[j] = p[j], p[i]
}
func (p Selects) Less(i, j int) bool {
return gconv.Int64(p[j].Value) > gconv.Int64(p[i].Value)
}

View File

@@ -4,7 +4,7 @@ import "github.com/gogf/gf/v2/os/gtime"
// AuthSummary 授权摘要
type AuthSummary struct {
Request
RpcMsg
}
// ResponseAuthSummary 响应授权摘要

View File

@@ -2,32 +2,74 @@ package msgin
import (
"fmt"
"github.com/gogf/gf/v2/errors/gerror"
"github.com/gogf/gf/v2/os/gtime"
"hotgo/internal/consts"
"hotgo/utility/encrypt"
)
type Request struct {
AppId string `json:"appID" v:"0" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"应用ID"`
TraceID string `json:"traceID" v:"0" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"链路ID"`
Timestamp int64 `json:"timestamp" example:"1640966400" description:"服务器时间戳"`
Sign string `json:"sign" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"签名"`
type RpcMsg struct {
AppId string `json:"appID" v:"0" example:"10001" description:"应用ID"`
TraceID string `json:"traceID" v:"0" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"链路ID"`
Timestamp int64 `json:"timestamp" example:"1640966400" description:"服务器时间戳"`
Sign string `json:"sign" example:"d0bb93048bc5c9164cdee845dcb7f820" description:"签名"`
}
func (i *Request) SetSign(traceID, appId, secretKey string) {
func (i *RpcMsg) SetSign(appId, secretKey string) *RpcMsg {
i.AppId = appId
i.TraceID = traceID
i.Timestamp = gtime.Timestamp()
i.Sign = i.GetSign(secretKey)
return i
}
func (i *Request) GetSign(secretKey string) string {
return encrypt.Md5ToString(fmt.Sprintf("%s%s%s%s", i.AppId, i.TraceID, i.Timestamp, secretKey))
func (i *RpcMsg) GetSign(secretKey string) string {
return encrypt.Md5ToString(fmt.Sprintf("%v%v%v%v", i.AppId, i.TraceID, i.Timestamp, secretKey))
}
func (i *RpcMsg) GetTraceID() string {
return i.TraceID
}
func (i *RpcMsg) SetTraceID(traceID string) {
i.TraceID = traceID
}
type Response struct {
Code int `json:"code" example:"0" description:"状态码"`
Message string `json:"message,omitempty" example:"操作成功" description:"提示消息"`
//Data interface{} `json:"data,omitempty" description:"数据集"`
RpcMsg
Code int `json:"code" example:"2000" description:"状态码"`
Message string `json:"message,omitempty" example:"操作成功" description:"提示消息"`
}
// PkgResponse 打包响应消息
func (m *Response) PkgResponse() {
m.SetCode()
// ...
}
// SetCode 设置状态码
func (m *Response) SetCode(code ...int) {
if len(code) > 0 {
m.Code = code[0]
return
}
// 默认值,转为成功的状态码
if m.Code == 0 {
m.Code = consts.TCPMsgCodeSuccess
}
return
}
// GetError 获取响应中的错误
func (m *Response) GetError() (err error) {
if m.Code != consts.TCPMsgCodeSuccess {
if m.Message == "" {
m.Message = "操作失败"
}
err = gerror.New(m.Message)
}
return
}
// ServerHeartbeat 心跳
@@ -41,9 +83,9 @@ type ResponseServerHeartbeat struct {
// ServerLogin 服务登录
type ServerLogin struct {
Request
Group string
Name string
RpcMsg
Group string `json:"group" description:"分组"`
Name string `json:"name" description:"名称"`
}
// ResponseServerLogin 响应服务登录
@@ -53,6 +95,7 @@ type ResponseServerLogin struct {
// ServerOffline 服务离线
type ServerOffline struct {
RpcMsg
}
// ResponseServerOffline 响应服务离线

View File

@@ -0,0 +1,49 @@
package msgin
import (
"hotgo/internal/model/input/sysin"
)
// CronDelete 删除任务
type CronDelete struct {
RpcMsg
sysin.CronDeleteInp
}
type ResponseCronDelete struct {
Response
sysin.CronDeleteModel
}
// CronEdit 编辑任务
type CronEdit struct {
RpcMsg
sysin.CronEditInp
}
type ResponseCronEdit struct {
Response
sysin.CronEditModel
}
// CronStatus 修改任务状态
type CronStatus struct {
RpcMsg
sysin.CronStatusInp
}
type ResponseCronStatus struct {
Response
sysin.CronStatusModel
}
// CronOnlineExec 在线执行
type CronOnlineExec struct {
RpcMsg
sysin.OnlineExecInp
}
type ResponseCronOnlineExec struct {
Response
sysin.OnlineExecModel
}

View File

@@ -0,0 +1,55 @@
package payin
import (
"github.com/go-pay/gopay/wechat/v3"
"github.com/gogf/gf/v2/os/gtime"
officialJs "github.com/silenceper/wechat/v2/officialaccount/js"
"hotgo/internal/model/entity"
)
// 和功能库[payment]包的通用输入/输出
// CreateOrderInp 统一创建订单入口
type CreateOrderInp struct {
Pay *entity.PayLog
}
type CreateOrderModel struct {
TradeType string `json:"tradeType" description:"交易类型"`
PayURL string `json:"payURL" description:"支付地址"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
JsApi *JSAPI `json:"jsApi" description:"jsapi支付参数"`
}
type JSAPI struct {
Config *officialJs.Config `json:"config" description:"js初始化配置"`
Params *wechat.JSAPIPayParams `json:"params" description:"支付参数"`
}
// NotifyInp 统一异步通知处理入口
type NotifyInp struct {
}
type NotifyModel struct {
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
ActualAmount float64 `json:"actualAmount" description:"实付金额"`
}
// NotifyCallFuncInp 异步通知回调,用于异步通知验签通过后回调到具体的业务中
type NotifyCallFuncInp struct {
Pay *entity.PayLog
}
// RefundInp 统一退款处理入口
type RefundInp struct {
Pay *entity.PayLog
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
RefundSn string `json:"refundSn" dc:"退款单号"`
Reason string `json:"reason" dc:"申请退款原因"`
Remark string `json:"remark" dc:"退款备注"`
}
type RefundModel struct {
}

View File

@@ -0,0 +1,199 @@
// Package payin
// @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 payin
import (
"context"
"github.com/gogf/gf/v2/encoding/gjson"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// PayNotifyInp 异步通知
type PayNotifyInp struct {
PayType string `json:"payType" description:"支付类型"`
}
type PayNotifyModel struct {
PayType string `json:"payType" description:"支付类型"`
Code string `json:"code" description:"状态码"`
Message string `json:"message" description:"响应文本消息"`
}
type PayNotifyUpdate struct {
TransactionId string `json:"transactionId" description:"交易号"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
PayIp string `json:"payIp" description:"支付者ip"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
}
// PayCreateInp 创建支付订单和日志
type PayCreateInp struct {
Subject string `json:"subject" description:"订单标题"`
Detail *gjson.Json `json:"detail" description:"支付商品详情"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
PayType string `json:"payType" description:"支付类型"`
TradeType string `json:"tradeType" description:"交易类型"`
PayAmount float64 `json:"payAmount" description:"支付金额"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
}
type PayCreateModel struct {
Order *CreateOrderModel
}
// PayEditInp 修改/新增支付日志
type PayEditInp struct {
entity.PayLog
}
func (in *PayEditInp) Filter(ctx context.Context) (err error) {
return
}
type PayEditModel struct{}
// PayDeleteInp 删除支付日志
type PayDeleteInp struct {
Id interface{} `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PayDeleteInp) Filter(ctx context.Context) (err error) {
return
}
type PayDeleteModel struct{}
// PayViewInp 获取指定支付日志信息
type PayViewInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PayViewInp) Filter(ctx context.Context) (err error) {
return
}
type PayViewModel struct {
entity.PayLog
}
// PayListInp 获取支付日志列表
type PayListInp struct {
form.PageReq
Id int64 `json:"id" dc:"ID"`
Status int `json:"status" dc:"状态"`
CreatedAt []*gtime.Time `json:"createdAt" dc:"创建时间"`
TestCategoryName string `json:"testCategoryName" dc:"分类名称"`
}
func (in *PayListInp) Filter(ctx context.Context) (err error) {
return
}
type PayListModel struct {
Id int64 `json:"id" description:"主键"`
MemberId uint64 `json:"memberId" description:"用户id"`
AppId string `json:"appId" description:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
MchId string `json:"mchId" description:"商户支付账户"`
Body string `json:"body" description:"创建支付报文"`
AuthCode string `json:"authCode" description:"刷卡码"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayType int `json:"payType" description:"支付类型"`
PayFee float64 `json:"payFee" description:"支付金额"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
TradeType string `json:"tradeType" description:"交易类型"`
RefundSn string `json:"refundSn" description:"退款编号"`
RefundFee float64 `json:"refundFee" description:"退款金额"`
RefundRemark string `json:"refundRemark" description:"退款备注"`
IsRefund int `json:"isRefund" description:"是否退款"`
CreateIp string `json:"createIp" description:"创建者ip"`
PayIp string `json:"payIp" description:"支付者ip"`
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}
// PayExportModel 导出支付日志
type PayExportModel struct {
Id int64 `json:"id" description:"主键"`
MemberId uint64 `json:"memberId" description:"用户id"`
AppId string `json:"appId" description:"应用id"`
AddonsName string `json:"addonsName" description:"插件名称"`
OrderSn string `json:"orderSn" description:"关联订单号"`
OrderGroup string `json:"orderGroup" description:"组别[默认统一支付类型]"`
Openid string `json:"openid" description:"openid"`
MchId string `json:"mchId" description:"商户支付账户"`
Body string `json:"body" description:"创建支付报文"`
AuthCode string `json:"authCode" description:"刷卡码"`
OutTradeNo string `json:"outTradeNo" description:"商户订单号"`
TransactionId string `json:"transactionId" description:"交易号"`
PayType int `json:"payType" description:"支付类型"`
PayFee float64 `json:"payFee" description:"支付金额"`
PayStatus int `json:"payStatus" description:"支付状态"`
PayAt *gtime.Time `json:"payAt" description:"支付时间"`
TradeType string `json:"tradeType" description:"交易类型"`
RefundSn string `json:"refundSn" description:"退款编号"`
RefundFee float64 `json:"refundFee" description:"退款金额"`
RefundRemark string `json:"refundRemark" description:"退款备注"`
IsRefund int `json:"isRefund" description:"是否退款"`
CreateIp string `json:"createIp" description:"创建者ip"`
PayIp string `json:"payIp" description:"支付者ip"`
NotifyUrl string `json:"notifyUrl" description:"支付通知回调地址"`
ReturnUrl string `json:"returnUrl" description:"买家付款成功跳转地址"`
TraceIds *gjson.Json `json:"traceIds" description:"链路id集合"`
Status int `json:"status" description:"状态"`
CreatedAt *gtime.Time `json:"createdAt" description:"创建时间"`
UpdatedAt *gtime.Time `json:"updatedAt" description:"修改时间"`
}
// PayMaxSortInp 获取支付日志最大排序
type PayMaxSortInp struct{}
func (in *PayMaxSortInp) Filter(ctx context.Context) (err error) {
return
}
type PayMaxSortModel struct {
Sort int `json:"sort" description:"排序"`
}
// PayStatusInp 更新支付日志状态
type PayStatusInp struct {
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
Status int `json:"status" dc:"状态"`
}
func (in *PayStatusInp) Filter(ctx context.Context) (err error) {
return
}
type PayStatusModel struct{}
// PaySwitchInp 更新支付日志开关状态
type PaySwitchInp struct {
form.SwitchReq
Id int64 `json:"id" v:"required#ID不能为空" dc:"ID"`
}
func (in *PaySwitchInp) Filter(ctx context.Context) (err error) {
return
}
type PaySwitchModel struct{}

View File

@@ -0,0 +1,59 @@
// Package payin
// @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 payin
import (
"context"
"hotgo/internal/model/entity"
"hotgo/internal/model/input/form"
"github.com/gogf/gf/v2/os/gtime"
)
// PayRefundInp 订单退款
type PayRefundInp struct {
OrderSn string `json:"orderSn" dc:"业务订单号"`
RefundMoney float64 `json:"refundMoney" dc:"退款金额"`
Reason string `json:"reason" dc:"申请退款原因"`
Remark string `json:"remark" dc:"退款备注"`
}
func (in *PayRefundInp) Filter(ctx context.Context) (err error) {
return
}
type PayRefundModel struct {
entity.PayRefund
}
// PayRefundListInp 获取资产变动列表
type PayRefundListInp 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 *PayRefundListInp) Filter(ctx context.Context) (err error) {
return
}
type PayRefundListModel struct {
entity.PayRefund
}
// PayRefundExportModel 导出资产变动
type PayRefundExportModel struct {
entity.PayRefund
}

View File

@@ -3,7 +3,6 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
//
package sysin
import (
@@ -20,13 +19,13 @@ type CronMaxSortModel struct {
Sort int
}
// CronEditInp 修改/新增字典数据
// CronEditInp 修改/新增
type CronEditInp struct {
entity.SysCron
}
type CronEditModel struct{}
// CronDeleteInp 删除字典类型
// CronDeleteInp 删除
type CronDeleteInp struct {
Id interface{}
}

View File

@@ -3,9 +3,8 @@
// @Copyright Copyright (c) 2023 HotGo CLI
// @Author Ms <133814250@qq.com>
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.1.4
// @AutoGenerate Date 2023-02-20 16:41:58
//
// @AutoGenerate Version 2.5.3
// @AutoGenerate Date 2023-04-28 15:28:40
package sysin
import (