1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package xiangyu
- import (
- "eta/eta_bridge/controller/resp"
- "eta/eta_bridge/logic/xiangyu"
- "github.com/gin-gonic/gin"
- "sync"
- )
- type XiangyuController struct{}
- var lockSyncUser sync.Mutex
- func (xc *XiangyuController) SyncUser(c *gin.Context) {
- lockSyncUser.Lock()
- defer func() {
- lockSyncUser.Unlock()
- }()
- err := xiangyu.SyncUser()
- if err != nil {
- resp.FailData("同步失败", err.Error(), c)
- return
- }
- resp.Ok("同步成功", c)
- return
- }
- func (xc *XiangyuController) PullUser(c *gin.Context) {
- lockSyncUser.Lock()
- defer func() {
- lockSyncUser.Unlock()
- }()
- err := xiangyu.PullUser()
- if err != nil {
- resp.FailData("同步失败", err.Error(), c)
- return
- }
- resp.Ok("同步成功", c)
- return
- }
|