@@ -1,5 +1,9 @@ | |||||
package dao | package dao | ||||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
type AlipayUserInfoDao interface { | type AlipayUserInfoDao interface { | ||||
//TODO:: You can add specific method definitions here | |||||
GetAlipayUserInfo(uid int64) (m *model.AlipayUserInfo, err error) | |||||
UpdateAlipayUserInfo(m *model.AlipayUserInfo, columns ...string) (int64, error) | |||||
AlipayUserInfoInsert(m *model.AlipayUserInfo) (int, error) | |||||
} | } |
@@ -6,6 +6,6 @@ import ( | |||||
) | ) | ||||
type FinWithdrawApplyDao interface { | type FinWithdrawApplyDao interface { | ||||
//TODO:: You can add specific method definitions here | |||||
FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) | FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) | ||||
FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) | |||||
} | } |
@@ -0,0 +1,11 @@ | |||||
package dao | |||||
import ( | |||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||||
) | |||||
type WxUserInfoDao interface { | |||||
GetWxUserInfo(uid int64) (m *model.WxUserInfo, err error) | |||||
UpdateWxUserInfo(m *model.WxUserInfo, columns ...string) (int64, error) | |||||
WxUserInfoInsert(m *model.WxUserInfo) (int, error) | |||||
} |
@@ -2,6 +2,8 @@ | |||||
import ( | import ( | ||||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | "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" | |||||
"xorm.io/xorm" | "xorm.io/xorm" | ||||
) | ) | ||||
@@ -12,3 +14,31 @@ func NewAlipayUserInfoDb(engine *xorm.Engine) dao.AlipayUserInfoDao { | |||||
type AlipayUserInfoDb struct { | type AlipayUserInfoDb struct { | ||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (a AlipayUserInfoDb) GetAlipayUserInfo(uid int64) (m *model.AlipayUserInfo, err error) { | |||||
m = new(model.AlipayUserInfo) | |||||
has, err := a.Db.Where("uid = ?", uid).Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | |||||
func (a AlipayUserInfoDb) UpdateAlipayUserInfo(m *model.AlipayUserInfo, columns ...string) (int64, error) { | |||||
affected, err := a.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (a AlipayUserInfoDb) AlipayUserInfoInsert(m *model.AlipayUserInfo) (int, error) { | |||||
_, err := a.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} |
@@ -18,6 +18,14 @@ type FinWithdrawApplyDb struct { | |||||
Db *xorm.Engine | Db *xorm.Engine | ||||
} | } | ||||
func (f FinWithdrawApplyDb) FinWithdrawApplyInsertOneBySession(session *xorm.Session, m *model.FinWithdrawApply) (int64, error) { | |||||
affected, err := session.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) { | func (f FinWithdrawApplyDb) FinWithdrawApplyGetBySession(session *xorm.Session, startAt, endAt string, params map[string]interface{}) (*[]model.FinWithdrawApply, error) { | ||||
var m *[]model.FinWithdrawApply | var m *[]model.FinWithdrawApply | ||||
session = session.Where("create_at >= ?", startAt).And("create_at <= ?", endAt) | session = session.Where("create_at >= ?", startAt).And("create_at <= ?", endAt) | ||||
@@ -0,0 +1,44 @@ | |||||
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" | |||||
"xorm.io/xorm" | |||||
) | |||||
func NewWxUserInfoDb(engine *xorm.Engine) dao.WxUserInfoDao { | |||||
return &WxUserInfoDb{Db: engine} | |||||
} | |||||
type WxUserInfoDb struct { | |||||
Db *xorm.Engine | |||||
} | |||||
func (w WxUserInfoDb) GetWxUserInfo(uid int64) (m *model.WxUserInfo, err error) { | |||||
m = new(model.WxUserInfo) | |||||
has, err := w.Db.Where("uid = ?", uid).Get(m) | |||||
if err != nil { | |||||
return nil, zhios_order_relate_logx.Error(err) | |||||
} | |||||
if has == false { | |||||
return nil, nil | |||||
} | |||||
return m, nil | |||||
} | |||||
func (w WxUserInfoDb) UpdateWxUserInfo(m *model.WxUserInfo, columns ...string) (int64, error) { | |||||
affected, err := w.Db.Where("id =?", m.Id).Cols(columns...).Update(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return affected, nil | |||||
} | |||||
func (w WxUserInfoDb) WxUserInfoInsert(m *model.WxUserInfo) (int, error) { | |||||
_, err := w.Db.InsertOne(m) | |||||
if err != nil { | |||||
return 0, err | |||||
} | |||||
return m.Id, nil | |||||
} |
@@ -2,9 +2,11 @@ package model | |||||
type FinWithdrawApply struct { | type FinWithdrawApply struct { | ||||
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` | Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` | ||||
Uid int `json:"uid" xorm:"not null default 0 comment('用户ID') index INT(10)"` | |||||
Uid int64 `json:"uid" xorm:"not null default 0 comment('用户ID') index INT(10)"` | |||||
AdmId int `json:"adm_id" xorm:"not null default 0 comment('审核人ID,0为系统自动') INT(10)"` | AdmId int `json:"adm_id" xorm:"not null default 0 comment('审核人ID,0为系统自动') INT(10)"` | ||||
Amount string `json:"amount" xorm:"not null default 0.00 comment('提现金额') DECIMAL(10,2)"` | Amount string `json:"amount" xorm:"not null default 0.00 comment('提现金额') DECIMAL(10,2)"` | ||||
RealAmount string `json:"real_amount" xorm:"not null default 0.00 comment('实际到账金额') DECIMAL(10,2)"` | |||||
Fee string `json:"fee" xorm:"not null default 0.00 comment('手续费') DECIMAL(10,2)"` | |||||
Type int `json:"type" xorm:"not null default 1 comment('提现类型;1:手动;2:自动') TINYINT(1)"` | Type int `json:"type" xorm:"not null default 1 comment('提现类型;1:手动;2:自动') TINYINT(1)"` | ||||
WithdrawAccount string `json:"withdraw_account" xorm:"not null default '' comment('提现账号') VARCHAR(64)"` | WithdrawAccount string `json:"withdraw_account" xorm:"not null default '' comment('提现账号') VARCHAR(64)"` | ||||
WithdrawName string `json:"withdraw_name" xorm:"not null default '' comment('提现人姓名') VARCHAR(12)"` | WithdrawName string `json:"withdraw_name" xorm:"not null default '' comment('提现人姓名') VARCHAR(12)"` | ||||
@@ -0,0 +1,12 @@ | |||||
package model | |||||
type WxUserInfo struct { | |||||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||||
Uid int64 `json:"uid" xorm:"not null comment('用户id') BIGINT(20)"` | |||||
UserId string `json:"user_id" xorm:"not null default '' comment('微信用户id') CHAR(100)"` | |||||
OpenId string `json:"open_id" xorm:"not null default '' comment('微信用户open_id') CHAR(100)"` | |||||
AppId string `json:"app_id" xorm:"not null default '' comment('微信应用appid') CHAR(50)"` | |||||
Ext string `json:"ext" xorm:"not null comment('拓展字段') TEXT"` | |||||
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||||
UpdateAt string `json:"update_at" xorm:"not null default 'CURRENT_TIMESTAMP' DATETIME"` | |||||
} |