|
|
@@ -61,17 +61,18 @@ const (
|
|
|
)
|
|
|
|
|
|
type Balance struct {
|
|
|
- Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
- UserId int64 `orm:"column(user_id);null" json:"user_id"` // int(11)
|
|
|
- WxUserId int64 `orm:"column(wx_user_id);null" json:"wx_user_id"` // int(11)
|
|
|
- Count int64 `orm:"column(count);null" json:"count"` // int(11)
|
|
|
- Source string `orm:"column(source);null" json:"source"` // varchar(20)
|
|
|
- SourceName string `orm:"-" json:"source_name"` // varchar(20)
|
|
|
- RelateId string `orm:"column(relate_id);null" json:"relate_id"` // varchar(255)
|
|
|
- Remark string `orm:"column(remark);null" json:"remark"` // varchar(255)
|
|
|
- CreatedAt time.Time `orm:"column(created_at);auto_now_add;type(datetime)" json:"-"` // datetime
|
|
|
- CTime int64 `orm:"-" json:"ctime"` // datetime
|
|
|
- UpdatedAt time.Time `orm:"column(updated_at);auto_now;type(datetime)" json:"-"` // datetime
|
|
|
+ Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
+ UserId int64 `orm:"column(user_id);null" json:"user_id"` // int(11)
|
|
|
+ WxUserId int64 `orm:"column(wx_user_id);null" json:"wx_user_id"` // int(11)
|
|
|
+ Count int64 `orm:"column(count);null" json:"count"` // int(11)
|
|
|
+ Source string `orm:"column(source);null" json:"source"` // varchar(20)
|
|
|
+ SourceName string `orm:"-" json:"source_name"` // varchar(20)
|
|
|
+ RelateId string `orm:"column(relate_id);null" json:"relate_id"` // varchar(255)
|
|
|
+ Remark string `orm:"column(remark);null" json:"remark"` // varchar(255)
|
|
|
+ CreatedAt time.Time `orm:"column(created_at);auto_now_add;type(datetime)" json:"-"` // datetime
|
|
|
+ CreatedAtText string `orm:"-" json:"created_at"` // datetime
|
|
|
+ CTime int64 `orm:"-" json:"ctime"` // datetime
|
|
|
+ UpdatedAt time.Time `orm:"column(updated_at);auto_now;type(datetime)" json:"-"` // datetime
|
|
|
}
|
|
|
|
|
|
func (self *Balance) TableName() string {
|
|
|
@@ -120,7 +121,7 @@ func (self *Balance) Create(wxUId, uId, c int64, s, rId, remark string) (item *B
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//返回source名称
|
|
|
+// 返回source名称
|
|
|
func (self *Balance) GetSourceName() string {
|
|
|
sourceName := ""
|
|
|
switch self.Source {
|
|
|
@@ -162,7 +163,7 @@ func GetBalanceById(id int64) *Balance {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表
|
|
|
+// 获取某人的现金流列表
|
|
|
func GetBalanceListByWxUId(wxUId, page, perPage int64, useCache bool) (list []*Balance) {
|
|
|
k := fmt.Sprintf("balance_model.GetBalanceList.wxUId(%d).page(%d).perPage(%d)", wxUId, page, perPage)
|
|
|
if useCache {
|
|
|
@@ -185,7 +186,7 @@ func GetBalanceListByWxUId(wxUId, page, perPage int64, useCache bool) (list []*B
|
|
|
return list
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表总条数
|
|
|
+// 获取某人的现金流列表总条数
|
|
|
func GetBalanceCountByWxUId(wxUId int64) int64 {
|
|
|
item := new(Balance)
|
|
|
o := orm.NewOrm()
|
|
|
@@ -193,7 +194,7 @@ func GetBalanceCountByWxUId(wxUId int64) int64 {
|
|
|
return count
|
|
|
}
|
|
|
|
|
|
-//获取某个用户的余额
|
|
|
+// 获取某个用户的余额
|
|
|
func GetUserTotalBalance(wxUId int64) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|
|
|
@@ -213,7 +214,7 @@ func GetUserTotalBalance(wxUId int64) int64 {
|
|
|
return ret.Count
|
|
|
}
|
|
|
|
|
|
-//获取某个source累计余额
|
|
|
+// 获取某个source累计余额
|
|
|
func GetBalanceCountBySource(wxUId int64, source string) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|
|
|
@@ -339,7 +340,7 @@ func (self *BalanceOrder) GetOrderIdPrefix() string {
|
|
|
return prefix
|
|
|
}
|
|
|
|
|
|
-//生成订单ID
|
|
|
+// 生成订单ID
|
|
|
func createOrderId(prefix string) string {
|
|
|
if prefix == "" {
|
|
|
return ""
|