fix bug
This commit is contained in:
@@ -1,23 +1,25 @@
|
||||
package restful
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/utils"
|
||||
"git.apinb.com/quant/gostock/internal/impl"
|
||||
"git.apinb.com/quant/gostock/internal/logic/strategy"
|
||||
"git.apinb.com/quant/gostock/internal/models"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Recommend(ctx *gin.Context) {
|
||||
ymd := lastYmd()
|
||||
strategy.TotalScore(ymd)
|
||||
ymdQuery := ctx.DefaultQuery("ymd", "")
|
||||
var ymd int
|
||||
if ymdQuery != "" {
|
||||
ymd = utils.String2Int(ymdQuery)
|
||||
}
|
||||
|
||||
if ymd == 0 {
|
||||
ymd = models.GetYmd()
|
||||
}
|
||||
|
||||
var stocks []string
|
||||
impl.DBService.Model(&models.StratModel{}).Where("total_score>?", 0).Pluck("code", &stocks)
|
||||
impl.DBService.Model(&models.StratModel{}).Where("status=2 and ai_score>=5 and ymd=?", ymd).Pluck("code", &stocks)
|
||||
ctx.JSON(200, stocks)
|
||||
return
|
||||
}
|
||||
func lastYmd() int {
|
||||
var ymd int
|
||||
sql := "select ymd from strat_model sm group by ymd order by ymd desc limit 1"
|
||||
impl.DBService.Raw(sql).Scan(&ymd)
|
||||
return ymd
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user