Commit 5e325a41 by zhengqiuyun86

初始化

parent a760158c
package PagePlus
import (
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/a/page"
"git.168cad.top/zhengqiuyun/rym-util/a/util"
"git.168cad.top/zhengqiuyun/rym-util/exception"
page2 "git.168cad.top/zhengqiuyun/rym-util/page"
"gorm.io/gorm"
)
func Page(params []page.Param, pageNum int, pageSize int, m interface{}, data interface{}, orderBy string, db *gorm.DB) *page.Data {
var page = page.Data{}
func Page(params []page2.Param, pageNum int, pageSize int, m interface{}, data interface{}, orderBy string, db *gorm.DB) *page2.Data {
var page = page2.Data{}
page.PageSize = util.IfInt(pageSize == 0, 10, pageSize)
page.PageNum = util.IfInt(pageNum == 0, 1, pageNum)
tx := db.Session(&gorm.Session{PrepareStmt: true})
......
......@@ -3,7 +3,6 @@ package exception
import (
"errors"
"git.168cad.top/zhengqiuyun/rym-util/a/log"
"github.com/go-playground/validator/v10"
"reflect"
)
......
......@@ -2,8 +2,8 @@ package catch
import (
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/a/getWay"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"git.168cad.top/zhengqiuyun/rym-util/getWay"
"github.com/gin-gonic/gin"
"runtime"
"strings"
......
......@@ -3,7 +3,6 @@ package generate
import (
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/a/conf"
"github.com/deckarep/golang-set"
"github.com/iancoleman/strcase"
"io"
"os"
......
package generate
import (
"git.168cad.top/zhengqiuyun/rym-util/a/db/mysql"
)
func MysqlAllTables() []Table {
var tables []Table
//查询库中所有表
......
package generate
import (
"git.168cad.top/zhengqiuyun/rym-util/a/db/mysql"
)
func AllTables() []Table {
var tables []Table
//查询库中所有表
......
package getWay
import (
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"github.com/gin-gonic/gin"
)
......
......@@ -8,6 +8,7 @@ import (
"git.168cad.top/zhengqiuyun/rym-util/a/db/redis"
"git.168cad.top/zhengqiuyun/rym-util/a/log"
"git.168cad.top/zhengqiuyun/rym-util/a/log/es"
conf2 "git.168cad.top/zhengqiuyun/rym-util/conf"
"github.com/gin-gonic/gin"
"net/http"
"time"
......@@ -85,14 +86,14 @@ func logEnd(c *gin.Context, data interface{}) {
rs := string(dataJson)
excludeUrl := []string{""}
if esSwitch {
if util.ArrayContains(excludeUrl, GetURL(c)) && len(rs) > conf.LogResponseLength {
responseStr = rs[0:conf.LogResponseLength] + "......"
if util.ArrayContains(excludeUrl, GetURL(c)) && len(rs) > conf2.LogResponseLength {
responseStr = rs[0:conf2.LogResponseLength] + "......"
} else {
responseStr = rs
}
} else {
if len(rs) > conf.LogResponseLength {
responseStr = rs[0:conf.LogResponseLength] + "......"
if len(rs) > conf2.LogResponseLength {
responseStr = rs[0:conf2.LogResponseLength] + "......"
} else {
responseStr = rs
}
......
This diff is collapsed. Click to expand it.
......@@ -50,8 +50,8 @@ type Param interface {
}
type ErrorRsp struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
}
......@@ -77,8 +77,8 @@ func (this CertDownload) Params() map[string]string {
type CertDownloadRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
AliPayCertContent string `json:"alipay_cert_content"`
......
......@@ -38,8 +38,8 @@ func (this SystemOauthToken) Params() map[string]string {
// SystemOauthTokenRsp 换取授权访问令牌接口请求参数
type SystemOauthTokenRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
UserId string `json:"user_id"`
......@@ -77,8 +77,8 @@ func (this UserInfoShare) Params() map[string]string {
// UserInfoShareRsp 支付宝会员授权信息查询接口响应参数
type UserInfoShareRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
AuthNo string `json:"auth_no"`
......
......@@ -12,27 +12,27 @@ type TradeNotification struct {
NotifyId string `json:"notify_id"` // 通知校验ID
AppId string `json:"app_id"` // 开发者的app_id
Charset string `json:"charset"` // 编码格式
Version string `json:"version"` // 接口版本
SignType string `json:"sign_type"` // 签名类型
Sign string `json:"sign"` // 签名
TradeNo string `json:"trade_no"` // 支付宝交易号
OutTradeNo string `json:"out_trade_no"` // 商户订单号
OutBizNo string `json:"out_biz_no"` // 商户业务号
BuyerId string `json:"buyer_id"` // 买家支付宝用户号
BuyerLogonId string `json:"buyer_logon_id"` // 买家支付宝账号
SellerId string `json:"seller_id"` // 卖家支付宝用户号
SellerEmail string `json:"seller_email"` // 卖家支付宝账号
TradeStatus TradeStatus `json:"trade_status"` // 交易状态
TotalAmount string `json:"total_amount"` // 订单金额
ReceiptAmount string `json:"receipt_amount"` // 实收金额
InvoiceAmount string `json:"invoice_amount"` // 开票金额
BuyerPayAmount string `json:"buyer_pay_amount"` // 付款金额
PointAmount string `json:"point_amount"` // 集分宝金额
RefundFee string `json:"refund_fee"` // 总退款金额
Subject string `json:"subject"` // 商品的标题/交易标题/订单标题/订单关键字等,是请求时对应的参数,原样通知回来。
Body string `json:"body"` // 商品描述
GmtCreate string `json:"gmt_create"` // 交易创建时间
GmtPayment string `json:"gmt_payment"` // 交易付款时间
Version string `json:"version"` // 接口版本
SignType string `json:"sign_type"` // 签名类型
Sign string `json:"sign"` // 签名
TradeNo string `json:"trade_no"` // 支付宝交易号
OutTradeNo string `json:"out_trade_no"` // 商户订单号
OutBizNo string `json:"out_biz_no"` // 商户业务号
BuyerId string `json:"buyer_id"` // 买家支付宝用户号
BuyerLogonId string `json:"buyer_logon_id"` // 买家支付宝账号
SellerId string `json:"seller_id"` // 卖家支付宝用户号
SellerEmail string `json:"seller_email"` // 卖家支付宝账号
TradeStatus TradeStatus `json:"trade_status"` // 交易状态
TotalAmount string `json:"total_amount"` // 订单金额
ReceiptAmount string `json:"receipt_amount"` // 实收金额
InvoiceAmount string `json:"invoice_amount"` // 开票金额
BuyerPayAmount string `json:"buyer_pay_amount"` // 付款金额
PointAmount string `json:"point_amount"` // 集分宝金额
RefundFee string `json:"refund_fee"` // 总退款金额
Subject string `json:"subject"` // 商品的标题/交易标题/订单标题/订单关键字等,是请求时对应的参数,原样通知回来。
Body string `json:"body"` // 商品描述
GmtCreate string `json:"gmt_create"` // 交易创建时间
GmtPayment string `json:"gmt_payment"` // 交易付款时间
GmtRefund string `json:"gmt_refund"` // 交易退款时间
GmtClose string `json:"gmt_close"` // 交易结束时间
FundBillList string `json:"fund_bill_list"` // 支付金额信息
......
......@@ -28,8 +28,8 @@ func (this TradeRefundAsync) Params() map[string]string {
// TradeRefundAsyncRsp 统一收单交易退款接口(异步)响应参数
type TradeRefundAsyncRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"` // 支付宝交易号
......
......@@ -216,8 +216,8 @@ func (this TradeClose) Params() map[string]string {
// TradeCloseRsp 统一收单交易关闭接口响应参数
type TradeCloseRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
OutTradeNo string `json:"out_trade_no"`
......@@ -387,8 +387,8 @@ type RoyaltyParameter struct {
// TradeOrderSettleRsp 统一收单交易结算接口响应参数
type TradeOrderSettleRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"`
......@@ -420,8 +420,8 @@ func (this TradeCreate) Params() map[string]string {
// TradeCreateRsp 统一收单交易创建接口响应参数
type TradeCreateRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"` // 支付宝交易号
......@@ -574,8 +574,8 @@ func (this TradePreCreate) Params() map[string]string {
// TradePreCreateRsp 统一收单线下交易预创建接口响应参数
type TradePreCreateRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
OutTradeNo string `json:"out_trade_no"` // 创建交易传入的商户订单号
......@@ -614,8 +614,8 @@ func (this TradeCancel) Params() map[string]string {
// TradeCancelRsp 统一收单交易撤销接口响应参数
type TradeCancelRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"` // 支付宝交易号
......@@ -655,8 +655,8 @@ func (this TradeOrderInfoSync) Params() map[string]string {
// TradeOrderInfoSyncRsp 支付宝订单信息同步接口响应参数
type TradeOrderInfoSyncRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"`
......@@ -706,8 +706,8 @@ type TradeSettleConfirmExtendParams struct {
// TradeSettleConfirmRsp 统一收单确认结算接口响应参数
type TradeSettleConfirmRsp struct {
Content struct {
Code Code `json:"code"`
Msg string `json:"msg"`
Code Code `json:"code"`
Msg string `json:"msg"`
SubCode string `json:"sub_code"`
SubMsg string `json:"sub_msg"`
TradeNo string `json:"trade_no"`
......
......@@ -8,8 +8,8 @@ import (
"encoding/json"
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/a/conf"
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/a/log"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"io"
"io/ioutil"
"net/http"
......
package log
package a
import (
"bytes"
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/a/conf"
"git.168cad.top/zhengqiuyun/rym-util/conf"
"runtime"
"strconv"
"strings"
......@@ -44,14 +44,14 @@ func Print(tag, msg string, file string, line int) {
}
}
file = file[strings.LastIndex(file, "/")+1:]
fmt.Println(fmt.Sprintf(str, FormatDateMillTime(time.Now()), tag, GetGID(), file, line, msg))
fmt.Println(fmt.Sprintf(str, FormatDateMillTime(time.Now()), tag, getGID(), file, line, msg))
}
func FormatDateMillTime(dataTime time.Time) string {
return dataTime.Format("2006-01-02 15:04:05.000000")
}
func GetGID() uint64 {
func getGID() uint64 {
b := make([]byte, 64)
b = b[:runtime.Stack(b, false)]
b = bytes.TrimPrefix(b, []byte("goroutine "))
......
package rym_util
package log
import (
"git.168cad.top/zhengqiuyun/rym-util/a/conf"
"git.168cad.top/zhengqiuyun/rym-util/a/log"
"git.168cad.top/zhengqiuyun/rym-util/conf"
"git.168cad.top/zhengqiuyun/rym-util/log/a"
"runtime"
"strings"
)
......@@ -16,7 +16,7 @@ func DebugDo(f func()) {
func IsDebug() bool {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(log.DebugL):
case strings.ToLower(a.DebugL):
ok = true
break
}
......@@ -26,47 +26,47 @@ func IsDebug() bool {
func Debug(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(log.DebugL):
case strings.ToLower(a.DebugL):
ok = true
break
}
if ok {
_, file, line, _ := runtime.Caller(1)
log.Print("Debug", msg, file, line)
a.Print("Debug", msg, file, line)
}
}
func Info(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(log.DebugL):
case strings.ToLower(a.DebugL):
ok = true
break
case strings.ToLower(log.InfoL):
case strings.ToLower(a.InfoL):
ok = true
break
}
if ok {
_, file, line, _ := runtime.Caller(1)
log.Print("Info", msg, file, line)
a.Print("Info", msg, file, line)
}
}
func Error(msg string) {
ok := false
switch strings.ToLower(conf.LogLevel) {
case strings.ToLower(log.DebugL):
case strings.ToLower(a.DebugL):
ok = true
break
case strings.ToLower(log.InfoL):
case strings.ToLower(a.InfoL):
ok = true
break
case strings.ToLower(log.ErrorL):
case strings.ToLower(a.ErrorL):
ok = true
break
}
if ok {
_, file, line, _ := runtime.Caller(1)
log.Print("Error", msg, file, line)
a.Print("Error", msg, file, line)
}
}
package rym_util
package util
func ArrayContains(array []string, e string) bool {
for _, v := range array {
......
package rym_util
package util
import (
"time"
......
package rym_util
package util
func IfInt(isTrue bool, a, b int) int {
if isTrue {
......
package rym_util
package util
import (
"encoding/base64"
......
package rym_util
package util
import (
"bytes"
......@@ -9,7 +9,7 @@ import (
"crypto/sha256"
"encoding/base64"
"fmt"
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"github.com/wechatpay-apiv3/wechatpay-go/utils"
"sort"
)
......
package rym_util
package util
import (
"encoding/json"
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"net/url"
"sort"
"strconv"
......
package rym_util
package util
import (
"crypto/md5"
......
package rym_util
package util
import (
"os"
......
package rym_util
package util
func EncodePwd(loginPwd, loginPwdSalt string) string {
pingPwd := loginPwdSalt + loginPwd
......
package rym_util
package util
import (
"bytes"
......
......@@ -11,9 +11,9 @@ type U interface{}
//流计算数据结构定义
type Stream struct {
Head T
Tail *Stream
Length int
Head T
Tail *Stream
Length int
NotEmpty bool
}
......
package rym_util
package util
import (
"encoding/json"
"git.168cad.top/zhengqiuyun/rym-util/a/exception"
"git.168cad.top/zhengqiuyun/rym-util/exception"
"github.com/gin-gonic/gin"
"github.com/shopspring/decimal"
"math/rand"
......
......@@ -2,7 +2,7 @@ package main
import (
"fmt"
util "git.168cad.top/zhengqiuyun/rym-util/a/util/aes"
"git.168cad.top/zhengqiuyun/rym-util/util/aes"
)
func main() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment