Compare commits
14 Commits
Author | SHA1 | Date | |
---|---|---|---|
f8f774ca1c | |||
b96590ab28 | |||
90d606835f | |||
6055ddc7fc | |||
db83bd9d8a | |||
d467e3b978 | |||
8a62ad0ee5 | |||
06a35591a8 | |||
092f8fba5d | |||
7d142fd887 | |||
1e7a7352fe | |||
1a83ce356a | |||
99a798923e | |||
2265cb5afb |
|
@ -230,11 +230,12 @@ func AuthLogin(c *gin.Context) {
|
||||||
inviteUser := model.GetUserByUid(req.InviteUid)
|
inviteUser := model.GetUserByUid(req.InviteUid)
|
||||||
effectiveStoreInfo, err := model.GetUserEffectiveStore(req.InviteUid)
|
effectiveStoreInfo, err := model.GetUserEffectiveStore(req.InviteUid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
RespJson(c, status.InviteUserFail, nil)
|
//RespJson(c, status.InviteUserFail, nil)
|
||||||
return
|
//return
|
||||||
|
logger.Error("login GetUserEffectiveStore err")
|
||||||
}
|
}
|
||||||
|
|
||||||
if user.StoreId == 0 { // 用户所属门店id为空则更新
|
if user.StoreId == 0 && effectiveStoreInfo.StoreID != 0 { // 用户所属门店id为空则更新
|
||||||
_, err = model.NewUserQuerySet(model.DB).UidEq(user.Uid).GetUpdater().SetStoreId(effectiveStoreInfo.StoreID).
|
_, err = model.NewUserQuerySet(model.DB).UidEq(user.Uid).GetUpdater().SetStoreId(effectiveStoreInfo.StoreID).
|
||||||
UpdateNum()
|
UpdateNum()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -253,8 +254,8 @@ func AuthLogin(c *gin.Context) {
|
||||||
user.Uid, req.InviteUid))
|
user.Uid, req.InviteUid))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("query err:", err)
|
logger.Error("query err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
//RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
//return
|
||||||
}
|
}
|
||||||
if !exist { // 未邀请过,则添加邀请记录:首次邀请记录
|
if !exist { // 未邀请过,则添加邀请记录:首次邀请记录
|
||||||
firstInviteRecord := &model.UserInviteRecord{
|
firstInviteRecord := &model.UserInviteRecord{
|
||||||
|
@ -332,9 +333,9 @@ func AuthLogin(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := invite.Create(model.DB); err != nil {
|
if err := invite.Create(model.DB); err != nil {
|
||||||
logger.Error(err)
|
logger.Error("create UserInvite err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
//RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
//return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//// 已经邀请过,则更新扫码记录
|
//// 已经邀请过,则更新扫码记录
|
||||||
|
@ -532,6 +533,25 @@ func UserData(c *gin.Context) {
|
||||||
}
|
}
|
||||||
m.StoreList = sysUser.StoreList
|
m.StoreList = sysUser.StoreList
|
||||||
m.RoleId = uint32(sysUser.RoleId)
|
m.RoleId = uint32(sysUser.RoleId)
|
||||||
|
|
||||||
|
if m.RoleId != 0 {
|
||||||
|
var roleInfo model.SysRole
|
||||||
|
err = model.NewSysRoleQuerySet(model.DB).IDEq(m.RoleId).Find(&roleInfo)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err)
|
||||||
|
}
|
||||||
|
m.RoleKey = roleInfo.RoleKey
|
||||||
|
m.RoleName = roleInfo.RoleName
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询最近一条邀请记录
|
||||||
|
var inviteRecord model.UserInviteRecord
|
||||||
|
err = model.NewUserInviteRecordQuerySet(model.DB).ToUidEq(uc.Uid).OrderDescByCreatedAt().OrderDescByID().Limit(1).Find(&inviteRecord)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err)
|
||||||
|
}
|
||||||
|
m.LatestInviteRecord = inviteRecord
|
||||||
|
|
||||||
ret := m
|
ret := m
|
||||||
RespOK(c, ret)
|
RespOK(c, ret)
|
||||||
return
|
return
|
||||||
|
@ -798,7 +818,7 @@ func UserCodeToCoupon(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var inviteUid, inviteStoreId, userMemberLevel uint32
|
var inviteUid, inviteStoreId, userMemberLevel uint32
|
||||||
if len(req.Code) == 6 {
|
if len(req.Code) == 6 { // 续费优惠券
|
||||||
user := model.GetUserByUid(uc.Uid)
|
user := model.GetUserByUid(uc.Uid)
|
||||||
if user == nil {
|
if user == nil {
|
||||||
logger.Error("user is nil")
|
logger.Error("user is nil")
|
||||||
|
@ -806,25 +826,25 @@ func UserCodeToCoupon(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if !user.IsMember() { // 判断用户是否为会员
|
//if !user.IsMember() { // 判断用户是否为会员
|
||||||
logger.Error("user is not member")
|
|
||||||
RespJson(c, status.UserNotMember, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
userMemberLevel = user.MemberLevel
|
|
||||||
|
|
||||||
//if user.OpenMemberTime.IsZero() {
|
|
||||||
// logger.Error("user is not member")
|
// logger.Error("user is not member")
|
||||||
// RespJson(c, status.UserNotMember, nil)
|
// RespJson(c, status.UserNotMember, nil)
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
userMemberLevel = user.MemberLevel
|
||||||
|
|
||||||
|
if user.OpenMemberTime.IsZero() { // 判断用户是否曾经开过会员
|
||||||
|
logger.Error("user is not member")
|
||||||
|
RespJson(c, status.UserNotMember, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var shopperPromotionCode model.ShopperPromotionCode
|
var shopperPromotionCode model.ShopperPromotionCode
|
||||||
err := model.NewShopperPromotionCodeQuerySet(model.DB).CodeEq(req.Code).One(&shopperPromotionCode)
|
err := model.NewShopperPromotionCodeQuerySet(model.DB).CodeEq(req.Code).One(&shopperPromotionCode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("shopper promotion code err:", err)
|
logger.Error("shopper promotion code err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.NotAvailableCode, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
inviteUid = shopperPromotionCode.Uid
|
inviteUid = shopperPromotionCode.Uid
|
||||||
|
@ -1000,6 +1020,79 @@ func UserCodeToCoupon(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RespOK(c, nil)
|
||||||
|
return
|
||||||
|
} else if len(req.Code) == 8 { // 开通优惠券(新店开业可用)
|
||||||
|
user := model.GetUserByUid(uc.Uid)
|
||||||
|
if user == nil {
|
||||||
|
logger.Error("user is nil")
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
userMemberLevel = user.MemberLevel
|
||||||
|
if !user.OpenMemberTime.IsZero() || !user.MemberExpire.IsZero() || user.IsMember() { // 判断用户是否为新用户
|
||||||
|
logger.Error("user is not new user")
|
||||||
|
RespJson(c, status.NotNewUser, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var shopperPromotionCode model.ShopperPromotionCode
|
||||||
|
err := model.NewShopperPromotionCodeQuerySet(model.DB).CodeEq(req.Code).One(&shopperPromotionCode)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("shopper promotion code err:", err)
|
||||||
|
RespJson(c, status.NotAvailableCode, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Error("shopper promotion code store is:", shopperPromotionCode.StoreId)
|
||||||
|
logger.Error("user store is:", user.StoreId)
|
||||||
|
|
||||||
|
exist, err := model.QueryRecordExist(fmt.Sprintf(
|
||||||
|
"SELECT * FROM user_coupon WHERE uid=%d AND approach=1 AND activity_id=4 AND state=1", uc.Uid))
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("exist err:", err)
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if exist {
|
||||||
|
logger.Error("coupon received err:", err)
|
||||||
|
RespJson(c, status.CouponReceived, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var coupons []model.Coupon
|
||||||
|
err = model.NewCouponQuerySet(model.DB).ActivityIdEq(4).All(&coupons)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("coupons err:", err)
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for i, _ := range coupons {
|
||||||
|
userCoupon := &model.UserCoupon{
|
||||||
|
Uid: uc.Uid,
|
||||||
|
CouponId: coupons[i].ID,
|
||||||
|
CouponType: coupons[i].CouponType,
|
||||||
|
ActivityType: coupons[i].ActivityType,
|
||||||
|
ActivityId: coupons[i].ActivityId,
|
||||||
|
Value: coupons[i].Value,
|
||||||
|
State: 1,
|
||||||
|
ActiveStart: time.Now(),
|
||||||
|
ActiveEnd: time.Now().AddDate(0, 0, 7),
|
||||||
|
UseTime: time.Time{},
|
||||||
|
MemberLevel: coupons[i].MemberLevel,
|
||||||
|
Approach: 1,
|
||||||
|
PromotionalSales: 0,
|
||||||
|
RedeemCode: shopperPromotionCode.Code,
|
||||||
|
}
|
||||||
|
|
||||||
|
err = model.DB.Create(userCoupon).Error
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("user coupon err:", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RespOK(c, nil)
|
RespOK(c, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -1007,12 +1100,12 @@ func UserCodeToCoupon(c *gin.Context) {
|
||||||
err := model.NewRedeemCodeQuerySet(model.DB).SerialCodeEq(req.Code).One(&redeemCode)
|
err := model.NewRedeemCodeQuerySet(model.DB).SerialCodeEq(req.Code).One(&redeemCode)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("redeem code err:", err)
|
logger.Error("redeem code err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.NotAvailableCode, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.Code != "DC5709BC7375B9F5FA89D0" && redeemCode.Status != model.RedeemCodeStatusHold {
|
if req.Code != "DC5709BC7375B9F5FA89D0" && redeemCode.Status != model.RedeemCodeStatusHold {
|
||||||
logger.Error("redeem code status err")
|
logger.Error("redeem code status err")
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.NotAvailableCode, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -594,12 +594,28 @@ func MemberRenewalUserCouponList(c *gin.Context) {
|
||||||
|
|
||||||
list := make([]model.UserCoupon, 0, len(coupons))
|
list := make([]model.UserCoupon, 0, len(coupons))
|
||||||
for i, _ := range coupons {
|
for i, _ := range coupons {
|
||||||
if !user.IsMember() && coupons[i].ActivityType == 1 {
|
if user.OpenMemberTime.IsZero() && coupons[i].ActivityType == 1 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if user.MemberGenre == 201 || user.MemberGenre == 202 {
|
if user.MemberGenre == 201 || user.MemberGenre == 202 {
|
||||||
coupons[i].Availability = 1
|
coupons[i].Availability = 1
|
||||||
}
|
}
|
||||||
|
var shopperPromotionCode model.ShopperPromotionCode
|
||||||
|
err = model.NewShopperPromotionCodeQuerySet(model.DB).CodeEq(coupons[i].RedeemCode).One(&shopperPromotionCode)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err)
|
||||||
|
}
|
||||||
|
coupons[i].StoreId = shopperPromotionCode.StoreId
|
||||||
|
|
||||||
|
var couponInfo model.Coupon
|
||||||
|
err = model.NewCouponQuerySet(model.DB).IDEq(coupons[i].CouponId).One(&couponInfo)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("coupons err:", err)
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
coupons[i].Coupon = &couponInfo
|
||||||
|
|
||||||
list = append(list, coupons[i])
|
list = append(list, coupons[i])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -449,6 +449,10 @@ func CooperativeGameCardGoodsList(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
ShopManagerKey = "store-manager"
|
||||||
|
)
|
||||||
|
|
||||||
func AssistantMemberPromotionList(c *gin.Context) {
|
func AssistantMemberPromotionList(c *gin.Context) {
|
||||||
req := model.AssistantMemberPromotionReq{}
|
req := model.AssistantMemberPromotionReq{}
|
||||||
if c.ShouldBindJSON(&req) != nil {
|
if c.ShouldBindJSON(&req) != nil {
|
||||||
|
@ -466,17 +470,34 @@ func AssistantMemberPromotionList(c *gin.Context) {
|
||||||
req.AssistantUid = uc.Uid
|
req.AssistantUid = uc.Uid
|
||||||
|
|
||||||
req.Assistant = model.GetUserByUid(uc.Uid)
|
req.Assistant = model.GetUserByUid(uc.Uid)
|
||||||
if req.Assistant.XcxRoleId != 2 {
|
|
||||||
logger.Error("xcx role err:")
|
|
||||||
RespJson(c, status.NoAuth, nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if req.Assistant.UserType != 2 {
|
if req.Assistant.UserType != 2 {
|
||||||
logger.Error("not assistant")
|
logger.Error("not assistant")
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
list, totalPage, err := req.List()
|
|
||||||
|
var sysUser model.SysUser
|
||||||
|
if err := model.NewSysUserQuerySet(model.DB).UidEq(uc.Uid).One(&sysUser); err != nil && err != model.RecordNotFound {
|
||||||
|
logger.Error(err)
|
||||||
|
RespJson(c, status.Unauthorized, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
req.Assistant.RoleId = uint32(sysUser.RoleId)
|
||||||
|
if req.Assistant.RoleId != 0 {
|
||||||
|
var roleInfo model.SysRole
|
||||||
|
err := model.NewSysRoleQuerySet(model.DB).IDEq(req.Assistant.RoleId).Find(&roleInfo)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err)
|
||||||
|
}
|
||||||
|
req.Assistant.RoleKey = roleInfo.RoleKey
|
||||||
|
}
|
||||||
|
if req.Assistant.RoleKey != ShopManagerKey {
|
||||||
|
logger.Error("xcx role err:", req.Assistant.RoleKey)
|
||||||
|
RespJson(c, status.NoAuth, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
list, totalPage, count, err := req.List()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("list err:", err)
|
logger.Error("list err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
@ -487,6 +508,7 @@ func AssistantMemberPromotionList(c *gin.Context) {
|
||||||
"list": list,
|
"list": list,
|
||||||
"total_page": totalPage,
|
"total_page": totalPage,
|
||||||
"page_num": req.PageNum,
|
"page_num": req.PageNum,
|
||||||
|
"count": count,
|
||||||
}
|
}
|
||||||
RespOK(c, ret)
|
RespOK(c, ret)
|
||||||
return
|
return
|
||||||
|
|
|
@ -80,8 +80,20 @@ func GameCardInfo(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
uc := auth.GetCurrentUser(c)
|
uc := auth.GetCurrentUser(c)
|
||||||
if uc == nil {
|
if uc == nil { // 如果没有登录,则只查看详情
|
||||||
RespJson(c, status.Unauthorized, nil)
|
//RespJson(c, status.Unauthorized, nil)
|
||||||
|
//return
|
||||||
|
info, err := model.GetGameCardInfo(req.GameId, req.StoreId)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("err:", err)
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
ret := map[string]interface{}{
|
||||||
|
"card_info": info,
|
||||||
|
"is_collection": false,
|
||||||
|
}
|
||||||
|
RespOK(c, ret)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,8 +139,8 @@ func GameCardSearch(c *gin.Context) {
|
||||||
}
|
}
|
||||||
uc := auth.GetCurrentUser(c)
|
uc := auth.GetCurrentUser(c)
|
||||||
if uc == nil {
|
if uc == nil {
|
||||||
RespJson(c, status.Unauthorized, nil)
|
//RespJson(c, status.Unauthorized, nil)
|
||||||
return
|
//return
|
||||||
}
|
}
|
||||||
|
|
||||||
cardList, totalPage, err := model.GetGameCardSearch(req.Name, req.Page, req.PageSize, req.StoreId)
|
cardList, totalPage, err := model.GetGameCardSearch(req.Name, req.Page, req.PageSize, req.StoreId)
|
||||||
|
@ -137,12 +149,16 @@ func GameCardSearch(c *gin.Context) {
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
err = model.SearchHistoryAdd(uc.Uid, req.Name)
|
|
||||||
if err != nil {
|
if uc != nil { // 登录过的用户才记录搜索历史
|
||||||
logger.Error("err:", err)
|
err = model.SearchHistoryAdd(uc.Uid, req.Name)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
if err != nil {
|
||||||
return
|
logger.Error("err:", err)
|
||||||
|
RespJson(c, status.InternalServerError, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret := map[string]interface{}{
|
ret := map[string]interface{}{
|
||||||
"card_list": cardList,
|
"card_list": cardList,
|
||||||
"cur_page": req.Page,
|
"cur_page": req.Page,
|
||||||
|
@ -154,7 +170,8 @@ func GameCardSearch(c *gin.Context) {
|
||||||
func GameCardSearchHistory(c *gin.Context) {
|
func GameCardSearchHistory(c *gin.Context) {
|
||||||
uc := auth.GetCurrentUser(c)
|
uc := auth.GetCurrentUser(c)
|
||||||
if uc == nil {
|
if uc == nil {
|
||||||
RespJson(c, status.Unauthorized, nil)
|
//RespJson(c, status.Unauthorized, nil)
|
||||||
|
RespOK(c, []model.SearchHistory{})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
historyList, err := model.GetSearchHistoryList(uc.Uid)
|
historyList, err := model.GetSearchHistoryList(uc.Uid)
|
||||||
|
@ -454,6 +471,10 @@ func PushWXPayNotice(c *gin.Context) {
|
||||||
fundRecord.Uid = uint32(record.Uid)
|
fundRecord.Uid = uint32(record.Uid)
|
||||||
fundRecord.FundType = model.FundTypeMemberFee
|
fundRecord.FundType = model.FundTypeMemberFee
|
||||||
fundRecord.Remark = remark
|
fundRecord.Remark = remark
|
||||||
|
// 支付金额小于100(99或者49)的情况是:白金会员过期后没退押金,然后直接开通黄金会员
|
||||||
|
if notifyInfo.TotalFee < 10000 {
|
||||||
|
fundRecord.FundType = model.FundTypeDowngradeRenewal
|
||||||
|
}
|
||||||
memberRecord := &model.UserMemberRecord{
|
memberRecord := &model.UserMemberRecord{
|
||||||
Uid: record.Uid,
|
Uid: record.Uid,
|
||||||
AfterMemberLevel: record.MemberLevel,
|
AfterMemberLevel: record.MemberLevel,
|
||||||
|
@ -568,7 +589,9 @@ func PushWXPayNotice(c *gin.Context) {
|
||||||
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
||||||
if isShopAssistantCode {
|
if isShopAssistantCode {
|
||||||
qs = qs.SetInviteForm(1)
|
qs = qs.SetInviteForm(1)
|
||||||
invite.RenewHide = 0
|
invite.RenewHide = 0 // 干预
|
||||||
|
} else {
|
||||||
|
invite.RenewHide = 1 // 自动
|
||||||
}
|
}
|
||||||
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
||||||
_, err = qs.SetMemberType(2).SetMemberStatus(2).
|
_, err = qs.SetMemberType(2).SetMemberStatus(2).
|
||||||
|
@ -953,7 +976,9 @@ func PushWXPayNotice(c *gin.Context) {
|
||||||
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
||||||
if isShopAssistantCode {
|
if isShopAssistantCode {
|
||||||
qs = qs.SetInviteForm(1)
|
qs = qs.SetInviteForm(1)
|
||||||
invite.RenewHide = 0
|
invite.RenewHide = 0 // 干预
|
||||||
|
} else {
|
||||||
|
invite.RenewHide = 1 // 自动
|
||||||
}
|
}
|
||||||
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
||||||
_, err = qs.SetMemberType(record.MemberLevel).SetMemberStatus(2).
|
_, err = qs.SetMemberType(record.MemberLevel).SetMemberStatus(2).
|
||||||
|
@ -1023,6 +1048,7 @@ func PushWXPayNotice(c *gin.Context) {
|
||||||
}
|
}
|
||||||
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
||||||
inviteRecordNew := &model.UserInviteRecord{
|
inviteRecordNew := &model.UserInviteRecord{
|
||||||
|
ToUid: user.Uid,
|
||||||
Action: 2,
|
Action: 2,
|
||||||
SpendType: 4,
|
SpendType: 4,
|
||||||
MemberLevel: record.MemberLevel,
|
MemberLevel: record.MemberLevel,
|
||||||
|
@ -1478,6 +1504,10 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
fundRecord.Uid = uint32(record.Uid)
|
fundRecord.Uid = uint32(record.Uid)
|
||||||
fundRecord.FundType = model.FundTypeMemberFee
|
fundRecord.FundType = model.FundTypeMemberFee
|
||||||
fundRecord.Remark = remark
|
fundRecord.Remark = remark
|
||||||
|
// 支付金额小于100(99或者49)的情况是:白金会员过期后没退押金,然后直接开通黄金会员
|
||||||
|
if fundRecord.Amount < 10000 {
|
||||||
|
fundRecord.FundType = model.FundTypeDowngradeRenewal
|
||||||
|
}
|
||||||
memberRecord := &model.UserMemberRecord{
|
memberRecord := &model.UserMemberRecord{
|
||||||
Uid: record.Uid,
|
Uid: record.Uid,
|
||||||
AfterMemberLevel: record.MemberLevel,
|
AfterMemberLevel: record.MemberLevel,
|
||||||
|
@ -1491,7 +1521,8 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
spendType = uint32(2) // 2-开通会员
|
spendType = uint32(2) // 2-开通会员
|
||||||
if !user.OpenMemberTime.IsZero() && user.MemberExpire.After(time.Now()) {
|
//if !user.OpenMemberTime.IsZero() && user.MemberExpire.After(time.Now()) {
|
||||||
|
if !user.OpenMemberTime.IsZero() {
|
||||||
spendType = 3 // 3-续费
|
spendType = 3 // 3-续费
|
||||||
}
|
}
|
||||||
isShopAssistantCode := false
|
isShopAssistantCode := false
|
||||||
|
@ -1588,7 +1619,9 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
|
|
||||||
if isShopAssistantCode {
|
if isShopAssistantCode {
|
||||||
qs = qs.SetInviteForm(1)
|
qs = qs.SetInviteForm(1)
|
||||||
invite.RenewHide = 0
|
invite.RenewHide = 0 // 干预
|
||||||
|
} else {
|
||||||
|
invite.RenewHide = 1 // 自动
|
||||||
}
|
}
|
||||||
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
||||||
_, err = qs.SetMemberType(2).SetMemberStatus(2).
|
_, err = qs.SetMemberType(2).SetMemberStatus(2).
|
||||||
|
@ -1713,6 +1746,7 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
}
|
}
|
||||||
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
||||||
inviteRecordNew := &model.UserInviteRecord{
|
inviteRecordNew := &model.UserInviteRecord{
|
||||||
|
ToUid: user.Uid,
|
||||||
Action: 2,
|
Action: 2,
|
||||||
SpendType: spendType,
|
SpendType: spendType,
|
||||||
MemberLevel: record.MemberLevel,
|
MemberLevel: record.MemberLevel,
|
||||||
|
@ -1980,7 +2014,9 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
qs := model.NewUserInviteQuerySet(model.DB).IDEq(invite.ID).GetUpdater()
|
||||||
if isShopAssistantCode {
|
if isShopAssistantCode {
|
||||||
qs = qs.SetInviteForm(1)
|
qs = qs.SetInviteForm(1)
|
||||||
invite.RenewHide = 0
|
invite.RenewHide = 0 // 干预
|
||||||
|
} else {
|
||||||
|
invite.RenewHide = 1 // 自动
|
||||||
}
|
}
|
||||||
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
qs = qs.SetMemberOpenTime(newTime).SetMemberLevel(record.MemberLevel)
|
||||||
_, err = qs.SetMemberType(record.MemberLevel).SetMemberStatus(2).
|
_, err = qs.SetMemberType(record.MemberLevel).SetMemberStatus(2).
|
||||||
|
@ -2050,6 +2086,7 @@ func HmPushWXPayNotice(c *gin.Context) {
|
||||||
}
|
}
|
||||||
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
} else if err == model.RecordNotFound { // 没有邀请记录,完全是用户自己开通会员,自己续费;按产品要求也需要有记录
|
||||||
inviteRecordNew := &model.UserInviteRecord{
|
inviteRecordNew := &model.UserInviteRecord{
|
||||||
|
ToUid: user.Uid,
|
||||||
Action: 2,
|
Action: 2,
|
||||||
SpendType: 4,
|
SpendType: 4,
|
||||||
MemberLevel: record.MemberLevel,
|
MemberLevel: record.MemberLevel,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/codinl/go-logger"
|
"github.com/codinl/go-logger"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/jinzhu/gorm"
|
||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"mh-server/kuaidi"
|
"mh-server/kuaidi"
|
||||||
|
@ -241,19 +242,40 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
cardCount += v.Count
|
cardCount += v.Count
|
||||||
}
|
}
|
||||||
|
|
||||||
rentCard := model.GetUserRentCard(uc.Uid)
|
var rentCard *model.UserRentCard
|
||||||
if rentCard == nil {
|
var tx *gorm.DB
|
||||||
//logger.Error(errors.New("GetUserByUid err"))
|
if req.Price == 0 {
|
||||||
//RespJson(c, status.InternalServerError, nil)
|
fmt.Println("*********** req.Price == 0 ***********")
|
||||||
//return
|
tx = model.TransactionBegin()
|
||||||
rentCard = &model.UserRentCard{LevelRentCount: memberConfig.CardMax, CanRentCount: memberConfig.CardMax}
|
rentCard = model.GetUserRentCard(tx, uc.Uid)
|
||||||
|
fmt.Println("*********** rentCard is:", rentCard)
|
||||||
|
if rentCard == nil {
|
||||||
|
//logger.Error(errors.New("GetUserByUid err"))
|
||||||
|
//RespJson(c, status.InternalServerError, nil)
|
||||||
|
//return
|
||||||
|
rentCard = &model.UserRentCard{LevelRentCount: memberConfig.CardMax, CanRentCount: memberConfig.CardMax}
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
fmt.Println("*********** req.Price != 0 ***********")
|
||||||
|
rentCard = model.GetUserRentCard(nil, uc.Uid)
|
||||||
|
fmt.Println("*********** rentCard is:", rentCard)
|
||||||
|
if rentCard == nil {
|
||||||
|
//logger.Error(errors.New("GetUserByUid err"))
|
||||||
|
//RespJson(c, status.InternalServerError, nil)
|
||||||
|
//return
|
||||||
|
rentCard = &model.UserRentCard{LevelRentCount: memberConfig.CardMax, CanRentCount: memberConfig.CardMax}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//if uc.Uid == 45935373 {
|
//if uc.Uid == 45935373 {
|
||||||
// rentCard.CanRentCount -= 1
|
// rentCard.CanRentCount -= 1
|
||||||
//}
|
//}
|
||||||
if cardCount > rentCard.CanRentCount {
|
if cardCount > rentCard.CanRentCount {
|
||||||
logger.Error("GetMemberConfig err:", err)
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
|
logger.Error("err:", "会员超过可借卡数")
|
||||||
RespJson(c, status.OrderOutRentCount, nil)
|
RespJson(c, status.OrderOutRentCount, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -267,11 +289,17 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
isRentCount, err := rentCard.IsHaveUnreturnedOrders(cardCount)
|
isRentCount, err := rentCard.IsHaveUnreturnedOrders(cardCount)
|
||||||
//unreturnedOrders, err := model.IsHaveUnreturnedOrders(uc.Uid) //
|
//unreturnedOrders, err := model.IsHaveUnreturnedOrders(uc.Uid) //
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("err:", err)
|
logger.Error("err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if isRentCount {
|
if isRentCount {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("unreturnedOrders")
|
logger.Error("unreturnedOrders")
|
||||||
RespJson(c, status.HaveUnreturnedOrders, nil)
|
RespJson(c, status.HaveUnreturnedOrders, nil)
|
||||||
return
|
return
|
||||||
|
@ -279,11 +307,17 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
|
|
||||||
online, err := model.IsGameCardListOnline(req.GameCardList)
|
online, err := model.IsGameCardListOnline(req.GameCardList)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("err:", err)
|
logger.Error("err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if !online {
|
if !online {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("unreturnedOrders")
|
logger.Error("unreturnedOrders")
|
||||||
RespJson(c, status.GoodsSoldOut, nil)
|
RespJson(c, status.GoodsSoldOut, nil)
|
||||||
return
|
return
|
||||||
|
@ -292,6 +326,9 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
store.ID = req.StoreId
|
store.ID = req.StoreId
|
||||||
err = store.Info()
|
err = store.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("store err:", err)
|
logger.Error("store err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
|
@ -323,6 +360,9 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
// OrderAscByID().Limit(1).One(&userCoupon)
|
// OrderAscByID().Limit(1).One(&userCoupon)
|
||||||
err = model.NewUserCouponQuerySet(model.DB).IDEq(req.UserCouponId).One(&userCoupon)
|
err = model.NewUserCouponQuerySet(model.DB).IDEq(req.UserCouponId).One(&userCoupon)
|
||||||
if err != nil && err != model.RecordNotFound {
|
if err != nil && err != model.RecordNotFound {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("user coupon err:", err)
|
logger.Error("user coupon err:", err)
|
||||||
RespJson(c, status.InternalServerError, nil)
|
RespJson(c, status.InternalServerError, nil)
|
||||||
return
|
return
|
||||||
|
@ -348,11 +388,17 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
//}
|
//}
|
||||||
stockEnough, err := model.IsCardGoodsStockEnough(req.GameCardList, req.StoreId)
|
stockEnough, err := model.IsCardGoodsStockEnough(req.GameCardList, req.StoreId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("err:", err)
|
logger.Error("err:", err)
|
||||||
RespJson(c, status.OrderStockOut, nil)
|
RespJson(c, status.OrderStockOut, nil)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if stockEnough {
|
if stockEnough {
|
||||||
|
if req.Price == 0 {
|
||||||
|
tx.Rollback()
|
||||||
|
}
|
||||||
logger.Error("order stock out ")
|
logger.Error("order stock out ")
|
||||||
RespJson(c, status.OrderStockOut, nil)
|
RespJson(c, status.OrderStockOut, nil)
|
||||||
return
|
return
|
||||||
|
@ -376,7 +422,9 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
|
|
||||||
//fmt.Println("PayPrice:", order.PayPrice)
|
//fmt.Println("PayPrice:", order.PayPrice)
|
||||||
if req.Price == 0 {
|
if req.Price == 0 {
|
||||||
tx := model.TransactionBegin()
|
if tx == nil {
|
||||||
|
tx = model.TransactionBegin()
|
||||||
|
}
|
||||||
order.PayStatus = model.PayStatusPaid
|
order.PayStatus = model.PayStatusPaid
|
||||||
fmt.Println("orderId:", order.PayStatus)
|
fmt.Println("orderId:", order.PayStatus)
|
||||||
err = order.OrderCreate(tx)
|
err = order.OrderCreate(tx)
|
||||||
|
@ -396,7 +444,7 @@ func RentCardOrderCreate(c *gin.Context) {
|
||||||
// RespJson(c, status.InternalServerError, nil)
|
// RespJson(c, status.InternalServerError, nil)
|
||||||
// return
|
// return
|
||||||
//}
|
//}
|
||||||
err := model.GameCardGoodsInventoryReduction(req.GameCardList, req.StoreId, tx)
|
err = model.GameCardGoodsInventoryReduction(req.GameCardList, req.StoreId, tx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tx.Rollback()
|
tx.Rollback()
|
||||||
logger.Error("inventory reduction err:", err.Error())
|
logger.Error("inventory reduction err:", err.Error())
|
||||||
|
|
|
@ -269,8 +269,8 @@ func OpenMember(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 用户已开通会员且优惠券可用
|
// 使用续费优惠券:用户已开通会员(开通会员时间不为空)、优惠券可用
|
||||||
if user.IsMember() && coupon.Uid == uc.Uid && coupon.MemberLevel == req.MemberLevel &&
|
if !user.OpenMemberTime.IsZero() && coupon.Uid == uc.Uid && coupon.MemberLevel == req.MemberLevel &&
|
||||||
coupon.ActivityId == 1 && coupon.State == 1 {
|
coupon.ActivityId == 1 && coupon.State == 1 {
|
||||||
totalFee -= coupon.Value
|
totalFee -= coupon.Value
|
||||||
|
|
||||||
|
@ -296,6 +296,32 @@ func OpenMember(c *gin.Context) {
|
||||||
_ = userLog.Add()
|
_ = userLog.Add()
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
} else if user.OpenMemberTime.IsZero() && coupon.Uid == uc.Uid && coupon.MemberLevel == req.MemberLevel &&
|
||||||
|
coupon.ActivityId == 4 && coupon.State == 1 { // 使用开通优惠券:用户未开通过会员(开通会员时间为空),优惠券可用
|
||||||
|
// 判断最近一条邀请记录,邀请人的门店id跟优惠券id相同才能使用
|
||||||
|
var inviteRecord model.UserInviteRecord
|
||||||
|
err = model.NewUserInviteRecordQuerySet(model.DB).ToUidEq(user.Uid).OrderDescByCreatedAt().OrderDescByID().Limit(1).Find(&inviteRecord)
|
||||||
|
if err != nil || inviteRecord.ID == 0 {
|
||||||
|
RespJson(c, status.NotShopperCodeStoreUser, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
var shopperPromotionCode model.ShopperPromotionCode
|
||||||
|
err := model.NewShopperPromotionCodeQuerySet(model.DB).CodeEq(coupon.RedeemCode).One(&shopperPromotionCode)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("shopper promotion code err:", err)
|
||||||
|
RespJson(c, status.NotShopperCodeStoreUser, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if shopperPromotionCode.StoreId != uint32(inviteRecord.StoreId) {
|
||||||
|
logger.Error("shopper promotion code err:", err)
|
||||||
|
RespJson(c, status.NotShopperCodeStoreUser, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.Infof("使用开通优惠券,coupon_id is:", coupon.CouponId)
|
||||||
|
totalFee -= coupon.Value
|
||||||
} else if coupon.State == 1 && coupon.ActivityType == 2 { // 关注公众号领取的优惠券
|
} else if coupon.State == 1 && coupon.ActivityType == 2 { // 关注公众号领取的优惠券
|
||||||
totalFee -= coupon.Value
|
totalFee -= coupon.Value
|
||||||
} else { // 不符合优惠条件
|
} else { // 不符合优惠条件
|
||||||
|
|
|
@ -112,6 +112,9 @@ const (
|
||||||
DepositRestraint = 500527 // 押金受限
|
DepositRestraint = 500527 // 押金受限
|
||||||
ShortMemberNotUpgradeMember = 500530 // 短期会员暂不升级
|
ShortMemberNotUpgradeMember = 500530 // 短期会员暂不升级
|
||||||
ThePhoneHasBeenRegistered = 500531 // 该手机号已经注册账号
|
ThePhoneHasBeenRegistered = 500531 // 该手机号已经注册账号
|
||||||
|
NotNewUser = 500532 // 您不是新用户,请领取续费优惠券
|
||||||
|
NotShopperCodeStoreUser = 500533 // 您不是推广门店用户,请扫店员推广码后再使用优惠券
|
||||||
|
NotAvailableCode = 500534 // 兑换码错误
|
||||||
|
|
||||||
ToastErr = 600 // 报错
|
ToastErr = 600 // 报错
|
||||||
)
|
)
|
||||||
|
@ -274,6 +277,10 @@ var statusMsg = map[int]string{
|
||||||
RedirectBindPhonePage: "需要绑定手机号",
|
RedirectBindPhonePage: "需要绑定手机号",
|
||||||
|
|
||||||
ThePhoneHasBeenRegistered: "该手机号已经注册账号",
|
ThePhoneHasBeenRegistered: "该手机号已经注册账号",
|
||||||
|
|
||||||
|
NotNewUser: "您不是新用户,请领取续费优惠券",
|
||||||
|
NotShopperCodeStoreUser: "您不是推广门店用户,请扫店员推广码后再使用优惠券",
|
||||||
|
NotAvailableCode: "兑换码错误",
|
||||||
}
|
}
|
||||||
|
|
||||||
func StatusDesc(code int) string {
|
func StatusDesc(code int) string {
|
||||||
|
|
|
@ -1475,6 +1475,10 @@ func (qs UserInviteRecordQuerySet) Offset(offset int) UserInviteRecordQuerySet {
|
||||||
return qs.w(qs.db.Offset(offset))
|
return qs.w(qs.db.Offset(offset))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (qs UserInviteRecordQuerySet) Find(ret *UserInviteRecord) error {
|
||||||
|
return qs.db.Find(ret).Error
|
||||||
|
}
|
||||||
|
|
||||||
// One is used to retrieve one result. It returns gorm.ErrRecordNotFound
|
// One is used to retrieve one result. It returns gorm.ErrRecordNotFound
|
||||||
// if nothing was fetched
|
// if nothing was fetched
|
||||||
func (qs UserInviteRecordQuerySet) One(ret *UserInviteRecord) error {
|
func (qs UserInviteRecordQuerySet) One(ret *UserInviteRecord) error {
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -26,9 +26,10 @@ type Coupon struct {
|
||||||
Model
|
Model
|
||||||
|
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Describe string `json:"describe" gorm:"type:text;"` // 描述
|
Describe string `json:"describe" gorm:"type:text"` // 描述
|
||||||
|
Rule string `json:"rule" gorm:"type:text"` // 优惠券使用规则
|
||||||
CouponType string `json:"coupon_type"`
|
CouponType string `json:"coupon_type"`
|
||||||
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费 2-关注公众号 3-运费包
|
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费 2-关注公众号 3-运费包 4-开通会员(2024/7/17新增)
|
||||||
ActivityId uint32 `json:"activity_id" gorm:"index"`
|
ActivityId uint32 `json:"activity_id" gorm:"index"`
|
||||||
Value uint32 `json:"value"`
|
Value uint32 `json:"value"`
|
||||||
OutCount uint32 `json:"out_count"` // 用户已领取数量
|
OutCount uint32 `json:"out_count"` // 用户已领取数量
|
||||||
|
@ -58,6 +59,7 @@ type UserCoupon struct {
|
||||||
Approach uint32 `json:"approach"` // 获取途径:1-通过店员兑换码获取
|
Approach uint32 `json:"approach"` // 获取途径:1-通过店员兑换码获取
|
||||||
PromotionalSales uint32 `json:"promotional_sales"` // 推广人员用户id
|
PromotionalSales uint32 `json:"promotional_sales"` // 推广人员用户id
|
||||||
RedeemCode string `json:"redeem_code"` //
|
RedeemCode string `json:"redeem_code"` //
|
||||||
|
StoreId uint32 `json:"store_id" gorm:"-"` // 邀请码对应门店id
|
||||||
Availability uint32 `json:"availability" gorm:"-"` // 1-不可用 2-可用
|
Availability uint32 `json:"availability" gorm:"-"` // 1-不可用 2-可用
|
||||||
Coupon *Coupon `json:"coupon" gorm:"-"`
|
Coupon *Coupon `json:"coupon" gorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -1740,7 +1740,7 @@ type AssistantMemberPromotionReq struct {
|
||||||
Assistant *User `json:"assistant"`
|
Assistant *User `json:"assistant"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *AssistantMemberPromotionReq) List() ([]InviteMemberReport, int, error) {
|
func (m *AssistantMemberPromotionReq) List() ([]InviteMemberReport, int, int, error) {
|
||||||
var reports []InviteMemberReport
|
var reports []InviteMemberReport
|
||||||
|
|
||||||
m.PageNum -= 1
|
m.PageNum -= 1
|
||||||
|
@ -1751,7 +1751,14 @@ func (m *AssistantMemberPromotionReq) List() ([]InviteMemberReport, int, error)
|
||||||
m.PageSize = 10
|
m.PageSize = 10
|
||||||
}
|
}
|
||||||
|
|
||||||
m.StoreId = uint32(m.Assistant.StoreId)
|
//m.StoreId = uint32(m.Assistant.StoreId)
|
||||||
|
|
||||||
|
effectiveStoreInfo, err := GetUserEffectiveStore(m.Assistant.Uid)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("err:", err)
|
||||||
|
return reports, 0, 0, err
|
||||||
|
}
|
||||||
|
m.StoreId = uint32(effectiveStoreInfo.StoreID)
|
||||||
|
|
||||||
qs := NewInviteMemberReportQuerySet(DB).CooperativeBusinessIdEq(m.Assistant.CooperativeBusinessId).
|
qs := NewInviteMemberReportQuerySet(DB).CooperativeBusinessIdEq(m.Assistant.CooperativeBusinessId).
|
||||||
StoreIdEq(m.StoreId)
|
StoreIdEq(m.StoreId)
|
||||||
|
@ -1761,17 +1768,19 @@ func (m *AssistantMemberPromotionReq) List() ([]InviteMemberReport, int, error)
|
||||||
count, err := qs.Count()
|
count, err := qs.Count()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("err:", err)
|
logger.Error("err:", err)
|
||||||
return reports, 0, err
|
return reports, 0, 0, err
|
||||||
}
|
}
|
||||||
totalPage := int(count)/m.PageSize + 1
|
//totalPage := int(count)/m.PageSize + 1
|
||||||
err = qs.OrderDescByID().Offset(m.PageNum * m.PageSize).Limit(m.PageSize).All(&reports)
|
totalPage := (int(count) + m.PageSize - 1) / m.PageSize
|
||||||
|
|
||||||
|
err = qs.OrderDescByDateAndAscByStoreId().Offset(m.PageNum * m.PageSize).Limit(m.PageSize).All(&reports)
|
||||||
if err != nil && err != RecordNotFound {
|
if err != nil && err != RecordNotFound {
|
||||||
logger.Error("err:", err)
|
logger.Error("err:", err)
|
||||||
return reports, totalPage, err
|
return reports, totalPage, 0, err
|
||||||
}
|
}
|
||||||
|
|
||||||
reports = InviteMemberReportListSetUser(reports)
|
reports = InviteMemberReportListSetUser(reports)
|
||||||
return reports, totalPage, nil
|
return reports, totalPage, count, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func uint32ToUint64(slice []uint32) []uint64 {
|
func uint32ToUint64(slice []uint32) []uint64 {
|
||||||
|
@ -1807,32 +1816,35 @@ func GameCardListSetStockState(list []GameCard, storeId uint32, storeList []uint
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = NewGameCardGoodsStockQuerySet(DB).StoreIdEq(uint64(storeId)).StoreIdIn(uint32ToUint64(storeList)...).
|
|
||||||
GameCardIdIn(gameCardIds...).RentStockGt(0).All(&cardStocks)
|
|
||||||
if err != nil {
|
|
||||||
logger.Error("GetGameIdByType err:", err)
|
|
||||||
}
|
|
||||||
for i, _ := range cardStocks {
|
|
||||||
_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
|
||||||
if !ok {
|
|
||||||
//gameIds = append(gameIds, uint32(cardStocks[i].GameCardId))
|
|
||||||
gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
err = NewGameCardGoodsStockQuerySet(DB).StoreIdNe(uint64(storeId)).StoreIdIn(uint32ToUint64(storeList)...).
|
err = NewGameCardGoodsStockQuerySet(DB).StoreIdNe(uint64(storeId)).StoreIdIn(uint32ToUint64(storeList)...).
|
||||||
GameCardIdIn(gameCardIds...).RentStockGt(0).All(&cardStocks)
|
GameCardIdIn(gameCardIds...).RentStockGt(0).All(&cardStocks)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("GetGameIdByType err:", err)
|
logger.Error("GetGameIdByType err:", err)
|
||||||
}
|
}
|
||||||
for i, _ := range cardStocks {
|
for i, _ := range cardStocks {
|
||||||
_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
//_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
||||||
if !ok {
|
//if !ok {
|
||||||
//gameIds = append(gameIds, uint32(cardStocks[i].GameCardId))
|
// //gameIds = append(gameIds, uint32(cardStocks[i].GameCardId))
|
||||||
gameIdMap[uint32(cardStocks[i].GameCardId)] = 2
|
// gameIdMap[uint32(cardStocks[i].GameCardId)] = 2
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
gameIdMap[uint32(cardStocks[i].GameCardId)] = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
err = NewGameCardGoodsStockQuerySet(DB).StoreIdEq(uint64(storeId)).StoreIdIn(uint32ToUint64(storeList)...).
|
||||||
|
GameCardIdIn(gameCardIds...).RentStockGt(0).All(&cardStocks)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("GetGameIdByType err:", err)
|
||||||
|
}
|
||||||
|
for i, _ := range cardStocks {
|
||||||
|
//_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
||||||
|
//if !ok {
|
||||||
|
// //gameIds = append(gameIds, uint32(cardStocks[i].GameCardId))
|
||||||
|
// gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
||||||
|
//}
|
||||||
|
|
||||||
|
gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
var cardStocks []GameCardGoodsStock
|
var cardStocks []GameCardGoodsStock
|
||||||
err := NewGameCardGoodsStockQuerySet(DB).GameCardIdIn(gameCardIds...).StoreIdIn(uint32ToUint64(storeList)...).
|
err := NewGameCardGoodsStockQuerySet(DB).GameCardIdIn(gameCardIds...).StoreIdIn(uint32ToUint64(storeList)...).
|
||||||
|
@ -1853,10 +1865,12 @@ func GameCardListSetStockState(list []GameCard, storeId uint32, storeList []uint
|
||||||
logger.Error("GetGameIdByType err:", err)
|
logger.Error("GetGameIdByType err:", err)
|
||||||
}
|
}
|
||||||
for i, _ := range cardStocks {
|
for i, _ := range cardStocks {
|
||||||
_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
//_, ok := gameIdMap[uint32(cardStocks[i].GameCardId)]
|
||||||
if !ok {
|
//if !ok {
|
||||||
gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
// gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
gameIdMap[uint32(cardStocks[i].GameCardId)] = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1277,21 +1277,21 @@ func AddMemberPromotion() {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestXcxRoleAdd(t *testing.T) {
|
func TestXcxRoleAdd(t *testing.T) {
|
||||||
InitTestDB()
|
//InitTestDB()
|
||||||
role := &XcxRole{
|
//role := &XcxRole{
|
||||||
RoleName: "店长",
|
// RoleName: "店长",
|
||||||
RoleKey: "shop_manager",
|
// RoleKey: "shop_manager",
|
||||||
RoleSort: 2,
|
// RoleSort: 2,
|
||||||
Status: "normal",
|
// Status: "normal",
|
||||||
Flag: "",
|
// Flag: "",
|
||||||
CreateBy: "",
|
// CreateBy: "",
|
||||||
UpdateBy: "",
|
// UpdateBy: "",
|
||||||
Remark: "",
|
// Remark: "",
|
||||||
}
|
//}
|
||||||
err := DBDev.Create(role).Error
|
//err := DBDev.Create(role).Error
|
||||||
if err != nil {
|
//if err != nil {
|
||||||
logger.Error("err:")
|
// logger.Error("err:")
|
||||||
}
|
//}
|
||||||
// assistant
|
// assistant
|
||||||
//shop_manager 长
|
//shop_manager 长
|
||||||
}
|
}
|
||||||
|
|
137
model/user.go
137
model/user.go
|
@ -21,43 +21,46 @@ import (
|
||||||
type User struct {
|
type User struct {
|
||||||
Model
|
Model
|
||||||
|
|
||||||
Uid uint32 `json:"uid" gorm:"column:uid;unique_index"`
|
Uid uint32 `json:"uid" gorm:"column:uid;unique_index"`
|
||||||
MemberLevel uint32 `json:"member_level"` // 当前会员等级:10-普通用户 1-普通会员 2-黄金会员 4-白金会员 5-黑金会员
|
MemberLevel uint32 `json:"member_level"` // 当前会员等级:10-普通用户 1-普通会员 2-黄金会员 4-白金会员 5-黑金会员
|
||||||
MemberGenre uint32 `json:"member_genre"` // 会员类型
|
MemberGenre uint32 `json:"member_genre"` // 会员类型
|
||||||
MemberExpire time.Time `json:"member_expire"` // 会员到期时间
|
MemberExpire time.Time `json:"member_expire"` // 会员到期时间
|
||||||
OpenMemberTime time.Time `json:"open_member_time"` // 开通会员
|
OpenMemberTime time.Time `json:"open_member_time"` // 开通会员
|
||||||
Bond uint32 `json:"bond"` // 保证金
|
Bond uint32 `json:"bond"` // 保证金
|
||||||
WxName string `json:"wx_name"` // 昵称
|
WxName string `json:"wx_name"` // 昵称
|
||||||
WxAvatar string `json:"wx_avatar"` // 头像
|
WxAvatar string `json:"wx_avatar"` // 头像
|
||||||
WxOpenID string `json:"wx_open_id"` // 微信openid
|
WxOpenID string `json:"wx_open_id"` // 微信openid
|
||||||
AppOpenID string `json:"app_open_id"` //
|
AppOpenID string `json:"app_open_id"` //
|
||||||
WxUnionID string `json:"wx_union_id"` // 微信uniodid
|
WxUnionID string `json:"wx_union_id"` // 微信uniodid
|
||||||
Tel string `json:"tel"` // 电话
|
Tel string `json:"tel"` // 电话
|
||||||
Gender uint8 `json:"gender"` // 性别
|
Gender uint8 `json:"gender"` // 性别
|
||||||
City string `json:"city"` // 城市
|
City string `json:"city"` // 城市
|
||||||
Province string `json:"province"` // 省
|
Province string `json:"province"` // 省
|
||||||
Country string `json:"country"` // 市
|
Country string `json:"country"` // 市
|
||||||
Deposit uint32 `json:"deposit"` // 押金
|
Deposit uint32 `json:"deposit"` // 押金
|
||||||
UserType uint32 `json:"user_type"` // 用户类型: 1-普通用户 2-店员
|
UserType uint32 `json:"user_type"` // 用户类型: 1-普通用户 2-店员
|
||||||
XcxRoleId uint32 `json:"xcx_role_id"` // 角色id
|
XcxRoleId uint32 `json:"xcx_role_id"` // 角色id
|
||||||
OpenMemberChannel string `json:"open_member_channel" ` // 开通会员渠道: -门店推广 -用户邀请 -兑换码
|
OpenMemberChannel string `json:"open_member_channel" ` // 开通会员渠道: -门店推广 -用户邀请 -兑换码
|
||||||
StoreId uint64 `json:"store_id"` // 门店id
|
StoreId uint64 `json:"store_id"` // 门店id
|
||||||
InviteCodeUrl string `json:"invite_code_url"` // 分享二维码
|
InviteCodeUrl string `json:"invite_code_url"` // 分享二维码
|
||||||
LastLoginAt time.Time `json:"last_login_at"` // 最近登录时间
|
LastLoginAt time.Time `json:"last_login_at"` // 最近登录时间
|
||||||
IP string `json:"-" gorm:"type:varchar(60)"` // ip
|
IP string `json:"-" gorm:"type:varchar(60)"` // ip
|
||||||
InBlack bool `json:"in_black"` // 是否在黑名单
|
InBlack bool `json:"in_black"` // 是否在黑名单
|
||||||
StoreType uint32 `json:"store_type"` // 1-订单门店
|
StoreType uint32 `json:"store_type"` // 1-订单门店
|
||||||
CooperativeBusinessId uint32 `json:"cooperative_business_id" gorm:"index"` // 合作商id
|
CooperativeBusinessId uint32 `json:"cooperative_business_id" gorm:"index"` // 合作商id
|
||||||
CooperativeName string `json:"cooperative_name"` // 合作商名称
|
CooperativeName string `json:"cooperative_name"` // 合作商名称
|
||||||
ShopAssistantName string `json:"shop_assistant_name"` // 店员名称
|
ShopAssistantName string `json:"shop_assistant_name"` // 店员名称
|
||||||
OpenMemberLevel uint32 `json:"open_member_level"` // 开通会员级别:2-黄金会员 4-白金会员 5-黑金会员
|
OpenMemberLevel uint32 `json:"open_member_level"` // 开通会员级别:2-黄金会员 4-白金会员 5-黑金会员
|
||||||
FirstRetailOrder time.Time `json:"first_retail_order"` //
|
FirstRetailOrder time.Time `json:"first_retail_order"` //
|
||||||
Version uint32 `json:"-"` //
|
Version uint32 `json:"-"` //
|
||||||
UserVm *UserVm `json:"user_vm" gorm:"-"` //
|
UserVm *UserVm `json:"user_vm" gorm:"-"` //
|
||||||
InviteTime time.Time `json:"invite_time"` //
|
InviteTime time.Time `json:"invite_time"` //
|
||||||
DepositType uint32 `json:"deposit_type"` // 押金类型: 3-未充值
|
DepositType uint32 `json:"deposit_type"` // 押金类型: 3-未充值
|
||||||
StoreList []StoreInfo `gorm:"-" json:"store_list"` // 有效门店列表
|
StoreList []StoreInfo `gorm:"-" json:"store_list"` // 有效门店列表
|
||||||
RoleId uint32 `json:"role_id" gorm:"-"` // 角色id
|
RoleId uint32 `json:"role_id" gorm:"-"` // 角色id
|
||||||
|
RoleKey string `json:"role_key" gorm:"-"` // 角色代码
|
||||||
|
RoleName string `json:"role_name" gorm:"-"` // 角色名称
|
||||||
|
LatestInviteRecord UserInviteRecord `json:"latest_invite_record" gorm:"-"` // 最近的邀请记录
|
||||||
//RenewalTime time.Time `json:"renewal_time"`
|
//RenewalTime time.Time `json:"renewal_time"`
|
||||||
//RenewalMemberLevel uint32 `json:"renewal_member_level"`
|
//RenewalMemberLevel uint32 `json:"renewal_member_level"`
|
||||||
//MemberLevelString string `json:"member_level_string" gorm:"-"` // 会员类型
|
//MemberLevelString string `json:"member_level_string" gorm:"-"` // 会员类型
|
||||||
|
@ -181,6 +184,7 @@ const (
|
||||||
FundTypeBuyGoodsRefund = "buy_goods_refund" // 购买商品退货
|
FundTypeBuyGoodsRefund = "buy_goods_refund" // 购买商品退货
|
||||||
FundTypeRecycleCard = "recycle_card" // 回收卡带
|
FundTypeRecycleCard = "recycle_card" // 回收卡带
|
||||||
FundTypePostagePackageFee = "postage_package_fee" // 购买运费包
|
FundTypePostagePackageFee = "postage_package_fee" // 购买运费包
|
||||||
|
FundTypeDowngradeRenewal = "downgrade_renewal" // 降级续费
|
||||||
)
|
)
|
||||||
|
|
||||||
// gen:qs
|
// gen:qs
|
||||||
|
@ -221,24 +225,44 @@ type UserMemberExpireDelay struct {
|
||||||
IsPay uint32 `json:"is_pay"` // 1-已支付
|
IsPay uint32 `json:"is_pay"` // 1-已支付
|
||||||
}
|
}
|
||||||
|
|
||||||
// gen:qs
|
// gen:gs
|
||||||
type XcxRole struct {
|
type SysRole struct {
|
||||||
Model
|
Model
|
||||||
RoleId uint32 `json:"role_id" gorm:"unique_index,not null"`
|
RoleId int `json:"roleId" gorm:"primary_key;AUTO_INCREMENT"` // 角色编码
|
||||||
RoleName string `json:"role_name" gorm:"size:255;"` // 角色名称
|
RoleName string `json:"roleName" gorm:"size:128;"` // 角色名称
|
||||||
RoleKey string `json:"role_key" gorm:"size:255;"` // 角色代码
|
Status string `json:"status" gorm:"size:4;"` //
|
||||||
RoleSort int `json:"role_sort" gorm:""` // 角色排序
|
RoleKey string `json:"roleKey" gorm:"size:128;"` //角色代码
|
||||||
Status string `json:"status" gorm:"size:255;"` // 状态:1-停用 2-正常
|
RoleSort int `json:"roleSort" gorm:""` //角色排序
|
||||||
Flag string `json:"flag" gorm:"size:255;"` //
|
Flag string `json:"flag" gorm:"size:128;"` //
|
||||||
CreateBy string `json:"create_by" gorm:"size:255;"` //
|
CreateBy string `json:"createBy" gorm:"size:128;"` //
|
||||||
UpdateBy string `json:"update_by" gorm:"size:255;"` //
|
UpdateBy string `json:"updateBy" gorm:"size:128;"` //
|
||||||
Remark string `json:"remark" gorm:"size:255;"` // 备注
|
Remark string `json:"remark" gorm:"size:255;"` //备注
|
||||||
|
Admin bool `json:"admin" gorm:"size:4;"`
|
||||||
|
DataScope string `json:"dataScope" gorm:"size:128;"`
|
||||||
|
|
||||||
Params string `json:"params" gorm:"-"`
|
Params string `json:"params" gorm:"-"`
|
||||||
MenuIds []int `json:"menuIds" gorm:"-"`
|
MenuIds []int `json:"menuIds" gorm:"-"`
|
||||||
DeptIds []int `json:"deptIds" gorm:"-"`
|
DeptIds []int `json:"deptIds" gorm:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//// gen:qs
|
||||||
|
//type XcxRole struct {
|
||||||
|
// Model
|
||||||
|
// RoleId uint32 `json:"role_id" gorm:"unique_index,not null"`
|
||||||
|
// RoleName string `json:"role_name" gorm:"size:255;"` // 角色名称
|
||||||
|
// RoleKey string `json:"role_key" gorm:"size:255;"` // 角色代码
|
||||||
|
// RoleSort int `json:"role_sort" gorm:""` // 角色排序
|
||||||
|
// Status string `json:"status" gorm:"size:255;"` // 状态:1-停用 2-正常
|
||||||
|
// Flag string `json:"flag" gorm:"size:255;"` //
|
||||||
|
// CreateBy string `json:"create_by" gorm:"size:255;"` //
|
||||||
|
// UpdateBy string `json:"update_by" gorm:"size:255;"` //
|
||||||
|
// Remark string `json:"remark" gorm:"size:255;"` // 备注
|
||||||
|
//
|
||||||
|
// Params string `json:"params" gorm:"-"`
|
||||||
|
// MenuIds []int `json:"menuIds" gorm:"-"`
|
||||||
|
// DeptIds []int `json:"deptIds" gorm:"-"`
|
||||||
|
//}
|
||||||
|
|
||||||
// gen:qs
|
// gen:qs
|
||||||
// ShopperPromotionCode 店员优惠码
|
// ShopperPromotionCode 店员优惠码
|
||||||
type ShopperPromotionCode struct {
|
type ShopperPromotionCode struct {
|
||||||
|
@ -338,12 +362,21 @@ func GetUserEffectiveStore(uid uint32) (*StoreInfo, error) {
|
||||||
return &validStores[0], nil
|
return &validStores[0], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetUserRentCard(uid uint32) *UserRentCard {
|
func GetUserRentCard(db *gorm.DB, uid uint32) *UserRentCard {
|
||||||
userRent := new(UserRentCard)
|
userRent := new(UserRentCard)
|
||||||
if err := NewUserRentCardQuerySet(DB).UidEq(uid).One(userRent); err != nil {
|
if db == nil {
|
||||||
logger.Error(err, uid)
|
if err := NewUserRentCardQuerySet(DB).UidEq(uid).One(userRent); err != nil {
|
||||||
return nil
|
logger.Error(err, uid)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 手动加锁查询
|
||||||
|
if err := db.Raw(`SELECT * FROM user_rent_card WHERE uid = ? FOR UPDATE`, uid).Scan(userRent).Error; err != nil {
|
||||||
|
logger.Error(err, uid)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return userRent
|
return userRent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"server": {
|
"server": {
|
||||||
"port": 6001
|
"port": 8001
|
||||||
},
|
},
|
||||||
"jwt": {
|
"jwt": {
|
||||||
"user": {
|
"user": {
|
||||||
|
@ -23,11 +23,11 @@
|
||||||
},
|
},
|
||||||
"db": {
|
"db": {
|
||||||
"driver": "mysql",
|
"driver": "mysql",
|
||||||
"host": "39.108.188.218",
|
"host": "112.33.14.191",
|
||||||
"port": 3306,
|
"port": 3306,
|
||||||
"user": "mh_new_pro",
|
"user": "mh_dev",
|
||||||
"password": "YnzexdTfBHMSGZki",
|
"password": "d9qy46ONI0ZTF9eH",
|
||||||
"db_name": "mh_new_pro"
|
"db_name": "mh_dev"
|
||||||
},
|
},
|
||||||
"wx": {
|
"wx": {
|
||||||
"app_id": "wx806c079463b5b56c",
|
"app_id": "wx806c079463b5b56c",
|
||||||
|
|
|
@ -58,7 +58,7 @@ func ConfigAppRouter(r gin.IRouter) {
|
||||||
gameCard.POST("game_type", controller.GameCardTypes) // 游戏标签
|
gameCard.POST("game_type", controller.GameCardTypes) // 游戏标签
|
||||||
gameCard.POST("type/list", controller.GameCardTypeList) // 游戏类型列表
|
gameCard.POST("type/list", controller.GameCardTypeList) // 游戏类型列表
|
||||||
|
|
||||||
gameCard.Use(auth.UserAccessAuth)
|
//gameCard.Use(auth.UserAccessAuth)
|
||||||
gameCard.POST("info", controller.GameCardInfo) // 游戏卡详情
|
gameCard.POST("info", controller.GameCardInfo) // 游戏卡详情
|
||||||
gameCard.POST("list", controller.GameCardList) // 游戏卡列表
|
gameCard.POST("list", controller.GameCardList) // 游戏卡列表
|
||||||
gameCard.POST("banner", controller.HomeCarouselList) // 轮播图
|
gameCard.POST("banner", controller.HomeCarouselList) // 轮播图
|
||||||
|
@ -69,7 +69,7 @@ func ConfigAppRouter(r gin.IRouter) {
|
||||||
search.POST("list", controller.GameCardSearch) // 游戏卡搜索列表
|
search.POST("list", controller.GameCardSearch) // 游戏卡搜索列表
|
||||||
search.POST("hot", controller.GameCardHotSearch) // 游戏卡搜索列表
|
search.POST("hot", controller.GameCardHotSearch) // 游戏卡搜索列表
|
||||||
|
|
||||||
search.Use(auth.UserAccessAuth)
|
//search.Use(auth.UserAccessAuth)
|
||||||
search.POST("history", controller.GameCardSearchHistory) // 游戏卡搜索历史
|
search.POST("history", controller.GameCardSearchHistory) // 游戏卡搜索历史
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user