Browse Source

Merge remote-tracking branch 'origin/master'

master
huangjiajun 3 months ago
parent
commit
cc07b3e29a
2 changed files with 66 additions and 0 deletions
  1. +44
    -0
      src/models/official/db_master_guide_order_statistics.go
  2. +22
    -0
      src/models/official/model/master_guide_order_statistics.go

+ 44
- 0
src/models/official/db_master_guide_order_statistics.go View File

@@ -0,0 +1,44 @@
package db

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

// MasterGuideOrderStatisticsInsert 插入单条数据
func MasterGuideOrderStatisticsInsert(officialDb *xorm.Engine, MasterGuideOrderStatistics *model.MasterGuideOrderStatistics) (int, error) {
_, err := officialDb.InsertOne(MasterGuideOrderStatistics)
if err != nil {
return 0, err
}
return MasterGuideOrderStatistics.Id, nil
}

func GetMasterGuideOrderStatistics(officialDb *xorm.Engine, masterId int, date string) (m *model.MasterGuideOrderStatistics, err error) {
m = new(model.MasterGuideOrderStatistics)
has, err := officialDb.Where("master_id =?", masterId).And("date =?", date).Get(m)
if err != nil {
return nil, zhios_order_relate_logx.Error(err)
}
if has == false {
return nil, nil
}
return m, nil
}

func MasterGuideOrderStatisticsUpdate(officialDb *xorm.Engine, id interface{}, m *model.MasterGuideOrderStatistics, forceColums ...string) (int64, error) {
var (
affected int64
err error
)
if forceColums != nil {
affected, err = officialDb.Where("id=?", id).Cols(forceColums...).Update(m)
} else {
affected, err = officialDb.Where("id=?", id).Update(m)
}
if err != nil {
return 0, err
}
return affected, nil
}

+ 22
- 0
src/models/official/model/master_guide_order_statistics.go View File

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

type MasterGuideOrderStatistics struct {
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
MasterId int `json:"master_id" xorm:"not null default 0 comment('站长id') INT(11)"`
PaymentTotal string `json:"payment_total" xorm:"not null default 0.0000 comment('付款金额(元)') DECIMAL(10,4)"`
OrderCount int `json:"order_count" xorm:"not null default 0 comment('订单数量(笔)') INT(11)"`
EstimatedCommission string `json:"estimated_commission" xorm:"not null default 0.0000 comment('预估佣金(元)') DECIMAL(10,4)"`
EstimatedProfit string `json:"estimated_profit" xorm:"not null default 0.0000 comment('预估利润(元)') DECIMAL(10,4)"`
LoseOrderCount int `json:"lose_order_count" xorm:"not null default 0 comment('失效订单(笔)') INT(11)"`
PlaceOrderNumOfPeople int `json:"place_order_num_of_people" xorm:"not null default 0 comment('下单人数(个)') INT(11)"`
EffectiveOrderCount int `json:"effective_order_count" xorm:"not null default 0 comment('有效订单(笔)') INT(11)"`
EffectiveCommission string `json:"effective_commission" xorm:"not null default 0.0000 comment('有效佣金(元)') DECIMAL(10,4)"`
ReceiveCommission string `json:"receive_commission" xorm:"not null default 0.0000 comment('收货佣金(元)') DECIMAL(10,4)"`
LoseCommission string `json:"lose_commission" xorm:"not null default 0.0000 comment('失效佣金(元)') DECIMAL(10,4)"`
AvgCommission string `json:"avg_commission" xorm:"not null default 0.0000 comment('平均佣金(元)') DECIMAL(10,4)"`
CustomerUnitPrice string `json:"customer_unit_price" xorm:"not null default 0.0000 comment('客单价(元)') DECIMAL(10,4)"`
Date string `json:"date" xorm:"not null default '0000-00-00' comment('统计时间') VARCHAR(50)"`
CreateAt string `json:"create_at" xorm:"not null default 'CURRENT_TIMESTAMP' TIMESTAMP"`
UpdateAt string `json:"update_at" xorm:"default 'CURRENT_TIMESTAMP' TIMESTAMP"`
EffectivePaymentTotal string `json:"effective_payment_total" xorm:"not null default 0.0000 comment('有效付款金额(元)') DECIMAL(10,4)"`
}

Loading…
Cancel
Save