Browse Source

服务奖分红模型

master
dengbiao 1 month ago
parent
commit
7176a3f526
6 changed files with 116 additions and 0 deletions
  1. +7
    -0
      src/dao/service_award_dividend_basic_dao.go
  2. +12
    -0
      src/dao/service_award_dividend_relation_dao.go
  3. +28
    -0
      src/implement/service_award_dividend_basic_db.go
  4. +42
    -0
      src/implement/service_award_dividend_relation_db.go
  5. +15
    -0
      src/models/service_award_dividend_basic.go
  6. +12
    -0
      src/models/service_award_dividend_relation.go

+ 7
- 0
src/dao/service_award_dividend_basic_dao.go View File

@@ -0,0 +1,7 @@
package dao

import "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"

type ServiceAwardDividendBasicDao interface {
GetServiceAwardDividendBasic() (m *models.ServiceAwardDividendBasic, err error)
}

+ 12
- 0
src/dao/service_award_dividend_relation_dao.go View File

@@ -0,0 +1,12 @@
package dao

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

type ServiceAwardDividendRelationDao interface {
InsertServiceAwardDividendRelationBySess(sees *xorm.Session, m *models.ServiceAwardDividendRelation) (id int, err error)
InsertServiceAwardDividendRelation(m *models.ServiceAwardDividendRelation) (id int, err error)
SaveServiceAwardDividendRelation(sees *xorm.Session, id interface{}, m *models.ServiceAwardDividendRelation, forceColums ...string) (affected int64, err error)
}

+ 28
- 0
src/implement/service_award_dividend_basic_db.go View File

@@ -0,0 +1,28 @@
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
zhios_order_relate_logx "code.fnuoos.com/go_rely_warehouse/zyos_model.git/utils/logx"
"xorm.io/xorm"
)

func NewServiceAwardDividendBasicDb(engine *xorm.Engine) dao.ServiceAwardDividendBasicDao {
return &ServiceAwardDividendBasicDb{Db: engine}
}

type ServiceAwardDividendBasicDb struct {
Db *xorm.Engine
}

func (s ServiceAwardDividendBasicDb) GetServiceAwardDividendBasic() (m *models.ServiceAwardDividendBasic, err error) {
m = new(models.ServiceAwardDividendBasic)
has, err := s.Db.Where("is_open = 1").Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

+ 42
- 0
src/implement/service_award_dividend_relation_db.go View File

@@ -0,0 +1,42 @@
package implement

import (
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/dao"
"code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models"
"xorm.io/xorm"
)

func NewServiceAwardDividendRelationDb(engine *xorm.Engine) dao.ServiceAwardDividendRelationDao {
return &ServiceAwardDividendRelationDb{Db: engine}
}

type ServiceAwardDividendRelationDb struct {
Db *xorm.Engine
}

func (s ServiceAwardDividendRelationDb) SaveServiceAwardDividendRelation(sees *xorm.Session, id interface{}, m *models.ServiceAwardDividendRelation, forceColums ...string) (affected int64, err error) {
if forceColums != nil {
affected, err = sees.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = sees.Where("id=?", id).Update(m)
}
return
}

func (s ServiceAwardDividendRelationDb) InsertServiceAwardDividendRelationBySess(sess *xorm.Session, m *models.ServiceAwardDividendRelation) (id int, err error) {
_, err = s.Db.InsertOne(m)
if err != nil {
return 0, err
}
id = m.Id
return id, nil
}

func (s ServiceAwardDividendRelationDb) InsertServiceAwardDividendRelation(m *models.ServiceAwardDividendRelation) (id int, err error) {
_, err = s.Db.InsertOne(m)
if err != nil {
return 0, err
}
id = m.Id
return id, nil
}

+ 15
- 0
src/models/service_award_dividend_basic.go View File

@@ -0,0 +1,15 @@
package models

type ServiceAwardDividendBasic struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsOpen int `json:"is_open" xorm:"not null default 1 comment('是否开启(1:开启 2:关闭)') TINYINT(1)"`
GeneralVipIds string `json:"general_vip_ids" xorm:"not null comment('普通会员ids(json存储)') TEXT"`
GeneralVipAllocationSet string `json:"general_vip_allocation_set" xorm:"not null comment('普通会员设置') TEXT"`
SeniorVipIds string `json:"senior_vip_ids" xorm:"not null comment('高级会员ids(json存储)') TEXT"`
SeniorVipAllocationSet string `json:"senior_vip_allocation_set" xorm:"not null comment('高级会员设置') TEXT"`
AllocationPriority int `json:"allocation_priority" xorm:"not null default 1 comment('分配优先级(1:推荐人优先 2:高等级会员平均)') TINYINT(1)"`
IsRefreshAllocation int `json:"is_refresh_allocation" xorm:"not null default 1 comment('是否重新分配(1:是 2:否)') TINYINT(1)"`
RefreshAllocation string `json:"refresh_allocation" xorm:"not null default 'CURRENT_TIMESTAMP' comment('重新分配时间') DATETIME"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

+ 12
- 0
src/models/service_award_dividend_relation.go View File

@@ -0,0 +1,12 @@
package models

type ServiceAwardDividendRelation struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Uid int `json:"uid" xorm:"not null default 0 comment('用户id') INT(11)"`
ParentUid int `json:"parent_uid" xorm:"not null default 0 comment('父级uid') INT(11)"`
BindUid int `json:"bind_uid" xorm:"not null default 0 comment('绑定uid') INT(11)"`
VipLevel int `json:"vip_level" xorm:"not null default 0 comment('会员等级id') INT(11)"`
AllocationNums int `json:"allocation_nums" xorm:"not null default 0 comment('分配次数') INT(11)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
}

Loading…
Cancel
Save