@@ -0,0 +1,12 @@ | |||
package dao | |||
import ( | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
) | |||
type CloudBundleDao interface { | |||
FindCloudBundleAndTotal(page, limit string) (*[]model.CloudBundle, int64, error) | |||
GetCloudBundle(id string) (m *model.CloudBundle, err error) | |||
GetCloudBundleLast(os string) (m *model.CloudBundle, err error) | |||
GetCloudBundleVersion(os, version string) (m *model.CloudBundle, err error) | |||
} |
@@ -0,0 +1,8 @@ | |||
package dao | |||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
type PlatformActiveDataDao interface { | |||
//TODO:: You can add specific method definitions here | |||
PlatformActiveDataGetOneByParams(params map[string]interface{}) (*model.PlatformActiveData, error) | |||
} |
@@ -0,0 +1,8 @@ | |||
package dao | |||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
type PlatformGrowDataDao interface { | |||
//TODO:: You can add specific method definitions here | |||
PlatformGrowDataGetLastOne() (*model.PlatformGrowData, bool, error) | |||
} |
@@ -0,0 +1,8 @@ | |||
package dao | |||
import "code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
type PlatformTotalDataDao interface { | |||
//TODO:: You can add specific method definitions here | |||
PlatformTotalDataGetOneByTime(year string, month string) (*model.PlatformTotalData, error) | |||
} |
@@ -18,4 +18,5 @@ type UserDao interface { | |||
UpdateUser(m *model.User, columns ...string) (int64, error) | |||
GetUser(id int64) (m *model.User, err error) | |||
UserCount() (int64, error) | |||
UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) | |||
} |
@@ -0,0 +1,61 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" | |||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | |||
"xorm.io/xorm" | |||
) | |||
func NewCloudBundleDb(engine *xorm.Engine) dao.CloudBundleDao { | |||
return &CloudBundleDb{Db: engine} | |||
} | |||
type CloudBundleDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (c CloudBundleDb) FindCloudBundleAndTotal(page, limit string) (*[]model.CloudBundle, int64, error) { | |||
var m []model.CloudBundle | |||
sess := c.Db.Where("1=1") | |||
start := (zhios_order_relate_utils.StrToInt(page) - 1) * zhios_order_relate_utils.StrToInt(limit) | |||
count, err := sess.Limit(zhios_order_relate_utils.StrToInt(limit), start).OrderBy("id desc").FindAndCount(&m) | |||
if err != nil { | |||
return nil, count, zhios_order_relate_logx.Error(err) | |||
} | |||
return &m, count, nil | |||
} | |||
func (c CloudBundleDb) GetCloudBundle(id string) (m *model.CloudBundle, err error) { | |||
m = new(model.CloudBundle) | |||
has, err := c.Db.Where("id=?", id).Get(m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return m, nil | |||
} | |||
func (c CloudBundleDb) GetCloudBundleLast(os string) (m *model.CloudBundle, err error) { | |||
m = new(model.CloudBundle) | |||
has, err := c.Db.Where("os=? and ep=0", os).Desc("id").Get(m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return m, nil | |||
} | |||
func (c CloudBundleDb) GetCloudBundleVersion(os, version string) (m *model.CloudBundle, err error) { | |||
m = new(model.CloudBundle) | |||
has, err := c.Db.Where("os=? and version=?", os, version).Desc("id").Get(m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
if has == false { | |||
return nil, nil | |||
} | |||
return m, nil | |||
} |
@@ -1,9 +1,8 @@ | |||
package implement | |||
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" | |||
) | |||
@@ -18,23 +17,23 @@ type ImGroupBatchSendMessageRecordsDb struct { | |||
func (i ImGroupBatchSendMessageRecordsDb) ImGroupBatchSendMessageRecordsInsert(m *model.ImGroupBatchSendMessageRecords) (int, error) { | |||
_, err := i.Db.InsertOne(m) | |||
if err != nil { | |||
return 0, zhios_order_relate_logx.Error(err) | |||
return 0, err | |||
} | |||
return m.Id, nil | |||
} | |||
func (i ImGroupBatchSendMessageRecordsDb) ImGroupBatchSendMessageRecordsUpdate(id interface{}, m *model.ImGroupBatchSendMessageRecords, forceColums ...string) (int64, error) { | |||
func (i ImGroupBatchSendMessageRecordsDb) ImGroupBatchSendMessageRecordsUpdate(id interface{}, m *model.ImGroupBatchSendMessageRecords, forceColumns ...string) (int64, error) { | |||
var ( | |||
affected int64 | |||
err error | |||
) | |||
if forceColums != nil { | |||
affected, err = i.Db.Where("id=?", id).MustCols(forceColums...).Update(m) | |||
if forceColumns != nil { | |||
affected, err = i.Db.Where("id=?", id).MustCols(forceColumns...).Update(m) | |||
} else { | |||
affected, err = i.Db.Where("id=?", id).Update(m) | |||
} | |||
if err != nil { | |||
return 0, zhios_order_relate_logx.Error(err) | |||
return 0, err | |||
} | |||
return affected, nil | |||
} |
@@ -0,0 +1,26 @@ | |||
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 NewPlatformActiveDataDb(engine *xorm.Engine) dao.PlatformActiveDataDao { | |||
return &PlatformActiveDataDb{Db: engine} | |||
} | |||
type PlatformActiveDataDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (p PlatformActiveDataDb) PlatformActiveDataGetOneByParams(params map[string]interface{}) (*model.PlatformActiveData, error) { | |||
var m model.PlatformActiveData | |||
var query = fmt.Sprintf("%s = ?", params["key"]) | |||
if has, err := p.Db.Where(query, params["value"]).Get(&m); err != nil || has == false { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
return &m, nil | |||
} |
@@ -0,0 +1,25 @@ | |||
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 NewPlatformGrowDataDb(engine *xorm.Engine) dao.PlatformGrowDataDao { | |||
return &PlatformGrowDataDb{Db: engine} | |||
} | |||
type PlatformGrowDataDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (p PlatformGrowDataDb) PlatformGrowDataGetLastOne() (*model.PlatformGrowData, bool, error) { | |||
var m model.PlatformGrowData | |||
exist, err := p.Db.Desc("id").Get(&m) | |||
if err != nil { | |||
return nil, false, zhios_order_relate_logx.Error(err.Error()) | |||
} | |||
return &m, exist, nil | |||
} |
@@ -0,0 +1,27 @@ | |||
package implement | |||
import ( | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
"xorm.io/xorm" | |||
) | |||
func NewPlatformTotalDataDb(engine *xorm.Engine) dao.PlatformTotalDataDao { | |||
return &PlatformTotalDataDb{Db: engine} | |||
} | |||
type PlatformTotalDataDb struct { | |||
Db *xorm.Engine | |||
} | |||
func (p PlatformTotalDataDb) PlatformTotalDataGetOneByTime(year string, month string) (*model.PlatformTotalData, error) { | |||
var m model.PlatformTotalData | |||
get, err := p.Db.Where("year = ?", year).And("month = ?", month).Get(&m) | |||
if err != nil { | |||
return nil, err | |||
} | |||
if !get { | |||
return nil, nil | |||
} | |||
return &m, nil | |||
} |
@@ -157,3 +157,22 @@ func (u UserDb) UserCount() (int64, error) { | |||
} | |||
return count, nil | |||
} | |||
func (u UserDb) UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) { | |||
var m []model.User | |||
var total int64 | |||
var err error | |||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||
//指定In查询 | |||
if total, err = u.Db.NotIn(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m); err != nil { | |||
return nil, 0, zhios_order_relate_logx.Warn(err) | |||
} | |||
} else { | |||
var query = fmt.Sprintf("%s != ?", params["key"]) | |||
total, err = u.Db.Where(query, params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m) | |||
if err != nil { | |||
return nil, 0, zhios_order_relate_logx.Error(err) | |||
} | |||
} | |||
return m, total, nil | |||
} |
@@ -3,6 +3,7 @@ package implement | |||
import ( | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/dao" | |||
"code.fnuoos.com/EggPlanet/egg_models.git/src/model" | |||
zhios_order_relate_utils "code.fnuoos.com/EggPlanet/egg_models.git/utils" | |||
zhios_order_relate_logx "code.fnuoos.com/EggPlanet/egg_models.git/utils/logx" | |||
"fmt" | |||
"reflect" | |||
@@ -44,10 +45,10 @@ func (u UserTagRecordsDb) UserTagRecordsUpdateBySession(session *xorm.Session, u | |||
func (u UserTagRecordsDb) UserTagRecordsDeleteBySession(session *xorm.Session, params map[string]interface{}) (int64, error) { | |||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||
return session.In(zhios_order_relate_logx.AnyToString(params["key"]), params["value"]).Delete(model.UserTag{}) | |||
return session.In(zhios_order_relate_logx.AnyToString(params["key"]), params["value"]).Delete(model.UserTagRecords{}) | |||
} else { | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
return session.Where(query, params["value"]).Delete(model.UserTag{}) | |||
return session.Where(query, params["value"]).Delete(model.UserTagRecords{}) | |||
} | |||
} | |||
@@ -61,9 +62,17 @@ func (u UserTagRecordsDb) UserTagRecordsBatchInsert(userTagRecord []*model.UserT | |||
func (u UserTagRecordsDb) UserTagRecordsFindByParams(params map[string]interface{}) (*[]model.UserTagRecords, error) { | |||
var m []model.UserTagRecords | |||
var query = fmt.Sprintf("%s = ?", params["key"]) | |||
if err := u.Db.Where(query, params["value"]).Find(&m); err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { | |||
//指定In查询 | |||
if err := u.Db.In(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Find(&m); err != nil { | |||
return nil, zhios_order_relate_logx.Warn(err) | |||
} | |||
} else { | |||
var query = fmt.Sprintf("%s =?", params["key"]) | |||
err := u.Db.Where(query, params["value"]).Find(&m) | |||
if err != nil { | |||
return nil, zhios_order_relate_logx.Error(err) | |||
} | |||
} | |||
return &m, nil | |||
} |
@@ -0,0 +1,12 @@ | |||
package model | |||
type AdvertisingCallback struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Platform string `json:"platform" xorm:"unique(platform) VARCHAR(255)"` | |||
Oid string `json:"oid" xorm:"unique(platform) VARCHAR(255)"` | |||
Uid int `json:"uid" xorm:"default 0 INT(11)"` | |||
Extra string `json:"extra" xorm:"VARCHAR(255)"` | |||
SpaceId string `json:"space_id" xorm:"VARCHAR(255)"` | |||
Amount string `json:"amount" xorm:"VARCHAR(255)"` | |||
IsRun int `json:"is_run" xorm:"default 0 INT(1)"` | |||
} |
@@ -1,9 +1,10 @@ | |||
package model | |||
type AdvertisingSpace struct { | |||
Id int `json:"id" xorm:"not null pk INT(11)"` | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Name string `json:"name" xorm:"VARCHAR(255)"` | |||
Kind int `json:"kind" xorm:"not null default 1 comment('广告类型(1:开屏广告 2:插屏广告 3:激励视频 4:信息流广告)') TINYINT(1)"` | |||
Info string `json:"info" xorm:"TEXT"` | |||
CountingDown int `json:"counting_down" xorm:"default 0 comment('倒计时 单位秒') INT(11)"` | |||
ServiceKey string `json:"service_key" xorm:"comment('回调校验') VARCHAR(255)"` | |||
} |
@@ -5,12 +5,14 @@ import ( | |||
) | |||
type AliyunSmsNotice struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Title string `json:"title" xorm:"VARCHAR(255)"` | |||
Content string `json:"content" xorm:"VARCHAR(255)"` | |||
Skip string `json:"skip" xorm:"TEXT"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
Day int `json:"day" xorm:"comment('部分通知需要时间') INT(11)"` | |||
Type string `json:"type" xorm:"VARCHAR(255)"` | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Title string `json:"title" xorm:"VARCHAR(255)"` | |||
Content string `json:"content" xorm:"VARCHAR(255)"` | |||
Skip string `json:"skip" xorm:"TEXT"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
Day int `json:"day" xorm:"comment('部分通知需要时间') INT(11)"` | |||
Type string `json:"type" xorm:"VARCHAR(255)"` | |||
NoticeDay int `json:"notice_day" xorm:"default 0 comment('部分通知需要时间 隔X小时通知') INT(11)"` | |||
IsShow int `json:"is_show" xorm:"default 0 INT(1)"` | |||
} |
@@ -0,0 +1,26 @@ | |||
package model | |||
type CloudBundle struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(10)"` | |||
Os int `json:"os" xorm:"not null default 1 comment('系统类型:1.Android; 2.IOS 3.微信小程序 4.支付宝小程序') TINYINT(1)"` | |||
Version string `json:"version" xorm:"not null default '' comment('版本号') VARCHAR(255)"` | |||
Modules string `json:"modules" xorm:"not null comment('包含的模块') TEXT"` | |||
ApplyAt int `json:"apply_at" xorm:"comment('申请时间') INT(11)"` | |||
FinishAt int `json:"finish_at" xorm:"comment('完成时间') INT(11)"` | |||
State int `json:"state" xorm:"not null default 1 comment('状态:正在排队0,正在同步代码1,正在更新配置2,正在混淆3,正在打包4,正在上传5,打包成功999,异常-1, 998已重签') SMALLINT(5)"` | |||
Memo string `json:"memo" xorm:"comment('备注') TEXT"` | |||
ErrorMsg string `json:"error_msg" xorm:"comment('错误信息') TEXT"` | |||
Src string `json:"src" xorm:"comment('包源地址') VARCHAR(255)"` | |||
BuildId string `json:"build_id" xorm:"comment('build版本ID') VARCHAR(255)"` | |||
BuildNumber string `json:"build_number" xorm:"default '' VARCHAR(255)"` | |||
TemplateDuringAudit string `json:"template_during_audit" xorm:"not null default '' VARCHAR(255)"` | |||
ResignSrc string `json:"resign_src" xorm:"comment('已重签的apk包') VARCHAR(255)"` | |||
Ep int `json:"ep" xorm:"not null default 0 comment('0:c端 1:b端') TINYINT(1)"` | |||
Bit string `json:"bit" xorm:"comment('位数') VARCHAR(255)"` | |||
AppletId int `json:"applet_id" xorm:"default 0 comment('小程序记录id') INT(11)"` | |||
IsCombine string `json:"is_combine" xorm:"default '0' VARCHAR(255)"` | |||
NewBit string `json:"new_bit" xorm:"VARCHAR(255)"` | |||
IsAuditing int `json:"is_auditing" xorm:"default 0 INT(1)"` | |||
AlipayAppletAppId string `json:"alipay_applet_app_id" xorm:"not null default '' comment('支付宝小程序appid') CHAR(50)"` | |||
Platform string `json:"platform" xorm:"VARCHAR(255)"` | |||
} |
@@ -5,12 +5,16 @@ import ( | |||
) | |||
type JpushNotice struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Title string `json:"title" xorm:"VARCHAR(255)"` | |||
Content string `json:"content" xorm:"VARCHAR(255)"` | |||
Skip string `json:"skip" xorm:"TEXT"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
Day int `json:"day" xorm:"comment('部分通知需要时间') INT(11)"` | |||
Type string `json:"type" xorm:"VARCHAR(255)"` | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Title string `json:"title" xorm:"VARCHAR(255)"` | |||
Content string `json:"content" xorm:"VARCHAR(255)"` | |||
Skip string `json:"skip" xorm:"TEXT"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
UpdateAt time.Time `json:"update_at" xorm:"DATETIME"` | |||
Day int `json:"day" xorm:"comment('部分通知需要时间 X小时') INT(11)"` | |||
Type string `json:"type" xorm:"VARCHAR(255)"` | |||
NoticeDay int `json:"notice_day" xorm:"default 0 comment('部分通知需要时间 隔X小时通知') INT(11)"` | |||
JpushOpen int `json:"jpush_open" xorm:"default 0 INT(1)"` | |||
SmsOpen int `json:"sms_open" xorm:"default 0 INT(1)"` | |||
SmsCode string `json:"sms_code" xorm:"VARCHAR(255)"` | |||
} |
@@ -0,0 +1,10 @@ | |||
package model | |||
type PlatformActiveData struct { | |||
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` | |||
NewUserCount int `json:"new_user_count" xorm:"not null comment('今日新增用户数') INT(11)"` | |||
UserSignInCount int `json:"user_sign_in_count" xorm:"not null comment('今日签到用户数') INT(11)"` | |||
WithdrawAmountCount string `json:"withdraw_amount_count" xorm:"not null comment('今日提现金额') DECIMAL(10,2)"` | |||
WithdrawUserCount int `json:"withdraw_user_count" xorm:"not null comment('今日提现用户数') INT(11)"` | |||
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"` | |||
} |
@@ -0,0 +1,7 @@ | |||
package model | |||
type PlatformGrowData struct { | |||
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` | |||
UserGrowCount int `json:"user_grow_count" xorm:"not null comment('用户增长数量') INT(11)"` | |||
Date string `json:"date" xorm:"not null default '0000-00-00' comment('日期') CHAR(50)"` | |||
} |
@@ -0,0 +1,11 @@ | |||
package model | |||
type PlatformTotalData struct { | |||
Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` | |||
TotalUserCount int `json:"total_user_count" xorm:"not null comment('平台总用户数') INT(11)"` | |||
VerifiedUserCount int `json:"verified_user_count" xorm:"not null comment('已认证用户数') INT(11)"` | |||
NoSiginInUserCount int `json:"no_sigin_in_user_count" xorm:"not null comment('未签到用户数') INT(11)"` | |||
TotalWithdrawAmount string `json:"total_withdraw_amount" xorm:"not null comment('已提现累计金额') DECIMAL(10,2)"` | |||
Year string `json:"year" xorm:"not null comment('年份') CHAR(50)"` | |||
Month string `json:"month" xorm:"not null comment('月份') CHAR(50)"` | |||
} |
@@ -0,0 +1,13 @@ | |||
package model | |||
import ( | |||
"time" | |||
) | |||
type UserImei struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uid int `json:"uid" xorm:"INT(11)"` | |||
Imei string `json:"imei" xorm:"VARCHAR(255)"` | |||
CreateAt time.Time `json:"create_at" xorm:"DATETIME"` | |||
Ip string `json:"ip" xorm:"VARCHAR(255)"` | |||
} |
@@ -0,0 +1,10 @@ | |||
package model | |||
type UserNoticeTime struct { | |||
Id int `json:"id" xorm:"not null pk autoincr INT(11)"` | |||
Uid int `json:"uid" xorm:"default 0 unique INT(11)"` | |||
LoginNoticeTime int `json:"login_notice_time" xorm:"default 0 INT(11)"` | |||
SignNoticeTime int `json:"sign_notice_time" xorm:"default 0 INT(11)"` | |||
LoginTime int `json:"login_time" xorm:"default 0 INT(11)"` | |||
SignTime int `json:"sign_time" xorm:"default 0 INT(11)"` | |||
} |