This commit is contained in:
parent
c57b4eaa54
commit
00f5f1bde7
|
@ -3,7 +3,7 @@ package bannerlistcache
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"qteam/app/caches"
|
"cron_admin/app/caches"
|
||||||
|
|
||||||
"github.com/qit-team/snow-core/cache"
|
"github.com/qit-team/snow-core/cache"
|
||||||
)
|
)
|
||||||
|
@ -21,7 +21,7 @@ type bannerListCache struct {
|
||||||
cache.BaseCache
|
cache.BaseCache
|
||||||
}
|
}
|
||||||
|
|
||||||
//单例模式
|
// 单例模式
|
||||||
func GetInstance() *bannerListCache {
|
func GetInstance() *bannerListCache {
|
||||||
once.Do(func() {
|
once.Do(func() {
|
||||||
instance = new(bannerListCache)
|
instance = new(bannerListCache)
|
||||||
|
|
|
@ -5,7 +5,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"qteam/config"
|
"cron_admin/config"
|
||||||
|
|
||||||
"github.com/qit-team/snow-core/cache"
|
"github.com/qit-team/snow-core/cache"
|
||||||
_ "github.com/qit-team/snow-core/cache/rediscache"
|
_ "github.com/qit-team/snow-core/cache/rediscache"
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/http/controllers"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Empty(c *gin.Context) {
|
||||||
|
controllers.HandRes(c, gin.H{"bool": true}, nil)
|
||||||
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/constants/errorcode"
|
||||||
|
"cron_admin/app/http/controllers"
|
||||||
|
"cron_admin/app/http/entities/backend"
|
||||||
|
"cron_admin/app/models/userinfomodel"
|
||||||
|
"cron_admin/app/services"
|
||||||
|
"github.com/ahmetb/go-linq/v3"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func Login(c *gin.Context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func List(c *gin.Context) {
|
||||||
|
request := controllers.GetRequest(c).(*backend.UserListRequest)
|
||||||
|
count, list, err := services.GetListByWhere(request, request.Page, request.PageSize)
|
||||||
|
if err != nil {
|
||||||
|
controllers.HandCodeRes(c, nil, errorcode.NotFound)
|
||||||
|
} else {
|
||||||
|
UserList := make([]backend.UserListResponse, 0)
|
||||||
|
linq.From(list).SelectT(func(in userinfomodel.UserInfo) (d backend.UserListResponse) {
|
||||||
|
d.ResponseFromDb(in)
|
||||||
|
return d
|
||||||
|
}).ToSlice(&UserList)
|
||||||
|
controllers.HandRes(c, gin.H{"data": UserList, "count": count}, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func GerUserInfoHandler(c *gin.Context) {
|
||||||
|
request := controllers.GetRequest(c).(*backend.UserInfoRequest)
|
||||||
|
has, userInfo, err := services.UserInfo(request.Id)
|
||||||
|
if err != nil || has == false {
|
||||||
|
controllers.HandCodeRes(c, nil, errorcode.NotFound)
|
||||||
|
} else {
|
||||||
|
UserInfoResponse := backend.UserListResponse{}
|
||||||
|
UserInfoResponse.ResponseFromDb(userInfo)
|
||||||
|
controllers.HandRes(c, UserInfoResponse, nil)
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,6 +3,8 @@ package controllers
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
@ -13,10 +15,8 @@ import (
|
||||||
zh_translations "gopkg.in/go-playground/validator.v9/translations/zh"
|
zh_translations "gopkg.in/go-playground/validator.v9/translations/zh"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
|
|
||||||
"qteam/app/constants/errorcode"
|
"cron_admin/app/constants/errorcode"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
package backend
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/models/userinfomodel"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserListRequest struct {
|
||||||
|
Page int `json:"page" validate:"required" form:"page" example:"1"`
|
||||||
|
PageSize int `json:"page_size" validate:"required" form:"page_size" example:"10"`
|
||||||
|
Mobile string `json:"mobile" form:"mobile" example:"155555555"`
|
||||||
|
Status int `json:"status" form:"status" example:"1"`
|
||||||
|
Clientuniqueidentification string `json:"Clientuniqueidentification" form:"Clientuniqueidentification" example:"46516"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserInfoRequest struct {
|
||||||
|
Id int `json:"id" form:"id" validate:"required" example:"1"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UserListResponse struct {
|
||||||
|
Id int `json:"id" form:"id"`
|
||||||
|
Clientuniqueidentification string `json:"clientuniqueidentification"`
|
||||||
|
Mobile string `json:"mobile"`
|
||||||
|
Status int `json:"status"`
|
||||||
|
Createtime string `json:"createtime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (response *UserListResponse) ResponseFromDb(l userinfomodel.UserInfo) {
|
||||||
|
response.Id = l.Id
|
||||||
|
response.Clientuniqueidentification = l.Clientuniqueidentification
|
||||||
|
response.Mobile = l.Mobile
|
||||||
|
response.Status = l.Status
|
||||||
|
response.Createtime = l.Createtime.Format(time.DateTime)
|
||||||
|
return
|
||||||
|
}
|
|
@ -5,8 +5,8 @@ type IdRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageRequest struct {
|
type PageRequest struct {
|
||||||
Page int64 `json:"page"`
|
Page int `json:"page"`
|
||||||
PageSize int64 `json:"pageSize"`
|
PageSize int `json:"pageSize"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PageRsp struct {
|
type PageRsp struct {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package metric
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"qteam/app/utils/metric"
|
"cron_admin/app/utils/metric"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus"
|
"github.com/prometheus/client_golang/prometheus"
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,14 +2,14 @@ package middlewares
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/constants/common"
|
||||||
|
"cron_admin/app/constants/errorcode"
|
||||||
|
"cron_admin/app/http/controllers"
|
||||||
|
"cron_admin/app/http/requestmapping"
|
||||||
|
"cron_admin/app/utils"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/qit-team/snow-core/redis"
|
"github.com/qit-team/snow-core/redis"
|
||||||
"qteam/app/constants/common"
|
|
||||||
"qteam/app/constants/errorcode"
|
|
||||||
"qteam/app/http/controllers"
|
|
||||||
"qteam/app/http/requestmapping"
|
|
||||||
"qteam/app/utils"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ package middlewares
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"qteam/app/http/metric"
|
"cron_admin/app/http/metric"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
)
|
)
|
||||||
|
|
|
@ -6,8 +6,8 @@ import (
|
||||||
"net/http/httputil"
|
"net/http/httputil"
|
||||||
"runtime/debug"
|
"runtime/debug"
|
||||||
|
|
||||||
"qteam/app/constants/logtype"
|
"cron_admin/app/constants/logtype"
|
||||||
"qteam/config"
|
"cron_admin/config"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/qit-team/snow-core/log/logger"
|
"github.com/qit-team/snow-core/log/logger"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package middlewares
|
package middlewares
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/http/trace"
|
||||||
|
"cron_admin/app/utils"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"qteam/app/http/trace"
|
|
||||||
"qteam/app/utils"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package routes
|
package routes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/http/controllers"
|
||||||
|
"cron_admin/app/http/controllers/backend"
|
||||||
|
"cron_admin/app/http/middlewares"
|
||||||
|
"cron_admin/app/http/trace"
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/qit-team/snow-core/http/middleware"
|
"github.com/qit-team/snow-core/http/middleware"
|
||||||
"qteam/app/http/controllers"
|
|
||||||
"qteam/app/http/middlewares"
|
|
||||||
"qteam/app/http/trace"
|
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterAdminRoute(router *gin.Engine) {
|
func RegisterAdminRoute(router *gin.Engine) {
|
||||||
|
@ -22,9 +23,54 @@ func RegisterAdminRoute(router *gin.Engine) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//v1 := router.Group("/admin/api/v1")
|
adminApi := router.Group("/admin/api", middlewares.ValidateRequest())
|
||||||
//{
|
{
|
||||||
//
|
oauth := adminApi.Group("/oauth")
|
||||||
//}
|
{
|
||||||
|
v1 := oauth.Group("/v1")
|
||||||
|
{
|
||||||
|
//用户管理
|
||||||
|
user := v1.Group("/user")
|
||||||
|
{
|
||||||
|
user.GET("/list", backend.List)
|
||||||
|
user.GET("/info", backend.Empty)
|
||||||
|
}
|
||||||
|
//数据库管理
|
||||||
|
sql := v1.Group("/sql")
|
||||||
|
{
|
||||||
|
sql.GET("/list", backend.Empty)
|
||||||
|
}
|
||||||
|
//任务
|
||||||
|
cmd := v1.Group("/cmd")
|
||||||
|
{
|
||||||
|
cmd.GET("/query", backend.Empty)
|
||||||
|
cmd.GET("/info", backend.Empty)
|
||||||
|
cmd.PUT("/update", backend.Empty)
|
||||||
|
cmd.DELETE("/delete", backend.Empty)
|
||||||
|
}
|
||||||
|
//消息管理
|
||||||
|
mes := v1.Group("/channel")
|
||||||
|
{
|
||||||
|
mes.GET("/list", backend.Empty)
|
||||||
|
}
|
||||||
|
|
||||||
|
//日志
|
||||||
|
log := v1.Group("/log")
|
||||||
|
{
|
||||||
|
//任务日志
|
||||||
|
cmdLog := log.Group("/cmd")
|
||||||
|
{
|
||||||
|
cmdLog.GET("/list", backend.Empty)
|
||||||
|
}
|
||||||
|
//消息日志
|
||||||
|
mesLog := log.Group("/mes")
|
||||||
|
{
|
||||||
|
mesLog.GET("/list", backend.Empty)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,11 +4,11 @@ package routes
|
||||||
* 配置路由
|
* 配置路由
|
||||||
*/
|
*/
|
||||||
import (
|
import (
|
||||||
"qteam/app/http/controllers"
|
"cron_admin/app/http/controllers"
|
||||||
"qteam/app/http/middlewares"
|
"cron_admin/app/http/middlewares"
|
||||||
"qteam/app/http/trace"
|
"cron_admin/app/http/trace"
|
||||||
"qteam/app/utils/metric"
|
"cron_admin/app/utils/metric"
|
||||||
"qteam/config"
|
"cron_admin/config"
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/qit-team/snow-core/http/middleware"
|
"github.com/qit-team/snow-core/http/middleware"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package trace
|
package trace
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/config"
|
||||||
"github.com/openzipkin/zipkin-go"
|
"github.com/openzipkin/zipkin-go"
|
||||||
zkHttp "github.com/openzipkin/zipkin-go/reporter/http"
|
zkHttp "github.com/openzipkin/zipkin-go/reporter/http"
|
||||||
"log"
|
"log"
|
||||||
"qteam/config"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,8 @@ package jobs
|
||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"qteam/app/jobs/basejob"
|
"cron_admin/app/jobs/basejob"
|
||||||
"qteam/config"
|
"cron_admin/config"
|
||||||
|
|
||||||
"github.com/qit-team/snow-core/log/logger"
|
"github.com/qit-team/snow-core/log/logger"
|
||||||
"github.com/qit-team/snow-core/queue"
|
"github.com/qit-team/snow-core/queue"
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package models
|
||||||
|
|
||||||
|
type PO interface {
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package userinfomodel
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/qit-team/snow-core/db"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
once sync.Once
|
||||||
|
m *UserInfoModel
|
||||||
|
)
|
||||||
|
|
||||||
|
// 实体
|
||||||
|
type UserInfo struct {
|
||||||
|
Id int `xorm:"'Id' int(0)"`
|
||||||
|
Clientuniqueidentification string `xorm:"'ClientUniqueIdentification' varchar(255)"`
|
||||||
|
Mobile string `xorm:"'Mobile' varchar(13)"`
|
||||||
|
Status int `xorm:"'Status' TINYINT"`
|
||||||
|
Lastupdatetime time.Time `xorm:"'LastUpdateTime' datetime"`
|
||||||
|
Createtime time.Time `xorm:"'CreateTime' datetime"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// 表名
|
||||||
|
func (m *UserInfo) TableName() string {
|
||||||
|
return "UserInfo"
|
||||||
|
}
|
||||||
|
|
||||||
|
// 私有化,防止被外部new
|
||||||
|
type UserInfoModel struct {
|
||||||
|
db.Model //组合基础Model,集成基础Model的属性和方法
|
||||||
|
}
|
||||||
|
|
||||||
|
// 单例模式
|
||||||
|
func GetInstance() *UserInfoModel {
|
||||||
|
once.Do(func() {
|
||||||
|
m = new(UserInfoModel)
|
||||||
|
//m.DiName = "" //设置数据库实例连接,默认db.SingletonMain
|
||||||
|
})
|
||||||
|
return m
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package mq
|
package mq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"qteam/app/utils/mq"
|
"cron_admin/app/utils/mq"
|
||||||
)
|
)
|
||||||
|
|
||||||
func startQunue(name string, method interface{}, mqTp string, tp int, exhange string) {
|
func startQunue(name string, method interface{}, mqTp string, tp int, exhange string) {
|
||||||
|
|
|
@ -0,0 +1,84 @@
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/http/entities"
|
||||||
|
"cron_admin/app/models"
|
||||||
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
"time"
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type CommonRepo[P models.PO] struct {
|
||||||
|
repo *xorm.Session
|
||||||
|
}
|
||||||
|
|
||||||
|
type ICommonRepo[P models.PO] interface {
|
||||||
|
FindAll(list *[]P, opts ...DBOption) error
|
||||||
|
FindAndCount(list *[]P, opts ...DBOption) (int64, error)
|
||||||
|
Get(db *P, opts ...DBOption) (bool, error)
|
||||||
|
Update(db *P, opts ...DBOption) (int64, error)
|
||||||
|
Delete(db *P, opts ...DBOption) (int64, error)
|
||||||
|
InsertOne(db *P, opts ...DBOption) (int64, error)
|
||||||
|
InsertBatch(db *[]P, opts ...DBOption) (int64, error)
|
||||||
|
|
||||||
|
WithByID(id uint) DBOption
|
||||||
|
WithByUserId(userId uint) DBOption
|
||||||
|
WithByBrandId(id int) DBOption
|
||||||
|
WithByDate(startTime, endTime time.Time) DBOption
|
||||||
|
WithByStartDate(startTime time.Time) DBOption
|
||||||
|
WithByEndDate(startTime time.Time) DBOption
|
||||||
|
WithDesc(orderStr string) DBOption
|
||||||
|
WithByStatus(status int) DBOption
|
||||||
|
WithIdsIn(ids []uint) DBOption
|
||||||
|
WithPage(pageFilter entities.PageRequest) DBOption
|
||||||
|
WithByCouponId(couponId uint) DBOption
|
||||||
|
WithByProductId(productId uint) DBOption
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewCommonRepo[P models.PO](repo *xorm.Session) ICommonRepo[P] {
|
||||||
|
return &CommonRepo[P]{repo: repo}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CommonRepo[P]) FindAll(list *[]P, opts ...DBOption) error {
|
||||||
|
return getDb(this.repo, opts...).Find(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CommonRepo[P]) FindAndCount(list *[]P, opts ...DBOption) (int64, error) {
|
||||||
|
return getDb(this.repo, opts...).FindAndCount(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CommonRepo[P]) Get(db *P, opts ...DBOption) (bool, error) {
|
||||||
|
return getDb(this.repo, opts...).Get(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CommonRepo[P]) Update(db *P, opts ...DBOption) (int64, error) {
|
||||||
|
if len(opts) == 0 {
|
||||||
|
return 0, errors.New("不允许不带条件的更新")
|
||||||
|
}
|
||||||
|
return getDb(this.repo, opts...).Update(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 不允许不带条件的删除
|
||||||
|
func (this *CommonRepo[P]) Delete(db *P, opts ...DBOption) (int64, error) {
|
||||||
|
if len(opts) == 0 {
|
||||||
|
return 0, errors.New("不允许不带条件的删除")
|
||||||
|
}
|
||||||
|
return getDb(this.repo, opts...).Delete(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *CommonRepo[P]) InsertOne(db *P, opts ...DBOption) (int64, error) {
|
||||||
|
return getDb(this.repo, opts...).Insert(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量插入
|
||||||
|
func (this *CommonRepo[P]) InsertBatch(db *[]P, opts ...DBOption) (int64, error) {
|
||||||
|
return getDb(this.repo, opts...).Insert(db)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getDb(repo *xorm.Session, opts ...DBOption) *xorm.Session {
|
||||||
|
for _, opt := range opts {
|
||||||
|
repo = opt(repo)
|
||||||
|
}
|
||||||
|
return repo
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/http/entities"
|
||||||
|
"time"
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBOption func(session *xorm.Session) *xorm.Session
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByID(id uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("id = ?", id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByUserId(userId uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("user_id = ?", userId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByBrandId(id int) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("brand_id = ?", id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByDate(startTime, endTime time.Time) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("create_time > ? AND create_time < ?", startTime, endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByStartDate(startTime time.Time) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("create_time > ?", startTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByEndDate(endTime time.Time) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("create_time < ?", endTime)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByStatus(status int) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
if status == 0 {
|
||||||
|
return g
|
||||||
|
}
|
||||||
|
return g.Where("status = ?", status)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByFrom(from string) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("`from` = ?", from)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithLikeName(name string) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
if len(name) == 0 {
|
||||||
|
return g
|
||||||
|
}
|
||||||
|
return g.Where("name like ?", "%"+name+"%")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithDesc(orderStr string) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Desc(orderStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithIdsIn(ids []uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.In("id", ids)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithIdsNotIn(ids []uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("id not in (?)", ids)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithPage(pageFilter entities.PageRequest) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Limit(pageFilter.PageSize, pageFilter.PageSize*(pageFilter.Page-1))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func (c *CommonRepo[P]) WithByCouponId(couponId uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("coupon_id =?", couponId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonRepo[P]) WithByProductId(productId uint) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("product_id =?", productId)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package repository
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/models"
|
||||||
|
"xorm.io/xorm"
|
||||||
|
)
|
||||||
|
|
||||||
|
type UserRepo[P models.PO] struct {
|
||||||
|
repo *xorm.Session
|
||||||
|
CommonRepo ICommonRepo[P]
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewUserRepo[P models.PO](repo *xorm.Session) *UserRepo[P] {
|
||||||
|
commonRepo := NewCommonRepo[P](repo)
|
||||||
|
return &UserRepo[P]{repo: repo, CommonRepo: commonRepo}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *UserRepo[P]) WithByCustNo(custNo string) DBOption {
|
||||||
|
return func(g *xorm.Session) *xorm.Session {
|
||||||
|
return g.Where("custNo = ?", custNo)
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
package services
|
||||||
|
|
||||||
|
import (
|
||||||
|
"cron_admin/app/http/entities/backend"
|
||||||
|
"cron_admin/app/models/userinfomodel"
|
||||||
|
"xorm.io/builder"
|
||||||
|
)
|
||||||
|
|
||||||
|
func GetListByWhere(request *backend.UserListRequest, page int, limit int) (count int64, UserListInfo []userinfomodel.UserInfo, err error) {
|
||||||
|
conn := builder.NewCond()
|
||||||
|
|
||||||
|
if request.Mobile != "" {
|
||||||
|
conn = conn.And(builder.Like{"Mobile", request.Mobile})
|
||||||
|
}
|
||||||
|
if request.Status != 0 {
|
||||||
|
conn = conn.And(builder.Eq{"Status": request.Status})
|
||||||
|
}
|
||||||
|
session := userinfomodel.GetInstance().GetDb().Where(conn)
|
||||||
|
|
||||||
|
if page != 0 && limit != 0 {
|
||||||
|
session = session.Limit(page, (page-1)*limit)
|
||||||
|
}
|
||||||
|
count, err = session.FindAndCount(&UserListInfo)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func UserInfo(id int) (has bool, UserCouponModel userinfomodel.UserInfo, err error) {
|
||||||
|
has, err = userinfomodel.GetInstance().GetDb().Where("id =?", id).Get(&UserCouponModel)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
|
@ -2,11 +2,11 @@ package market
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"cron_admin/config"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"qteam/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type MarketClient struct {
|
type MarketClient struct {
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package market
|
package market
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/utils/encrypt"
|
||||||
|
"cron_admin/config"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"qteam/app/utils/encrypt"
|
|
||||||
"qteam/config"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package market
|
package market
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/qit-team/snow-core/kernel/server"
|
"github.com/qit-team/snow-core/kernel/server"
|
||||||
"os"
|
"os"
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,16 +2,16 @@ package openapiService
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/models/orderdetailsmodel"
|
||||||
|
"cron_admin/app/models/ordersmodel"
|
||||||
|
"cron_admin/app/models/usercouponmodel"
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"crypto/aes"
|
"crypto/aes"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"gitee.com/chengdu_blue_brothers/openapi-go-sdk/api"
|
"gitee.com/chengdu_blue_brothers/openapi-go-sdk/api"
|
||||||
"gitee.com/chengdu_blue_brothers/openapi-go-sdk/notify"
|
"gitee.com/chengdu_blue_brothers/openapi-go-sdk/notify"
|
||||||
"net/http"
|
"net/http"
|
||||||
"qteam/app/models/orderdetailsmodel"
|
|
||||||
"qteam/app/models/ordersmodel"
|
|
||||||
"qteam/app/models/usercouponmodel"
|
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package httpclient
|
package httpclient
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/utils"
|
||||||
"fmt"
|
"fmt"
|
||||||
"qteam/app/utils"
|
|
||||||
|
|
||||||
"github.com/valyala/fasthttp"
|
"github.com/valyala/fasthttp"
|
||||||
"time"
|
"time"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package mq
|
package mq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
common3 "qteam/app/constants/common"
|
common3 "cron_admin/app/constants/common"
|
||||||
mq "qteam/app/utils/mq/mqs"
|
mq "cron_admin/app/utils/mq/mqs"
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,12 +2,12 @@ package mq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/Shopify/sarama"
|
"github.com/Shopify/sarama"
|
||||||
"github.com/qit-team/snow-core/redis"
|
"github.com/qit-team/snow-core/redis"
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package mq
|
package mq
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/nats-io/nats.go"
|
"github.com/nats-io/nats.go"
|
||||||
_ "github.com/nats-io/nats.go"
|
_ "github.com/nats-io/nats.go"
|
||||||
"github.com/streadway/amqp"
|
"github.com/streadway/amqp"
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type NatsMq struct {
|
type NatsMq struct {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package utils
|
package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/config"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/nacos-group/nacos-sdk-go/v2/clients"
|
"github.com/nacos-group/nacos-sdk-go/v2/clients"
|
||||||
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
|
"github.com/nacos-group/nacos-sdk-go/v2/clients/naming_client"
|
||||||
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
|
"github.com/nacos-group/nacos-sdk-go/v2/common/constant"
|
||||||
"github.com/nacos-group/nacos-sdk-go/v2/vo"
|
"github.com/nacos-group/nacos-sdk-go/v2/vo"
|
||||||
"qteam/config"
|
|
||||||
"sync"
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package sm2
|
package sm2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/config"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/tjfoc/gmsm/sm2"
|
"github.com/tjfoc/gmsm/sm2"
|
||||||
"math/big"
|
"math/big"
|
||||||
"qteam/config"
|
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,8 @@ package utils
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/constants/common"
|
||||||
|
"cron_admin/config"
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"crypto/sha256"
|
"crypto/sha256"
|
||||||
|
@ -19,8 +21,6 @@ import (
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"qteam/app/constants/common"
|
|
||||||
"qteam/config"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"regexp"
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package bootstrap
|
package bootstrap
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/jobs"
|
||||||
|
"cron_admin/app/jobs/basejob"
|
||||||
|
"cron_admin/config"
|
||||||
"github.com/qit-team/snow-core/log/accesslogger"
|
"github.com/qit-team/snow-core/log/accesslogger"
|
||||||
"qteam/app/jobs"
|
|
||||||
"qteam/app/jobs/basejob"
|
|
||||||
"qteam/config"
|
|
||||||
|
|
||||||
"github.com/qit-team/snow-core/db"
|
"github.com/qit-team/snow-core/db"
|
||||||
"github.com/qit-team/snow-core/kernel/close"
|
"github.com/qit-team/snow-core/kernel/close"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package event
|
package event
|
||||||
|
|
||||||
import "qteam/app/utils"
|
import "cron_admin/app/utils"
|
||||||
|
|
||||||
type EventHandler interface {
|
type EventHandler interface {
|
||||||
Handle(param interface{})
|
Handle(param interface{})
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package event
|
package event
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"qteam/app/constants/common"
|
"cron_admin/app/constants/common"
|
||||||
"qteam/event/observers"
|
"cron_admin/event/observers"
|
||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
8
go.mod
8
go.mod
|
@ -1,4 +1,4 @@
|
||||||
module qteam
|
module cron_admin
|
||||||
|
|
||||||
go 1.21
|
go 1.21
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ require (
|
||||||
gitee.com/chengdu_blue_brothers/openapi-go-sdk v0.0.2
|
gitee.com/chengdu_blue_brothers/openapi-go-sdk v0.0.2
|
||||||
github.com/BurntSushi/toml v0.4.1
|
github.com/BurntSushi/toml v0.4.1
|
||||||
github.com/Shopify/sarama v1.19.0
|
github.com/Shopify/sarama v1.19.0
|
||||||
|
github.com/ahmetb/go-linq/v3 v3.2.0
|
||||||
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
|
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
|
||||||
github.com/forgoer/openssl v1.6.0
|
github.com/forgoer/openssl v1.6.0
|
||||||
github.com/gin-gonic/gin v1.7.7
|
github.com/gin-gonic/gin v1.7.7
|
||||||
|
@ -29,6 +30,8 @@ require (
|
||||||
google.golang.org/grpc v1.56.3
|
google.golang.org/grpc v1.56.3
|
||||||
google.golang.org/protobuf v1.30.0
|
google.golang.org/protobuf v1.30.0
|
||||||
gopkg.in/go-playground/validator.v9 v9.31.0
|
gopkg.in/go-playground/validator.v9 v9.31.0
|
||||||
|
xorm.io/builder v0.3.9
|
||||||
|
xorm.io/xorm v1.2.5
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -52,6 +55,7 @@ require (
|
||||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect
|
||||||
github.com/eapache/queue v1.1.0 // indirect
|
github.com/eapache/queue v1.1.0 // indirect
|
||||||
github.com/emirpasic/gods v1.12.0 // indirect
|
github.com/emirpasic/gods v1.12.0 // indirect
|
||||||
|
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||||
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
github.com/go-openapi/jsonpointer v0.19.5 // indirect
|
||||||
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
github.com/go-openapi/jsonreference v0.19.6 // indirect
|
||||||
|
@ -110,7 +114,5 @@ require (
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
stathat.com/c/consistent v1.0.0 // indirect
|
stathat.com/c/consistent v1.0.0 // indirect
|
||||||
xorm.io/builder v0.3.9 // indirect
|
|
||||||
xorm.io/core v0.7.3 // indirect
|
xorm.io/core v0.7.3 // indirect
|
||||||
xorm.io/xorm v1.2.5 // indirect
|
|
||||||
)
|
)
|
||||||
|
|
3
go.sum
3
go.sum
|
@ -61,6 +61,8 @@ github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/
|
||||||
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c=
|
||||||
github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs=
|
github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs=
|
||||||
github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
|
github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY=
|
||||||
|
github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE=
|
||||||
|
github.com/ahmetb/go-linq/v3 v3.2.0/go.mod h1:haQ3JfOeWK8HpVxMtHHEMPVgBKiYyQ+f1/kLZh/cj9U=
|
||||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||||
|
@ -173,6 +175,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
|
||||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||||
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI=
|
||||||
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU=
|
||||||
|
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 h1:6VSn3hB5U5GeA6kQw4TwWIWbOhtvR2hmbBJnTOtqTWc=
|
||||||
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6/go.mod h1:YxOVT5+yHzKvwhsiSIWmbAYM3Dr9AEEbER2dVayfBkg=
|
github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6/go.mod h1:YxOVT5+yHzKvwhsiSIWmbAYM3Dr9AEEbER2dVayfBkg=
|
||||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||||
github.com/gin-contrib/gzip v0.0.3 h1:etUaeesHhEORpZMp18zoOhepboiWnFtXrBZxszWUn4k=
|
github.com/gin-contrib/gzip v0.0.3 h1:etUaeesHhEORpZMp18zoOhepboiWnFtXrBZxszWUn4k=
|
||||||
|
|
14
main.go
14
main.go
|
@ -1,16 +1,16 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"cron_admin/app/console"
|
||||||
|
"cron_admin/app/http/routes"
|
||||||
|
"cron_admin/app/jobs"
|
||||||
|
"cron_admin/bootstrap"
|
||||||
|
"cron_admin/config"
|
||||||
|
_ "cron_admin/docs"
|
||||||
|
"cron_admin/rpc"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"qteam/app/console"
|
|
||||||
"qteam/app/http/routes"
|
|
||||||
"qteam/app/jobs"
|
|
||||||
"qteam/bootstrap"
|
|
||||||
"qteam/config"
|
|
||||||
_ "qteam/docs"
|
|
||||||
"qteam/rpc"
|
|
||||||
|
|
||||||
_ "github.com/go-sql-driver/mysql"
|
_ "github.com/go-sql-driver/mysql"
|
||||||
_ "github.com/qit-team/snow-core/cache/rediscache"
|
_ "github.com/qit-team/snow-core/cache/rediscache"
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package rpc
|
package rpc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
__ "cron_admin/rpc/user"
|
||||||
"github.com/qit-team/snow-core/kernel/server"
|
"github.com/qit-team/snow-core/kernel/server"
|
||||||
__ "qteam/rpc/user"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartRpc() error {
|
func StartRpc() error {
|
||||||
|
@ -10,7 +10,7 @@ func StartRpc() error {
|
||||||
|
|
||||||
//等待停止信号
|
//等待停止信号
|
||||||
server.WaitStop()
|
server.WaitStop()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,11 @@ package __
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"cron_admin/app/utils"
|
||||||
|
"cron_admin/config"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"log"
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"qteam/app/utils"
|
|
||||||
"qteam/config"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 服务定义
|
// 服务定义
|
||||||
|
|
Loading…
Reference in New Issue