You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
347 lines
9.1 KiB
347 lines
9.1 KiB
package influencer
|
|
|
|
import (
|
|
"pure/api/sys"
|
|
"pure/dto"
|
|
"pure/model"
|
|
"pure/model/request"
|
|
"pure/model/response"
|
|
"pure/service"
|
|
"pure/utils"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
// @Summary 钱包基本信息
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Success 200 {object} model.Wallet "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/detail [get]
|
|
func GetUserWalletDetail(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
data interface{}
|
|
)
|
|
userID = sys.GetUserUuid(c)
|
|
err, data = service.GetUserWalletDetail(userID)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData(data, c)
|
|
}
|
|
|
|
// @Summary 获取账户列表
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Success 200 {object} []model.Account "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/accountList [get]
|
|
func GetUserAccountList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
result []model.Account
|
|
)
|
|
userID = sys.GetUserUuid(c)
|
|
result, err = service.GetAccountList(userID)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData(result, c)
|
|
}
|
|
|
|
// @Summary 添加账户
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Param data body request.AddAccount false "data..."
|
|
// @Success 200 {string} string "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/account [post]
|
|
func AddUserAccount(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
params request.AddAccount
|
|
)
|
|
_ = c.ShouldBindJSON(¶ms)
|
|
userID = sys.GetUserUuid(c)
|
|
if err = service.AddAccount(userID, ¶ms); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithMessage("绑定成功", c)
|
|
}
|
|
|
|
// @Summary 设置账户默认开关
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Param data body request.IdReq false "data..."
|
|
// @Success 200 {string} string "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/account/default [put]
|
|
func UpdateAccountIsDefault(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.IdReq
|
|
)
|
|
_ = c.ShouldBindJSON(¶ms)
|
|
if err = utils.Verify(params, utils.IdVerify); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userId := sys.GetUserUuid(c)
|
|
err = service.UpdateAccountIsDefault(userId, ¶ms)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithMessage("设置成功", c)
|
|
}
|
|
|
|
// @Summary 解绑账户
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Param data body request.DeleteAccount false "data..."
|
|
// @Success 200 {string} string "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/account [delete]
|
|
func DeleteUserAccount(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
params request.DeleteAccount
|
|
)
|
|
_ = c.ShouldBindJSON(¶ms)
|
|
if err = utils.Verify(params, utils.IdVerify); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userID = sys.GetUserUuid(c)
|
|
err = service.DeleteAccount(userID, ¶ms)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithMessage("解绑成功", c)
|
|
}
|
|
|
|
func GetUserCommissionList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
list interface{}
|
|
total int64
|
|
data request.SearchCommission
|
|
)
|
|
c.ShouldBindQuery(&data)
|
|
userID = sys.GetUserUuid(c)
|
|
err, list, total = service.GetUserCommissionList(userID, &data)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDetailed(response.PageResult{
|
|
List: list,
|
|
Total: total,
|
|
Page: data.Page,
|
|
PageSize: data.PageSize,
|
|
}, "获取成功", c)
|
|
}
|
|
|
|
func GetUserWithdrawalList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
userID string
|
|
list interface{}
|
|
total int64
|
|
data request.SearchWithdrawal
|
|
)
|
|
c.ShouldBindQuery(&data)
|
|
userID = sys.GetUserUuid(c)
|
|
err, list, total = service.GetUserWithdrawalList(userID, &data)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDetailed(response.PageResult{
|
|
List: list,
|
|
Total: total,
|
|
Page: data.Page,
|
|
PageSize: data.PageSize,
|
|
}, "获取成功", c)
|
|
}
|
|
|
|
// @Summary 提现
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 网红端-用户钱包
|
|
// @Param data body request.WithdrawalParams false "data..."
|
|
// @Success 200 {object} model.WithdrawalView "{"code": 0, "data": [...]}"
|
|
// @Success 200 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/withdrawal [post]
|
|
func UserWithdrawal(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.WithdrawalParams
|
|
resp model.WithdrawalView
|
|
)
|
|
_ = c.ShouldBindJSON(¶ms)
|
|
if err = utils.Verify(params, utils.WithdrawalVerity); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userId := sys.GetUserUuid(c)
|
|
err, resp = service.Withdrawal(userId, ¶ms)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDataMessage(resp, "提现成功", c)
|
|
}
|
|
|
|
// @Summary 获取对账中心数据
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 对账中心
|
|
// @Param data query request.GetBillDataParams false "data..."
|
|
// @Success 200 {object} dto.BillData "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/bill/data [get]
|
|
func GetUserBillData(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.GetBillDataParams
|
|
result dto.BillData
|
|
)
|
|
_ = c.ShouldBindQuery(¶ms)
|
|
userId := sys.GetUserUuid(c)
|
|
result, err = service.GetBillData(userId, ¶ms)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDataMessage(result, "获取成功", c)
|
|
}
|
|
|
|
// @Summary 获取资金流水记录
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 对账中心
|
|
// @Param data query request.SearchBillParams false "data..."
|
|
// @Success 200 {object} []model.Bill "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/bill-list [get]
|
|
func GetBillList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.SearchBillParams
|
|
result []model.Bill
|
|
)
|
|
_ = c.ShouldBindQuery(¶ms)
|
|
if err = utils.Verify(params, utils.BillListVerity); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userId := sys.GetUserUuid(c)
|
|
if result, err = service.GetBillList(userId, ¶ms); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDetailed(response.PageResult{
|
|
List: result,
|
|
Page: params.Page,
|
|
PageSize: params.PageSize,
|
|
}, "获取成功", c)
|
|
}
|
|
|
|
// @Summary 获取账单通知列表
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 对账中心
|
|
// @Success 200 {object} []model.BillNotify "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/bill-notify [get]
|
|
func GetBillNotifyList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.SearchNotify
|
|
result []model.Notify
|
|
)
|
|
userId := sys.GetUserUuid(c)
|
|
params.Page = 1
|
|
params.PageSize = 5
|
|
params.RelationType = "1"
|
|
if result, _, err = service.GetNotifyList(userId, ¶ms); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDataMessage(result, "获取成功", c)
|
|
}
|
|
|
|
// @Summary 获取提现详情
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 对账中心
|
|
// @Param data query request.FlowNoParam false "data..."
|
|
// @Success 200 {object} model.Withdrawal "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/withdrawal [get]
|
|
func GetWithdrawal(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.FlowNoParam
|
|
result model.Withdrawal
|
|
)
|
|
_ = c.ShouldBindQuery(¶ms)
|
|
if err = utils.Verify(params, utils.FlowNoVerity); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userId := sys.GetUserUuid(c)
|
|
err, result = service.GetWithdrawal(userId, ¶ms)
|
|
if err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithData(result, c)
|
|
}
|
|
|
|
// @Summary 获取提现记录
|
|
// @Security Bearer
|
|
// @Description
|
|
// @Tags 对账中心
|
|
// @Param data query request.PageInfo false "data..."
|
|
// @Success 200 {object} []model.Withdrawal "{"code": 0, "data": [...]}"
|
|
// @Success 201 {string} string "{"code": 1, "message": ""}"
|
|
// @Router /influencer/wallet/withdrawal-list [get]
|
|
func GetWithdrawalList(c *gin.Context) {
|
|
var (
|
|
err error
|
|
params request.PageInfo
|
|
result []model.Withdrawal
|
|
)
|
|
_ = c.ShouldBindQuery(¶ms)
|
|
if err = utils.Verify(params, utils.PageInfoVerify); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
userId := sys.GetUserUuid(c)
|
|
if err, result = service.GetWithdrawalList(userId, ¶ms); err != nil {
|
|
response.FailWithMessage(err.Error(), c)
|
|
return
|
|
}
|
|
response.OkWithDetailed(response.PageResult{
|
|
List: result,
|
|
Page: params.Page,
|
|
PageSize: params.PageSize,
|
|
}, "获取成功", c)
|
|
}
|
|
|