登录联调
This commit is contained in:
parent
c5eadb85b4
commit
91573d527d
|
@ -41,6 +41,8 @@ const (
|
|||
OrderRefundFail = 2003
|
||||
//邮储服务异常
|
||||
YouChuOrderRefundFail = 2004
|
||||
//用户不存在
|
||||
UserNotExist = 2005
|
||||
|
||||
// 更新失败
|
||||
InsertUserFail = 3001
|
||||
|
@ -75,6 +77,7 @@ var MsgZH = map[int]string{
|
|||
YouChuOrderRefundFail: "邮储服务异常",
|
||||
ProductStockFAIL: "库存不足",
|
||||
InsertUserFail: "用户新增失败",
|
||||
UserNotExist: "用户不存在",
|
||||
Fail: "请求失败",
|
||||
YouChuCodeFail: "Code解析失败",
|
||||
YouChuCustNoEmpty: "客户编号为空",
|
||||
|
|
|
@ -15,6 +15,7 @@ import (
|
|||
"net/http"
|
||||
"qteam/app/utils"
|
||||
"qteam/config"
|
||||
"strconv"
|
||||
|
||||
"qteam/app/constants/errorcode"
|
||||
|
||||
|
@ -179,8 +180,12 @@ func Frequence(key string) bool {
|
|||
func GetUserId(c *gin.Context) int {
|
||||
userIdStr, _ := c.Get("userId")
|
||||
if userIdStr != nil {
|
||||
var userId, _ = userIdStr.(int)
|
||||
return userId
|
||||
var userId, _ = userIdStr.(string)
|
||||
atoi, err := strconv.Atoi(userId)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return atoi
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
|
|
@ -19,6 +19,10 @@ import (
|
|||
func CreateOrder(c *gin.Context) {
|
||||
var request = controllers.GetRequest(c).(*front.OrderCreateRequest)
|
||||
userId := controllers.GetUserId(c)
|
||||
if userId == 0 {
|
||||
controllers.HandCodeRes(c, nil, errorcode.NotLogin)
|
||||
return
|
||||
}
|
||||
code, data := services.CreateOrderService(userId, request.ProductId)
|
||||
controllers.HandCodeRes(c, data, code)
|
||||
}
|
||||
|
@ -49,7 +53,7 @@ func OrderQuery(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
if has {
|
||||
if order.State < common.ORDER_STATUS_PAY && utils.IsNil(order.VoucherLink) {
|
||||
if order.State < common.ORDER_STATUS_PAY && order.VoucherLink == "" {
|
||||
_, rsp := services.YouChuOrderQuery(order)
|
||||
utils.Log(nil, "三方订单查询", rsp)
|
||||
if rsp.OrderSta == "03" {
|
||||
|
|
|
@ -47,14 +47,14 @@ func CreateOrderService(userId int, productId int) (code int, data front.InsertO
|
|||
return errorcode.SystemError, data
|
||||
}
|
||||
if !has {
|
||||
return errorcode.OrderProductNotExist, data
|
||||
return errorcode.UserNotExist, data
|
||||
}
|
||||
stock, _ := strconv.Atoi(product.Stock)
|
||||
if stock <= 0 {
|
||||
return errorcode.ProductStockFAIL, data
|
||||
}
|
||||
var user usersmodel.Users
|
||||
_, err = usersmodel.GetInstance().GetDb().Where("id =?", userId).Get(&user)
|
||||
has, err = usersmodel.GetInstance().GetDb().Where("id =?", userId).Get(&user)
|
||||
if err != nil {
|
||||
return errorcode.SystemError, data
|
||||
}
|
||||
|
|
|
@ -61,7 +61,7 @@ func (this *YouChuClient) OrderQuery(order ordersmodel.Orders) (code int, respon
|
|||
request := front.YouChuRequestBody{
|
||||
Body: front.YouChuOrderRequest{
|
||||
BusiMainId: BusiMainId,
|
||||
ReqTransTime: order.CreateTime.Format("2006-01-02 15:04:05"),
|
||||
ReqTransTime: order.CreateTime.Format("20060102150405"),
|
||||
Data: front.OrderQuery{
|
||||
TxnCode: "1004",
|
||||
SourceId: "16",
|
||||
|
@ -83,7 +83,7 @@ func (this *YouChuClient) OrderQuery(order ordersmodel.Orders) (code int, respon
|
|||
AppID: config.GetConf().YouChu.AppID,
|
||||
},
|
||||
}
|
||||
url := this.cfg.OrderHost + config.GetConf().YouChu.MerchantId + ".html?partnerTxSriNo=" + request.Body.BusiMainId
|
||||
url := this.cfg.OrderHost + config.GetConf().YouChu.MerchantId + ".htm?partnerTxSriNo=" + request.Body.BusiMainId
|
||||
requestData := EncryptRequest(request)
|
||||
bytes, err := json.Marshal(requestData)
|
||||
if err != nil {
|
||||
|
@ -131,7 +131,7 @@ func (this *YouChuClient) OrderRefund(order ordersmodel.Orders) (code int, respo
|
|||
},
|
||||
},
|
||||
}
|
||||
url := this.cfg.OrderHost + config.GetConf().YouChu.MerchantId + ".html?partnerTxSriNo=" + request.Body.BusiMainId
|
||||
url := this.cfg.OrderHost + config.GetConf().YouChu.MerchantId + ".htm?partnerTxSriNo=" + request.Body.BusiMainId
|
||||
requestData := EncryptRequest(request)
|
||||
bytes, err := json.Marshal(requestData)
|
||||
if err != nil {
|
||||
|
|
|
@ -1,63 +0,0 @@
|
|||
version: '2.2'
|
||||
networks:
|
||||
default:
|
||||
driver: bridge
|
||||
services:
|
||||
golang18:
|
||||
image: liusuifeng/php74:latest
|
||||
#build: ./php
|
||||
volumes:
|
||||
- ./project:/var/www
|
||||
networks:
|
||||
- default
|
||||
container_name: youchumilkapi
|
||||
working_dir: /var/www
|
||||
ports:
|
||||
- '443:443'
|
||||
|
||||
nginx:
|
||||
image: nginx:1.18
|
||||
volumes:
|
||||
- ./nginx/conf/:/etc/nginx/conf.d/
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
|
||||
- ./nginx/ssl/:/etc/nginx/ssl/
|
||||
- ./project:/var/www
|
||||
restart: always
|
||||
container_name: nginx
|
||||
tty: true
|
||||
ports:
|
||||
- '80:80'
|
||||
- '443:443'
|
||||
networks:
|
||||
- default
|
||||
|
||||
mysql:
|
||||
image: mysql:8.0.33
|
||||
container_name: mysql8
|
||||
environment:
|
||||
TZ: Aisa/Shanghai
|
||||
MYSQL_DATABASE: YouChuMilk
|
||||
MYSQL_USER: youchu_user
|
||||
MYSQL_PASSWORD: 'Lsxd@666'
|
||||
MYSQL_ROOT_PASSWORD: 'Lsxd@666'
|
||||
MYSQL_ROOT_HOST: '%'
|
||||
restart: always
|
||||
volumes:
|
||||
- ./mysql/data:/var/lib/mysql
|
||||
tty: true
|
||||
ports:
|
||||
- "3306:3306"
|
||||
networks:
|
||||
- default
|
||||
redis:
|
||||
image: redis:latest
|
||||
container_name: redis
|
||||
environment:
|
||||
REDIS_PASSWORD: 'Lsxd@666'
|
||||
ports:
|
||||
- '6379:6379'
|
||||
volumes:
|
||||
- ./redis/data:/data
|
||||
command: redis-server --requirepass 'Lsxd@666'
|
||||
networks:
|
||||
- default
|
Loading…
Reference in New Issue