1
This commit is contained in:
@@ -39,7 +39,6 @@ func (a *Auth2Controller) Login(c *gin.Context) {
|
||||
}
|
||||
|
||||
controllers.CallFunc(c, func() (retVal interface{}, errCode string, err error) {
|
||||
globals.SugarLogger.Debugf("userParam =============params:%s", utils.Format4Output(params, false))
|
||||
user, err := service.WxLogin(c, params)
|
||||
if err != nil {
|
||||
return nil, "", err
|
||||
|
||||
@@ -3,7 +3,6 @@ package app
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
"git.rosy.net.cn/jx-print/controllers"
|
||||
"git.rosy.net.cn/jx-print/globals"
|
||||
"git.rosy.net.cn/jx-print/model"
|
||||
@@ -157,7 +156,6 @@ func (p *Print) GetPrintIsUse(c *gin.Context) {
|
||||
result["phone"] = phone
|
||||
result["err"] = err
|
||||
retVal = result
|
||||
globals.SugarLogger.Debugf("=====%s", utils.Format4Output(result, false))
|
||||
return retVal, "", nil
|
||||
})
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ func AddApp(c *gin.Context) {
|
||||
Code: model.ErrCodeNormal,
|
||||
Desc: err.Error(),
|
||||
})
|
||||
globals.SugarLogger.Debugf("End API :%s error:%v:", c.Request.URL, err)
|
||||
return
|
||||
}
|
||||
if tokenInfo = CheckToken(c); tokenInfo == nil {
|
||||
@@ -72,7 +71,6 @@ func DelApp(c *gin.Context) {
|
||||
Code: model.ErrCodeNormal,
|
||||
Desc: err.Error(),
|
||||
})
|
||||
globals.SugarLogger.Debugf("End API :%s error:%v:", c.Request.URL, err)
|
||||
return
|
||||
}
|
||||
if tokenInfo = CheckToken(c); tokenInfo == nil {
|
||||
|
||||
@@ -22,7 +22,6 @@ func (t *CallbackController) Msg(c *gin.Context) {
|
||||
|
||||
func (t *CallbackController) TlPayCallback(c *gin.Context) {
|
||||
data, _ := ioutil.ReadAll(c.Request.Body)
|
||||
globals.SugarLogger.Debugf("TlPayCallback msg: %v", string(data))
|
||||
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer(data))
|
||||
if call, err := api.TLpayAPI.GetCallbackMsg(c.Request); err == nil {
|
||||
globals.SugarLogger.Debugf("tonglianapi callback callbackResponse:%s", utils.Format4Output(call, true))
|
||||
|
||||
@@ -46,8 +46,8 @@ func InitV2System(v2 *gin.RouterGroup) {
|
||||
edition.POST("/selectEditionAddress", appCont.PrintEditionController.SelectEditionAddress)
|
||||
// notice 广告和通知消息
|
||||
notice := v2.Group("/notice")
|
||||
notice.POST("/addEditionAddress", appCont.PrintNoticeController.AddNoticeAddress)
|
||||
notice.POST("/updateEditionAddress", appCont.PrintNoticeController.UpdateNoticeAddress)
|
||||
notice.POST("/deleteEditionAddress", appCont.PrintNoticeController.DeleteNoticeAddress)
|
||||
notice.POST("/selectEditionAddress", appCont.PrintNoticeController.SelectNoticeAddress)
|
||||
notice.POST("/addNoticeAddress", appCont.PrintNoticeController.AddNoticeAddress)
|
||||
notice.POST("/updateNoticeAddress", appCont.PrintNoticeController.UpdateNoticeAddress)
|
||||
notice.POST("/deleteNoticeAddress", appCont.PrintNoticeController.DeleteNoticeAddress)
|
||||
notice.POST("/selectNoticeAddress", appCont.PrintNoticeController.SelectNoticeAddress)
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ func (u *UserLogin) WxLogin(ctx *gin.Context, param *wxLogin.WxLoginReq) (*model
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
globals.SugarLogger.Debugf("userParam =============:%s", utils.Format4Output(param, false))
|
||||
|
||||
// 检查用户是否存在
|
||||
users, err := dao.GetUsers(globals.GetDB(), "", "", param.Phone, "")
|
||||
@@ -82,7 +81,6 @@ func (u *UserLogin) WxLogin(ctx *gin.Context, param *wxLogin.WxLoginReq) (*model
|
||||
users[0].LastOperator = users[0].Name
|
||||
users[0].LastLoginIP = ctx.ClientIP()
|
||||
if err := dao.UpdateUserWx(users[0], []string{"updated_at", "last_operator", "name", "avatar", "last_login_ip", "open_id", "union_id"}); err != nil {
|
||||
globals.SugarLogger.Debugf("====err:%s", err.Error())
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -131,9 +131,8 @@ func GetPrintIsUse(printNo string) (bool, string, error) {
|
||||
|
||||
func DelPrinters(appID int, tokenInfo *model.TokenInfo, printNos string) (err error) {
|
||||
var (
|
||||
db = globals.GetDB()
|
||||
errs []error
|
||||
now = time.Now()
|
||||
db = globals.GetDB()
|
||||
now = time.Now()
|
||||
)
|
||||
if len(printNos) > 50 {
|
||||
return fmt.Errorf("每次最多删除50台!")
|
||||
@@ -143,20 +142,17 @@ func DelPrinters(appID int, tokenInfo *model.TokenInfo, printNos string) (err er
|
||||
}
|
||||
printers, _ := dao.GetPrinters(db, appID, printNos, 0, 0, 0)
|
||||
if len(printers) == 0 {
|
||||
errs = append(errs, fmt.Errorf("未在该应用下查到此打印机!app_id: %d, print_no: %s", appID, printNos))
|
||||
return fmt.Errorf("未在该应用下查到此打印机!app_id: %d, print_no: %s", appID, printNos)
|
||||
}
|
||||
if printers[0].UserId != tokenInfo.User.UserID {
|
||||
errs = append(errs, fmt.Errorf("该打印机不属于此用户 :%s 。", printNos))
|
||||
return fmt.Errorf("该打印机不属于此用户 :%s 。", printNos)
|
||||
}
|
||||
|
||||
printer := printers[0]
|
||||
printer.DeletedAt = &now
|
||||
printer.LastOperator = tokenInfo.User.Name
|
||||
if err = dao.Update(db, printer, model.FieldLastOperator, model.FieldDeletedAt); err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
if len(errs) > 0 {
|
||||
err = putils.BuildErr(errs)
|
||||
return err
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -153,17 +153,17 @@ func TestPrint(c *gin.Context, appID int, tokenInfo *model.TokenInfo, printNo st
|
||||
now = time.Now()
|
||||
)
|
||||
msgID = now.Format("20060102150405") + "_" + putils.RandStringBytesWithNumber(8)
|
||||
apps, err := dao.GetApps(db, appID, tokenInfo.User.UserID, "")
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if len(apps) == 0 {
|
||||
return "", fmt.Errorf("未查询到此应用!app_id:%d", appID)
|
||||
}
|
||||
printers, _ := dao.GetPrinters(db, appID, printNo, 0, 0, 0)
|
||||
if len(printers) == 0 {
|
||||
return "", fmt.Errorf("未在该应用下查到此打印机!app_id: %d, print_no: %s", appID, printNo)
|
||||
}
|
||||
//apps, err := dao.GetApps(db, appID, tokenInfo.User.UserID, "")
|
||||
//if err != nil {
|
||||
// return "", err
|
||||
//}
|
||||
//if len(apps) == 0 {
|
||||
// return "", fmt.Errorf("未查询到此应用!app_id:%d", appID)
|
||||
//}
|
||||
//printers, _ := dao.GetPrinters(db, appID, printNo, 0, 0, 0)
|
||||
//if len(printers) == 0 {
|
||||
// return "", fmt.Errorf("未在该应用下查到此打印机!app_id: %d, print_no: %s", appID, printNo)
|
||||
//}
|
||||
printMsg := &model.PrintMsg{
|
||||
CreatedAt: &now,
|
||||
UpdatedAt: &now,
|
||||
|
||||
Reference in New Issue
Block a user