mirror of
https://github.com/kongyuebin1/dongfeng-pay.git
synced 2024-11-22 10:19:25 +08:00
获取第一个页面的数据
This commit is contained in:
parent
c48d2f3e2c
commit
a56fa52493
@ -33,8 +33,10 @@ func (c *ShowPageController) WelcomePage() {
|
||||
c.Data["balance"] = accountInfo.Balance
|
||||
c.Data["unBalance"] = accountInfo.FreezeAmount
|
||||
c.Data["settleAmount"] = accountInfo.SettleAmount
|
||||
//c.Data["todayAmount"] = accountInfo.TodayIncome
|
||||
// 获取今天充值金额
|
||||
todayIncome := accountService.GetTodayIncome()
|
||||
logs.Debug("获取到当天充值金额:", todayIncome)
|
||||
c.Data["todayAmount"] = todayIncome
|
||||
|
||||
c.TplName = "welcome.html"
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
package fast
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/adapter/orm"
|
||||
"github.com/beego/beego/v2/core/logs"
|
||||
)
|
||||
|
||||
type OrderInfo struct {
|
||||
Id string `orm:"pk;column(id)"`
|
||||
MerchantOrderId string
|
||||
@ -36,3 +41,23 @@ type OrderInfo struct {
|
||||
UpdateTime string
|
||||
CreateTime string
|
||||
}
|
||||
|
||||
const ORDERINFO = "order_info"
|
||||
|
||||
func (c *OrderInfo) TableName() string {
|
||||
return ORDERINFO
|
||||
}
|
||||
|
||||
/**
|
||||
** 获取短时间内的充值金额
|
||||
*/
|
||||
func GetRangeDateIncome(startTime, endTime string) float64 {
|
||||
o := orm.NewOrm()
|
||||
sum := 0.00
|
||||
err := o.Raw("select sum(order_amount) from order_info where status = ? and create_time >= ? and create_time <= ?", "success", startTime, endTime).QueryRow(&sum)
|
||||
if err != nil {
|
||||
logs.Error("获取短时间内金额失败,err:", err)
|
||||
}
|
||||
|
||||
return sum
|
||||
}
|
||||
|
@ -14,42 +14,9 @@ import (
|
||||
** 链接数据库,注册已经存在的数据表,进行orm映射操作
|
||||
*/
|
||||
func init() {
|
||||
//initFastPay()
|
||||
initLegend()
|
||||
}
|
||||
|
||||
/**
|
||||
** 初始化快付支付系统的mysql数据库
|
||||
*/
|
||||
func initFastPay() {
|
||||
dbType, _ := web.AppConfig.String("dbtype")
|
||||
mysqlHost, _ := web.AppConfig.String("fast::host")
|
||||
mysqlPort, _ := web.AppConfig.String("fast::port")
|
||||
mysqlUserName, _ := web.AppConfig.String("fast::username")
|
||||
mysqlPassword, _ := web.AppConfig.String("fast::password")
|
||||
mysqlDbName, _ := web.AppConfig.String("fast::dbname")
|
||||
|
||||
logs.Info("host:%s, port:%s, usreName:%s, password:%s, dbname:%s, dbType:%s", mysqlHost, mysqlPort,
|
||||
mysqlUserName, mysqlPassword, mysqlDbName, dbType)
|
||||
|
||||
pStr := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8&loc=Local",
|
||||
mysqlUserName, mysqlPassword, mysqlHost, mysqlPort, mysqlDbName)
|
||||
|
||||
if err := orm.RegisterDataBase("default", dbType, pStr); err != nil {
|
||||
logs.Error("init fast fail:%s", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
orm.SetMaxIdleConns("default", 30)
|
||||
orm.SetMaxIdleConns("default", 30)
|
||||
|
||||
orm.RegisterModel(new(fast.MerchantInfo))
|
||||
orm.RegisterModel(new(fast.RpUserPayConfig))
|
||||
orm.RegisterModel(new(fast.RpUserBankAccount))
|
||||
orm.RegisterModel(new(fast.AccountInfo))
|
||||
|
||||
logs.Info("init fast success ......")
|
||||
}
|
||||
|
||||
/**
|
||||
** 初始化传奇支付系统的mysql数据库
|
||||
*/
|
||||
|
@ -6,3 +6,8 @@ func GetNowTime() string {
|
||||
t := time.Now().Format("2006-01-02 15:04:05")
|
||||
return t
|
||||
}
|
||||
|
||||
func GetNowDate() string {
|
||||
t := time.Now().Format("2006-01-02")
|
||||
return t
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user