|
|
@@ -31,6 +31,12 @@ const (
|
|
|
CASH_SOURCE_PROJECT_LOAN = "project_loan"
|
|
|
CASH_SOURCE_PROJECT_LOAN_NAME = "项目放款"
|
|
|
|
|
|
+ ORDER_FOOD = "order_food"
|
|
|
+ ORDER_FOOD_NAME = "订餐扣费"
|
|
|
+
|
|
|
+ CANCEL_FOOD = "cancel_food"
|
|
|
+ CANCEL_FOOD_NAME = "取消订餐"
|
|
|
+
|
|
|
CASH_SOURCE_EXTRACT_REJECT = "extract_reject" //拒绝提现
|
|
|
CASH_SOURCE_EXTRACT_REJECT_NAME = "拒绝提现" //拒绝提现
|
|
|
CASH_SOURCE_PRODUCT_BENEFIT = "product_benefit" // 一级商品佣金
|
|
|
@@ -86,7 +92,7 @@ const (
|
|
|
|
|
|
)
|
|
|
|
|
|
-//现金余额表
|
|
|
+// 现金余额表
|
|
|
type CashBalance struct {
|
|
|
Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
WxUId int64 `orm:"column(wx_uid)" json:"wx_uid"` // int(11)
|
|
|
@@ -100,7 +106,7 @@ type CashBalance struct {
|
|
|
UpdatedAt time.Time `orm:"column(updated_at);null;auto_now;type(datetime)" json:"-"` // datetime
|
|
|
}
|
|
|
|
|
|
-//充值订单表
|
|
|
+// 充值订单表
|
|
|
type RechargeCashOrder struct {
|
|
|
Id int64 `orm:"column(id);pk" json:"id"` // int(11)
|
|
|
OrderId string `orm:"column(order_id)" json:"order_id"` // varchar(64)
|
|
|
@@ -142,7 +148,7 @@ func (self *CashBalance) Create(wxUId, c int64, s, rId, remark string) (item *Ca
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//返回source名称
|
|
|
+// 返回source名称
|
|
|
func (self *CashBalance) GetSourceName() string {
|
|
|
sourceName := ""
|
|
|
switch self.Source {
|
|
|
@@ -198,7 +204,7 @@ func (self *CashBalance) GetSourceName() string {
|
|
|
return sourceName
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表
|
|
|
+// 获取某人的现金流列表
|
|
|
func GetCashBalanceListByWxUId(wxUId, page, perPage int64, useCache bool) (list []*CashBalance) {
|
|
|
k := fmt.Sprintf("balance_model.GetCashBalanceListByWxUId(%d).page(%d).perPage(%d)", wxUId, page, perPage)
|
|
|
if useCache {
|
|
|
@@ -225,7 +231,7 @@ func GetCashBalanceListByWxUId(wxUId, page, perPage int64, useCache bool) (list
|
|
|
return list
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表总条数
|
|
|
+// 获取某人的现金流列表总条数
|
|
|
func GetCashBalanceCountByWxUId(wxUId int64) int64 {
|
|
|
item := new(CashBalance)
|
|
|
o := orm.NewOrm()
|
|
|
@@ -233,7 +239,7 @@ func GetCashBalanceCountByWxUId(wxUId int64) int64 {
|
|
|
return count
|
|
|
}
|
|
|
|
|
|
-//账户进账总额
|
|
|
+// 账户进账总额
|
|
|
func GetCashEnterBalance(wxUId int64) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|
|
|
@@ -253,7 +259,7 @@ func GetCashEnterBalance(wxUId int64) int64 {
|
|
|
return ret.Count
|
|
|
}
|
|
|
|
|
|
-//账户出账总额
|
|
|
+// 账户出账总额
|
|
|
func GetCashOutBalance(wxUId int64) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|
|
|
@@ -273,7 +279,7 @@ func GetCashOutBalance(wxUId int64) int64 {
|
|
|
return ret.Count
|
|
|
}
|
|
|
|
|
|
-//账户余额
|
|
|
+// 账户余额
|
|
|
func GetCashTotalBalance(wxUId int64) int64 {
|
|
|
type Ret struct {
|
|
|
Count int64
|
|
|
@@ -307,7 +313,7 @@ func GetCashBalanceByWxUIdAndRIdAndSource(wxUId int64, rId, source string) *Cash
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//创建充值订单
|
|
|
+// 创建充值订单
|
|
|
func (self *RechargeCashOrder) Create(wxUId, uId, tp int64, payway string) (item *RechargeCashOrder) {
|
|
|
oId := createOrderId(ORDER_ID_PREFIX_CZCB)
|
|
|
item = &RechargeCashOrder{
|
|
|
@@ -366,7 +372,7 @@ func GetCashBalanceBySourceAndRId(source, rId string) *CashBalance {
|
|
|
return item
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表
|
|
|
+// 获取某人的现金流列表
|
|
|
func GetCasTohBalanceListByWxUId(wxUId, page, perPage int64, s string, useCache bool) (list []*CashBalance) {
|
|
|
k := fmt.Sprintf("balance_model.GetCashBalanceListByWxUId(%d).page(%d).perPage(%d)", wxUId, page, perPage)
|
|
|
if useCache {
|
|
|
@@ -393,7 +399,7 @@ func GetCasTohBalanceListByWxUId(wxUId, page, perPage int64, s string, useCache
|
|
|
return list
|
|
|
}
|
|
|
|
|
|
-//获取某人的现金流列表总条数
|
|
|
+// 获取某人的现金流列表总条数
|
|
|
func GetCashToBalanceCountByWxUId(wxUId int64, s string) int64 {
|
|
|
item := new(CashBalance)
|
|
|
o := orm.NewOrm()
|