mirror of
https://gitlab.52pay.top/go/easygoadmin.git
synced 2025-09-27 06:44:17 +08:00
108 lines
2.0 KiB
Go
108 lines
2.0 KiB
Go
/**
|
|
* 用户管理-控制器
|
|
* @author
|
|
* @since 2021/11/11
|
|
* @File : user
|
|
*/
|
|
package controller
|
|
|
|
/*
|
|
import (
|
|
"gitlab.52pay.top/go/easygoadmin/app/dto"
|
|
"gitlab.52pay.top/go/easygoadmin/app/service"
|
|
"gitlab.52pay.top/go/easygoadmin/utils"
|
|
"gitlab.52pay.top/go/easygoadmin/utils/common"
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
var Coutomer = new(customerCtl)
|
|
|
|
type customerCtl struct{}
|
|
|
|
// 搜索 根据手机号或订单号
|
|
func (c *customerCtl) Search(ctx *gin.Context) {
|
|
// 绑定参数
|
|
var req *dto.CustomerSearchReq
|
|
if err := ctx.ShouldBind(&req); err != nil {
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: -1,
|
|
Msg: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 调用查询列表方法
|
|
data := service.Customer.Search(req)
|
|
|
|
// 返回结果
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: 0,
|
|
Msg: "查询成功",
|
|
Data: data,
|
|
})
|
|
}
|
|
|
|
// 购买话费券订单退款
|
|
func (c *customerCtl) CouponRefund(ctx *gin.Context) {
|
|
// 绑定参数
|
|
var req *dto.CustomerCouponRefundReq
|
|
if err := ctx.ShouldBind(&req); err != nil {
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: -1,
|
|
Msg: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 调用查询列表方法
|
|
msg, ok := service.Customer.CouponRefund(req, utils.Uid(ctx))
|
|
|
|
if !ok {
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: -1,
|
|
Msg: msg,
|
|
})
|
|
return
|
|
}
|
|
|
|
// 返回结果
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: 0,
|
|
Msg: "退款成功",
|
|
})
|
|
}
|
|
|
|
// 购买话费券订单退款
|
|
func (c *customerCtl) RechargeRefund(ctx *gin.Context) {
|
|
// 绑定参数
|
|
var req *dto.CustomerCouponRefundReq
|
|
if err := ctx.ShouldBind(&req); err != nil {
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: -1,
|
|
Msg: err.Error(),
|
|
})
|
|
return
|
|
}
|
|
|
|
// 调用方法
|
|
msg, ok := service.Customer.RechargeRefund(req, utils.Uid(ctx))
|
|
|
|
if !ok {
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: -1,
|
|
Msg: msg,
|
|
})
|
|
return
|
|
}
|
|
|
|
// 返回结果
|
|
ctx.JSON(http.StatusOK, common.JsonResult{
|
|
Code: 0,
|
|
Msg: "退款成功",
|
|
})
|
|
}
|
|
|
|
|
|
*/
|