Browse Source

update

master
shenjiachi 3 days ago
parent
commit
d5490fda34
3 changed files with 81 additions and 0 deletions
  1. +12
    -0
      src/dao/im_send_red_package_ord_dao.go
  2. +42
    -0
      src/implement/im_send_red_package_ord_implement.go
  3. +27
    -0
      src/model/im_send_red_package_ord.go

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

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

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
"xorm.io/xorm"
)

type ImSendRedPackageOrdDao interface {
//TODO:: You can add specific method definitions here
ImSendRedPackageOrdGetOneByParams(params map[string]interface{}) (*model.ImSendRedPackageOrd, error)
ImSendRedPackageOrdUpdateBySession(session *xorm.Session, id interface{}, user *model.ImSendRedPackageOrd, forceColumns ...string) (int64, error)
}

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

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

import (
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao"
"code.fnuoos.com/EggPlanet/egg_models.git/src/model"
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx"
"fmt"
"xorm.io/xorm"
)

func NewImSendRedPackageOrdDb(engine *xorm.Engine) dao.ImSendRedPackageOrdDao {
return &ImSendRedPackageOrdDb{Db: engine}
}

type ImSendRedPackageOrdDb struct {
Db *xorm.Engine
}

func (i ImSendRedPackageOrdDb) ImSendRedPackageOrdGetOneByParams(params map[string]interface{}) (*model.ImSendRedPackageOrd, error) {
var m model.ImSendRedPackageOrd
var query = fmt.Sprintf("%s = ?", params["key"])
if has, err := i.Db.Where(query, params["value"]).Get(&m); err != nil || has == false {
return nil, zhios_order_relate_logx.Error(err)
}
return &m, nil
}

func (i ImSendRedPackageOrdDb) ImSendRedPackageOrdUpdateBySession(session *xorm.Session, id interface{}, user *model.ImSendRedPackageOrd, forceColumns ...string) (int64, error) {
var (
affected int64
err error
)
if forceColumns != nil {
affected, err = session.Where("id=?", id).MustCols(forceColumns...).Update(user)
} else {
affected, err = session.Where("id=?", id).Update(user)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 27
- 0
src/model/im_send_red_package_ord.go View File

@@ -0,0 +1,27 @@
package model

import (
"time"
)

type ImSendRedPackageOrd struct {
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"`
OrdNo string `json:"ord_no" xorm:"not null comment('订单号') VARCHAR(20)"`
Uid int `json:"uid" xorm:"not null comment('用户id') INT(11)"`
ImUid int `json:"im_uid" xorm:"not null comment('im对应用户id') INT(11)"`
Amount string `json:"amount" xorm:"not null comment('金额') DECIMAL(10,2)"`
RedPacketBalanceAmount string `json:"red_packet_balance_amount" xorm:"not null comment('红包余额') DECIMAL(10,2)"`
RedPacketType int `json:"red_packet_type" xorm:"not null default 1 comment('红包类型(0:未知 1:好友红包 2:群组普通红包 3:群组手气红包 4:群组专属红包 5:系统红包)') TINYINT(1)"`
RedPacketNums int `json:"red_packet_nums" xorm:"not null default 1 comment('红包数量') INT(11)"`
RedPacketBalanceNums int `json:"red_packet_balance_nums" xorm:"not null default 1 comment('红包剩余数量') INT(11)"`
State int `json:"state" xorm:"not null default 1 comment('红包状态(0:未领取 1:领取中 2:领取完 3:已过期)') TINYINT(1)"`
WaitDrawUserIds string `json:"wait_draw_user_ids" xorm:"not null comment('待领取用户id(逗号分割)') VARCHAR(255)"`
WaitDrawImUserIds string `json:"wait_draw_im_user_ids" xorm:"not null comment('待领取im用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserIds string `json:"received_user_ids" xorm:"not null comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedImUserIds string `json:"received_im_user_ids" xorm:"not null comment('已领取用户id(逗号分割)') VARCHAR(255)"`
ReceivedUserAmount string `json:"received_user_amount" xorm:"not null comment('已领取用户金额(逗号分割)') VARCHAR(255)"`
ReceivedTimes string `json:"received_times" xorm:"not null comment('已领取时间(逗号分割)') VARCHAR(255)"`
CreateTime time.Time `json:"create_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('创建时间') DATETIME"`
UpdateTime time.Time `json:"update_time" xorm:"not null default 'CURRENT_TIMESTAMP' comment('更新时间') DATETIME"`
ImData string `json:"im_data" xorm:"comment('im数据') TEXT"`
}

Loading…
Cancel
Save