fix:
This commit is contained in:
parent
9956caeaba
commit
d2f17242f0
|
@ -1,6 +1,7 @@
|
||||||
package controller
|
package controller
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"github.com/codinl/go-logger"
|
"github.com/codinl/go-logger"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"mh-server/lib/auth"
|
"mh-server/lib/auth"
|
||||||
|
@ -415,8 +416,11 @@ func ConsoleRecycleCardOrderList(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecycleCardBrandList(c *gin.Context) {
|
func RecycleCardBrandList(c *gin.Context) {
|
||||||
req := xianmai.SmBrandListReq{
|
req := &xianmai.SmBrandListReq{}
|
||||||
CategoryId: 10,
|
if c.ShouldBindJSON(req) != nil {
|
||||||
|
logger.Error("ShouldBindJSON err")
|
||||||
|
RespJson(c, status.BadRequest, nil)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
resp, err := req.List()
|
resp, err := req.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -430,8 +434,11 @@ func RecycleCardBrandList(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RecycleCardGoodsList(c *gin.Context) {
|
func RecycleCardGoodsList(c *gin.Context) {
|
||||||
req := xianmai.SmGoodsListReq{
|
req := &xianmai.SmGoodsListReq{}
|
||||||
CategoryId: 10,
|
if c.ShouldBindJSON(req) != nil {
|
||||||
|
logger.Error("ShouldBindJSON err")
|
||||||
|
RespJson(c, status.BadRequest, nil)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
resp, err := req.List()
|
resp, err := req.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -476,12 +483,27 @@ func RecycleCardSubmitOrderEvaluation(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/submitOrderEvaluation",
|
ApiRoute: "/openapi/order/submitOrderEvaluation",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.SubmitOrderEvaluationResp{}
|
resp := &model.SubmitOrderEvaluationResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("SubmitOrderEvaluationResp err:", err)
|
logger.Error("SubmitOrderEvaluationResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -499,12 +521,27 @@ func RecycleCardSubmitOrderDelivery(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/submitOrderDelivery",
|
ApiRoute: "/openapi/order/submitOrderDelivery",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.SubmitOrderDeliveryResp{}
|
resp := &model.SubmitOrderDeliveryResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("SubmitOrderDeliveryResp err:", err)
|
logger.Error("SubmitOrderDeliveryResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -522,12 +559,27 @@ func RecycleCardCancelOrderDelivery(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/cancelOrderDelivery",
|
ApiRoute: "/openapi/order/cancelOrderDelivery",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.CancelOrderDeliveryResp{}
|
resp := &model.CancelOrderDeliveryResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("CancelOrderDeliveryResp err:", err)
|
logger.Error("CancelOrderDeliveryResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -545,12 +597,27 @@ func RecycleCardQueryMemberOrderList(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/queryMemberOrderList",
|
ApiRoute: "/openapi/order/queryMemberOrderList",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.QueryMemberOrderListResp{}
|
resp := &model.QueryMemberOrderListResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("QueryMemberOrderListResp err:", err)
|
logger.Error("QueryMemberOrderListResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -568,12 +635,27 @@ func RecycleCardQueryMemberOrderdetail(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/queryMemberOrderdetail",
|
ApiRoute: "/openapi/order/queryMemberOrderdetail",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.QueryMemberOrderdetailResp{}
|
resp := &model.QueryMemberOrderdetailResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("QueryMemberOrderdetailResp err:", err)
|
logger.Error("QueryMemberOrderdetailResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -591,12 +673,27 @@ func RecycleCardQueryMemberOrderDelivery(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/queryMemberOrderDelivery",
|
ApiRoute: "/openapi/order/queryMemberOrderDelivery",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.QueryMemberOrderDeliveryResp{}
|
resp := &model.QueryMemberOrderDeliveryResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("QueryMemberOrderDeliveryResp err:", err)
|
logger.Error("QueryMemberOrderDeliveryResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -614,12 +711,27 @@ func RecycleCardSubmitConfirmPrice(c *gin.Context) {
|
||||||
RespJson(c, status.BadRequest, nil)
|
RespJson(c, status.BadRequest, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
uc := auth.GetCurrentUser(c)
|
||||||
|
if uc == nil {
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
//uc = &auth.UserClaims{Uid: 63192613}
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user.Tel == "" {
|
||||||
|
logger.Error("GetUserByUid err:")
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
smExternal := &xianmai.SmExternal{
|
smExternal := &xianmai.SmExternal{
|
||||||
ParaMap: req,
|
ParaMap: req,
|
||||||
ApiRoute: "/openapi/order/submitConfirmPrice",
|
ApiRoute: "/openapi/order/submitConfirmPrice",
|
||||||
|
WechatId: fmt.Sprintf("%d", user.Uid),
|
||||||
|
WechatMobile: user.Tel,
|
||||||
|
RequestType: "placeOrder",
|
||||||
}
|
}
|
||||||
resp := &model.SubmitConfirmPriceResp{}
|
resp := &model.SubmitConfirmPriceResp{}
|
||||||
err := smExternal.Pulling(resp)
|
err := smExternal.EoPulling(resp)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("QueryMemberOrderDeliveryResp err:", err)
|
logger.Error("QueryMemberOrderDeliveryResp err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
|
|
@ -371,7 +371,7 @@ func UpgradeMember(c *gin.Context) {
|
||||||
// RespJson(c, status.InternalServerError, nil)
|
// RespJson(c, status.InternalServerError, nil)
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if user.Gender != 0 {
|
if user.Gender != 0 {
|
||||||
logger.Error("user member genre err:")
|
logger.Error("user member genre err:")
|
||||||
RespJson(c, status.ShortMemberNotUpgradeMember, nil)
|
RespJson(c, status.ShortMemberNotUpgradeMember, nil)
|
||||||
|
|
|
@ -245,8 +245,11 @@ func (m *SmGoodsListReq) List() (*SmGoodsListResp, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SmExternal struct {
|
type SmExternal struct {
|
||||||
ParaMap interface{}
|
ParaMap interface{} `json:"para_map"`
|
||||||
ApiRoute string `json:"api_route"`
|
ApiRoute string `json:"api_route"`
|
||||||
|
WechatId string `json:"wechat_id"`
|
||||||
|
WechatMobile string `json:"wechat_mobile"`
|
||||||
|
RequestType string `json:"request_type"`
|
||||||
//Resp interface{}
|
//Resp interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,3 +261,22 @@ func (m *SmExternal) Pulling(resp interface{}) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *SmExternal) EoPulling(resp interface{}) error {
|
||||||
|
maiToken, err := EoSanMaiToken(m.WechatId, m.WechatMobile, m.RequestType)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("EoSanMaiToken err:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
sanMaiClient = &SanMaiClient{
|
||||||
|
Authentication: maiToken,
|
||||||
|
BaseURL: SmBaseURL,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = sanMaiClient.post(m.ApiRoute, m.ParaMap, resp)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("post err:", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -3,12 +3,14 @@ package xianmai
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/codinl/go-logger"
|
"github.com/codinl/go-logger"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type XianMaiClient struct {
|
type XianMaiClient struct {
|
||||||
|
@ -178,23 +180,105 @@ type GameEvaluationResp struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type SanMaiClient struct {
|
type SanMaiClient struct {
|
||||||
Authentication string `json:"authentication"`
|
Authentication string `json:"authentication"`
|
||||||
BaseURL string `json:"base_url"`
|
BaseURL string `json:"base_url"`
|
||||||
|
ExpireTime time.Time `json:"expire_time"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
SmBaseURL = "https://test.xianmai.net.cn/"
|
||||||
|
//SmBaseURL = "https://xianmai.net.cn/"
|
||||||
|
)
|
||||||
|
|
||||||
var sanMaiClient *SanMaiClient
|
var sanMaiClient *SanMaiClient
|
||||||
|
|
||||||
func GetSanMaiClient() *SanMaiClient {
|
func GetSanMaiClient() *SanMaiClient {
|
||||||
if sanMaiClient == nil {
|
nowTime := time.Now()
|
||||||
|
fmt.Println("time.Now:", nowTime)
|
||||||
|
if sanMaiClient == nil || sanMaiClient.ExpireTime.Before(nowTime) {
|
||||||
|
fmt.Println("初始化数据")
|
||||||
sanMaiClient = &SanMaiClient{
|
sanMaiClient = &SanMaiClient{
|
||||||
Authentication: "",
|
Authentication: SanMaiToken(),
|
||||||
//BaseURL: "https://xianmai.net.cn/",
|
BaseURL: SmBaseURL,
|
||||||
BaseURL: "https://test.xianmai.net.cn/",
|
ExpireTime: nowTime.AddDate(0, 0, 1),
|
||||||
}
|
}
|
||||||
|
return sanMaiClient
|
||||||
}
|
}
|
||||||
return sanMaiClient
|
return sanMaiClient
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SanMaiToken() string {
|
||||||
|
smExternal := SmExternal{
|
||||||
|
ParaMap: SubmitLoginApiReq{
|
||||||
|
Username: "13307551242",
|
||||||
|
Password: "dw123",
|
||||||
|
},
|
||||||
|
ApiRoute: "/loginApi",
|
||||||
|
}
|
||||||
|
sanMaiClient = &SanMaiClient{
|
||||||
|
Authentication: "",
|
||||||
|
BaseURL: SmBaseURL,
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := &SubmitLoginApiResp{}
|
||||||
|
err := sanMaiClient.post(smExternal.ApiRoute, smExternal.ParaMap, resp)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("SubmitLoginApiResp err:", err)
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return resp.Data.Token
|
||||||
|
}
|
||||||
|
|
||||||
|
func EoSanMaiToken(wechatId, wechatMobile, requestType string) (string, error) {
|
||||||
|
if wechatId == "" || wechatMobile == "" || requestType == "" {
|
||||||
|
return "", errors.New("para err")
|
||||||
|
}
|
||||||
|
smExternal := SmExternal{
|
||||||
|
ParaMap: SubmitLoginApiReq{
|
||||||
|
Username: "13307551242",
|
||||||
|
Password: "dw123",
|
||||||
|
WechatId: wechatId,
|
||||||
|
WechatMobile: wechatMobile,
|
||||||
|
RequestType: requestType,
|
||||||
|
},
|
||||||
|
ApiRoute: "/loginApi",
|
||||||
|
}
|
||||||
|
sanMaiClient = &SanMaiClient{
|
||||||
|
Authentication: "",
|
||||||
|
BaseURL: SmBaseURL,
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := &SubmitLoginApiResp{}
|
||||||
|
err := sanMaiClient.post(smExternal.ApiRoute, smExternal.ParaMap, resp)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("SubmitLoginApiResp err:", err)
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
return resp.Data.Token, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
type SubmitLoginApiReq struct {
|
||||||
|
Username string `json:"username"`
|
||||||
|
Password string `json:"password"`
|
||||||
|
WechatId string `json:"wechatId"`
|
||||||
|
WechatMobile string `json:"wechatMobile"`
|
||||||
|
RequestType string `json:"requestType"`
|
||||||
|
}
|
||||||
|
type SubmitLoginApiResp struct {
|
||||||
|
Flag bool `json:"flag"`
|
||||||
|
Code int `json:"code"`
|
||||||
|
Message string `json:"message"`
|
||||||
|
Data1 interface{} `json:"data1"`
|
||||||
|
Data struct {
|
||||||
|
ComponyName string `json:"componyName"`
|
||||||
|
Permissions []string `json:"permissions"`
|
||||||
|
Roles []string `json:"roles"`
|
||||||
|
ExipreTime string `json:"exipreTime"`
|
||||||
|
ComponyId string `json:"componyId"`
|
||||||
|
Token string `json:"token"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
|
||||||
//func (m *SanMaiClient) post(xmApi string, params map[string]interface{}, resp interface{}) error {
|
//func (m *SanMaiClient) post(xmApi string, params map[string]interface{}, resp interface{}) error {
|
||||||
// uri := m.BaseURL + xmApi
|
// uri := m.BaseURL + xmApi
|
||||||
// data, err := json.Marshal(params)
|
// data, err := json.Marshal(params)
|
||||||
|
@ -236,7 +320,7 @@ func GetSanMaiClient() *SanMaiClient {
|
||||||
|
|
||||||
func (m *SanMaiClient) post(xmApi string, params interface{}, resp interface{}) error {
|
func (m *SanMaiClient) post(xmApi string, params interface{}, resp interface{}) error {
|
||||||
uri := m.BaseURL + xmApi
|
uri := m.BaseURL + xmApi
|
||||||
data, err := json.Marshal(params)
|
data, err := json.Marshal(¶ms)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("Marshal params err:", err)
|
logger.Error("Marshal params err:", err)
|
||||||
return err
|
return err
|
||||||
|
@ -260,13 +344,13 @@ func (m *SanMaiClient) post(xmApi string, params interface{}, resp interface{})
|
||||||
|
|
||||||
dataRsp, err := io.ReadAll(res.Body)
|
dataRsp, err := io.ReadAll(res.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
logger.Error("ReadAll Body err:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("dataRsp:", string(dataRsp))
|
fmt.Println("dataRsp:", string(dataRsp))
|
||||||
if err = json.Unmarshal(dataRsp, resp); err != nil {
|
if err = json.Unmarshal(dataRsp, resp); err != nil {
|
||||||
fmt.Println(err)
|
logger.Error("Unmarshal dataRsp err:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2684,7 +2684,7 @@ func TestUserMemberGenreInfo(t *testing.T) {
|
||||||
UserMemberGenreInfo()
|
UserMemberGenreInfo()
|
||||||
}
|
}
|
||||||
|
|
||||||
// 拉新锁卡数据
|
// 短期会员数据
|
||||||
func UserMemberGenreInfo() {
|
func UserMemberGenreInfo() {
|
||||||
DB = DBProd
|
DB = DBProd
|
||||||
var cards []User
|
var cards []User
|
||||||
|
@ -2760,7 +2760,7 @@ func TestEvaluation(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("err:", err)
|
fmt.Println("err:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("cassetteList:", cassetteList)
|
fmt.Println("cassetteList:", cassetteList)
|
||||||
fmt.Println("i:", i)
|
fmt.Println("i:", i)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ package model
|
||||||
type ProblemSkuListReq struct {
|
type ProblemSkuListReq struct {
|
||||||
GoodsId int `json:"goodsId"`
|
GoodsId int `json:"goodsId"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProblemSkuListResp struct {
|
type ProblemSkuListResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Code int `json:"code"`
|
Code int `json:"code"`
|
||||||
|
@ -16,6 +17,7 @@ type ProblemSkuListResp struct {
|
||||||
ProblemName string `json:"problemName"`
|
ProblemName string `json:"problemName"`
|
||||||
ProblemId int `json:"problemId"`
|
ProblemId int `json:"problemId"`
|
||||||
List []struct {
|
List []struct {
|
||||||
|
Isupt string `json:"isupt"`
|
||||||
ProblemValueId string `json:"problemValueId"`
|
ProblemValueId string `json:"problemValueId"`
|
||||||
ProblemValueName string `json:"problemValueName"`
|
ProblemValueName string `json:"problemValueName"`
|
||||||
} `json:"list"`
|
} `json:"list"`
|
||||||
|
@ -27,33 +29,34 @@ type ProblemSkuListResp struct {
|
||||||
ProblemName string `json:"problemName"`
|
ProblemName string `json:"problemName"`
|
||||||
ProblemId int `json:"problemId"`
|
ProblemId int `json:"problemId"`
|
||||||
List []struct {
|
List []struct {
|
||||||
|
Isupt string `json:"isupt"`
|
||||||
ProblemValueId string `json:"problemValueId"`
|
ProblemValueId string `json:"problemValueId"`
|
||||||
ProblemValueName string `json:"problemValueName"`
|
ProblemValueName string `json:"problemValueName"`
|
||||||
} `json:"list"`
|
} `json:"list"`
|
||||||
} `json:"problemSkuList"`
|
} `json:"problemSkuList"`
|
||||||
GoodsInfo struct {
|
GoodsInfo struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CategoryId int `json:"categoryId"`
|
CategoryId int `json:"categoryId"`
|
||||||
BrandId int `json:"brandId"`
|
BrandId int `json:"brandId"`
|
||||||
Status int `json:"status"`
|
Status int `json:"status"`
|
||||||
Gallery string `json:"gallery"`
|
Gallery string `json:"gallery"`
|
||||||
Keyword string `json:"keyword"`
|
Keyword string `json:"keyword"`
|
||||||
CreateTime string `json:"createTime"`
|
CreateTime string `json:"createTime"`
|
||||||
UpdateTime string `json:"updateTime"`
|
UpdateTime string `json:"updateTime"`
|
||||||
Deleted int `json:"deleted"`
|
Deleted int `json:"deleted"`
|
||||||
Price int `json:"price"`
|
Price float64 `json:"price"`
|
||||||
PriceHigh int `json:"priceHigh"`
|
PriceHigh float64 `json:"priceHigh"`
|
||||||
PriceAvg int `json:"priceAvg"`
|
PriceAvg float64 `json:"priceAvg"`
|
||||||
PriceCycle int `json:"priceCycle"`
|
PriceCycle int `json:"priceCycle"`
|
||||||
OverdueDays int `json:"overdueDays"`
|
OverdueDays int `json:"overdueDays"`
|
||||||
PriceAdjustmentTime string `json:"priceAdjustmentTime"`
|
PriceAdjustmentTime string `json:"priceAdjustmentTime"`
|
||||||
TemlateId int `json:"temlateId"`
|
TemlateId int `json:"temlateId"`
|
||||||
TemplateName string `json:"templateName"`
|
TemplateName string `json:"templateName"`
|
||||||
BrandName string `json:"brandName"`
|
BrandName string `json:"brandName"`
|
||||||
CategoryName string `json:"categoryName"`
|
CategoryName string `json:"categoryName"`
|
||||||
IsBindCoupon bool `json:"isBindCoupon"`
|
IsBindCoupon bool `json:"isBindCoupon"`
|
||||||
Tindex int `json:"tindex"`
|
Tindex int `json:"tindex"`
|
||||||
} `json:"goodsInfo"`
|
} `json:"goodsInfo"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
}
|
}
|
||||||
|
@ -98,7 +101,7 @@ type SubmitOrderDeliveryReq struct {
|
||||||
|
|
||||||
type SubmitOrderDeliveryResp struct {
|
type SubmitOrderDeliveryResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Code int `json:"code"`
|
Code interface{} `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Data1 interface{} `json:"data1"`
|
Data1 interface{} `json:"data1"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
|
@ -109,16 +112,16 @@ type CancelOrderDeliveryReq struct {
|
||||||
}
|
}
|
||||||
type CancelOrderDeliveryResp struct {
|
type CancelOrderDeliveryResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Code int `json:"code"`
|
Code interface{} `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Data1 interface{} `json:"data1"`
|
Data1 interface{} `json:"data1"`
|
||||||
Data string `json:"data"`
|
Data string `json:"data"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type QueryMemberOrderListReq struct {
|
type QueryMemberOrderListReq struct {
|
||||||
DataType int `json:"dataType"`
|
DataType int `json:"dataType"`
|
||||||
PageNum string `json:"pageNum"`
|
PageNum int `json:"pageNum"`
|
||||||
PageSize string `json:"pageSize"`
|
PageSize int `json:"pageSize"`
|
||||||
}
|
}
|
||||||
type QueryMemberOrderListResp struct {
|
type QueryMemberOrderListResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
|
@ -138,8 +141,8 @@ type QueryMemberOrderListResp struct {
|
||||||
GoodsNum int `json:"goodsNum"`
|
GoodsNum int `json:"goodsNum"`
|
||||||
CourierNumber interface{} `json:"courierNumber"`
|
CourierNumber interface{} `json:"courierNumber"`
|
||||||
Imei string `json:"imei"`
|
Imei string `json:"imei"`
|
||||||
Price int `json:"price"`
|
Price float64 `json:"price"`
|
||||||
EvaluationPrice int `json:"evaluationPrice"`
|
EvaluationPrice float64 `json:"evaluationPrice"`
|
||||||
AddTime string `json:"addTime"`
|
AddTime string `json:"addTime"`
|
||||||
} `json:"list"`
|
} `json:"list"`
|
||||||
PageNum int `json:"pageNum"`
|
PageNum int `json:"pageNum"`
|
||||||
|
@ -166,7 +169,7 @@ type QueryMemberOrderdetailReq struct {
|
||||||
}
|
}
|
||||||
type QueryMemberOrderdetailResp struct {
|
type QueryMemberOrderdetailResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Code int `json:"code"`
|
Code interface{} `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Data1 interface{} `json:"data1"`
|
Data1 interface{} `json:"data1"`
|
||||||
Data struct {
|
Data struct {
|
||||||
|
@ -190,7 +193,7 @@ type QueryMemberOrderdetailResp struct {
|
||||||
GoodsId int `json:"goodsId"`
|
GoodsId int `json:"goodsId"`
|
||||||
MemberId int `json:"memberId"`
|
MemberId int `json:"memberId"`
|
||||||
StoreId int `json:"storeId"`
|
StoreId int `json:"storeId"`
|
||||||
EvaluationPrice int `json:"evaluationPrice"`
|
EvaluationPrice float64 `json:"evaluationPrice"`
|
||||||
QcPrice interface{} `json:"qcPrice"`
|
QcPrice interface{} `json:"qcPrice"`
|
||||||
PlatformPrice interface{} `json:"platformPrice"`
|
PlatformPrice interface{} `json:"platformPrice"`
|
||||||
ChangeNewPrice interface{} `json:"changeNewPrice"`
|
ChangeNewPrice interface{} `json:"changeNewPrice"`
|
||||||
|
@ -234,7 +237,7 @@ type QueryMemberOrderdetailResp struct {
|
||||||
BrandName string `json:"brandName"`
|
BrandName string `json:"brandName"`
|
||||||
TemplateName interface{} `json:"templateName"`
|
TemplateName interface{} `json:"templateName"`
|
||||||
TemplatePackName interface{} `json:"templatePackName"`
|
TemplatePackName interface{} `json:"templatePackName"`
|
||||||
Price int `json:"price"`
|
Price float64 `json:"price"`
|
||||||
Img string `json:"img"`
|
Img string `json:"img"`
|
||||||
AboutPic interface{} `json:"aboutPic"`
|
AboutPic interface{} `json:"aboutPic"`
|
||||||
ScrewHolePic interface{} `json:"screwHolePic"`
|
ScrewHolePic interface{} `json:"screwHolePic"`
|
||||||
|
@ -305,9 +308,9 @@ type QueryMemberOrderDeliveryReq struct {
|
||||||
OrderId int `json:"orderId"`
|
OrderId int `json:"orderId"`
|
||||||
}
|
}
|
||||||
type QueryMemberOrderDeliveryResp struct {
|
type QueryMemberOrderDeliveryResp struct {
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Code int `json:"code"`
|
Code interface{} `json:"code"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
Data struct {
|
Data struct {
|
||||||
Id int `json:"id"`
|
Id int `json:"id"`
|
||||||
OrderNo string `json:"orderNo"`
|
OrderNo string `json:"orderNo"`
|
||||||
|
@ -342,7 +345,7 @@ type SubmitConfirmPriceReq struct {
|
||||||
OrderId int `json:"orderId"`
|
OrderId int `json:"orderId"`
|
||||||
}
|
}
|
||||||
type SubmitConfirmPriceResp struct {
|
type SubmitConfirmPriceResp struct {
|
||||||
Code int `json:"code"`
|
Code interface{} `json:"code"`
|
||||||
Flag bool `json:"flag"`
|
Flag bool `json:"flag"`
|
||||||
Message string `json:"message"`
|
Message string `json:"message"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -229,7 +229,7 @@ func GetUserByUid(uid uint32) *User {
|
||||||
user := new(User)
|
user := new(User)
|
||||||
if err := NewUserQuerySet(DB).UidEq(uid).One(user); err != nil {
|
if err := NewUserQuerySet(DB).UidEq(uid).One(user); err != nil {
|
||||||
logger.Error(err, uid)
|
logger.Error(err, uid)
|
||||||
return nil
|
return user
|
||||||
}
|
}
|
||||||
return user
|
return user
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
export CONFIG_PATH=configs
|
|
||||||
export CONFIG_FILE_NAME=cron
|
|
||||||
|
|
||||||
export ENV=dev
|
|
||||||
export APP_NAME=$1
|
|
||||||
|
|
||||||
export LOG_FILE_NAME=$1
|
|
||||||
export LOG_PATH=log_cron
|
|
||||||
|
|
||||||
go run ../main.go $1
|
|
|
@ -1,21 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
export GIN_MODE=release
|
|
||||||
|
|
||||||
export CONFIG_PATH=configs
|
|
||||||
export CONFIG_FILE_NAME=cron
|
|
||||||
|
|
||||||
export ENV=pro
|
|
||||||
export APP_NAME=$1
|
|
||||||
export LOG_FILE_NAME=$1
|
|
||||||
|
|
||||||
app_name=$1
|
|
||||||
|
|
||||||
killall -15 ${app_name}
|
|
||||||
|
|
||||||
mv -f ./${app_name}_*.cron ./${app_name}.cron
|
|
||||||
|
|
||||||
basepath=$(cd `dirname $0`; pwd)
|
|
||||||
|
|
||||||
`${basepath}/${app_name}.cron ${app_name}` &
|
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
export GIN_MODE=release
|
|
||||||
|
|
||||||
export CONFIG_PATH=configs
|
|
||||||
export CONFIG_FILE_NAME=cron
|
|
||||||
|
|
||||||
export ENV=test
|
|
||||||
export APP_NAME=$1
|
|
||||||
|
|
||||||
app_name=$1
|
|
||||||
|
|
||||||
killall -15 ${app_name}
|
|
||||||
|
|
||||||
mv -f ./${app_name}_*.cron ./${app_name}.cron
|
|
||||||
|
|
||||||
basepath=$(cd `dirname $0`; pwd)
|
|
||||||
|
|
||||||
`${basepath}/${app_name}.cron ${app_name}` &
|
|
||||||
|
|
|
@ -265,6 +265,8 @@ func ConfigAppRouter(r gin.IRouter) {
|
||||||
recycle.POST("query_brand_list", controller.RecycleCardBrandList)
|
recycle.POST("query_brand_list", controller.RecycleCardBrandList)
|
||||||
recycle.POST("query_goods_list", controller.RecycleCardGoodsList)
|
recycle.POST("query_goods_list", controller.RecycleCardGoodsList)
|
||||||
recycle.POST("query_problem_sku_list", controller.RecycleCardProblemSkuList)
|
recycle.POST("query_problem_sku_list", controller.RecycleCardProblemSkuList)
|
||||||
|
|
||||||
|
recycle.Use(auth.UserAccessAuth)
|
||||||
recycle.POST("submit_order_evaluation", controller.RecycleCardSubmitOrderEvaluation)
|
recycle.POST("submit_order_evaluation", controller.RecycleCardSubmitOrderEvaluation)
|
||||||
recycle.POST("submit_order_delivery", controller.RecycleCardSubmitOrderDelivery)
|
recycle.POST("submit_order_delivery", controller.RecycleCardSubmitOrderDelivery)
|
||||||
recycle.POST("cancel_order_delivery", controller.RecycleCardCancelOrderDelivery)
|
recycle.POST("cancel_order_delivery", controller.RecycleCardCancelOrderDelivery)
|
||||||
|
@ -273,7 +275,6 @@ func ConfigAppRouter(r gin.IRouter) {
|
||||||
recycle.POST("query_member_order_delivery", controller.RecycleCardQueryMemberOrderDelivery)
|
recycle.POST("query_member_order_delivery", controller.RecycleCardQueryMemberOrderDelivery)
|
||||||
recycle.POST("submit_confirm_price", controller.RecycleCardSubmitConfirmPrice)
|
recycle.POST("submit_confirm_price", controller.RecycleCardSubmitConfirmPrice)
|
||||||
|
|
||||||
recycle.Use(auth.UserAccessAuth)
|
|
||||||
recycle.POST("cassette/list", controller.GameCassetteList)
|
recycle.POST("cassette/list", controller.GameCassetteList)
|
||||||
recycle.POST("check/goods", controller.GameCheckGoods)
|
recycle.POST("check/goods", controller.GameCheckGoods)
|
||||||
recycle.POST("cassette/evaluation", controller.GameEvaluation)
|
recycle.POST("cassette/evaluation", controller.GameEvaluation)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user