|
@@ -124,3 +124,20 @@ func (m *CustomerDAO) GetAccountByCust(id string) (*model.TaCustomerAccount, err
|
124
|
124
|
|
125
|
125
|
return acc, nil
|
126
|
126
|
}
|
|
127
|
+
|
|
128
|
+// GetCustomerVipAmount 获取用户vip金额
|
|
129
|
+func (m *CustomerDAO) GetCustomerVipAmount(id string) (string, error) {
|
|
130
|
+ type amount struct {
|
|
131
|
+ Balance string
|
|
132
|
+ }
|
|
133
|
+ sql := `select sum(balance) as balance from ta_customer_vip where customer_id=?`
|
|
134
|
+ var vip = amount{}
|
|
135
|
+ _, err := m.db.Sql(sql, id).Get(&vip)
|
|
136
|
+ if err != nil {
|
|
137
|
+ return "0.00", err
|
|
138
|
+ }
|
|
139
|
+ if vip.Balance == "" {
|
|
140
|
+ vip.Balance = "0.00"
|
|
141
|
+ }
|
|
142
|
+ return vip.Balance, nil
|
|
143
|
+}
|