This commit is contained in:
jiangyong27 2023-04-09 09:58:23 +08:00
parent ac7fe80e5b
commit 0060d8c32a
4 changed files with 15 additions and 14 deletions

View File

@ -1,7 +1,7 @@
[server]
address = "0.0.0.0:9263"
#0:PAINC 1:FATAL 2:ERROR 3:WARNING 4:INFO 5:DEBUG 6:TRACE
log_level = 4
log_level = 5
[mysql]

View File

@ -51,7 +51,7 @@ func (d *DBLogger) Trace(ctx context.Context, begin time.Time, fc func() (sql st
if time.Since(begin).Milliseconds() > 1000 {
log.Errorf("[SQL]sql=%s affect=%d cost=%dms", sql, affects, time.Since(begin).Milliseconds())
} else {
log.Debugf("[SQL]sql=%s affect=%d cost=%dms", sql, affects, time.Since(begin).Milliseconds())
log.Tracef("[SQL]sql=%s affect=%d cost=%dms", sql, affects, time.Since(begin).Milliseconds())
}
}
}

View File

@ -146,7 +146,7 @@ func (p *Processor) getCinema(cityName, cinemaName string) (*Cinema, error) {
return nil, fmt.Errorf("city[%s] not[%s]", cityName, cinemaName)
}
func (d *Processor) getCinemaFilmShowHall(cinema *Cinema, filmName, startTime, hallName string) (*FilmShowHall, error) {
func (d *Processor) getCinemaFilmShowHall(cinema *Cinema, filmName, startTime string) (*FilmShowHall, error) {
baseReq := d.getBaseParam(cinema)
reqUrl := "https://appapi.dadicinema.com/app-web/v1/web/film/getHitFilmAndFilmSession"
body, err := httputil.HttpGet(reqUrl, baseReq, d.getBaseHeader())
@ -172,9 +172,8 @@ func (d *Processor) getCinemaFilmShowHall(cinema *Cinema, filmName, startTime, h
day := cast.ToString(ss["dayStr"])
for _, p := range cast.ToSlice(ss["plist"]) {
pp := cast.ToStringMap(p)
hName := cast.ToString(pp["hallName"])
sTime := cast.ToString(pp["startTime"])
if startTime != sTime || hName != hallName {
if startTime != sTime {
continue
}
hall = new(FilmShowHall)
@ -188,7 +187,7 @@ func (d *Processor) getCinemaFilmShowHall(cinema *Cinema, filmName, startTime, h
}
}
}
return nil, fmt.Errorf("film[%s] startTime[%s] ting[%s] nohas", filmName, startTime, hallName)
return nil, fmt.Errorf("film[%s] startTime[%s] no exist", filmName, startTime)
}
func (p *Processor) getSeatGoods(cinema *Cinema, sessionId, seats string) ([]*SeatGoods, error) {
@ -267,6 +266,8 @@ func (p *Processor) prevOrderInfo(cinema *Cinema, seatGoods []*SeatGoods) (*Prev
if err != nil {
return nil, err
}
log.Debugf("[newPriceCalculate] response : %s", goutil.EncodeJSON(data))
totalRealPrice := cast.ToFloat64(cast.ToStringMap(data)["totalRealPrice"])
previewOrder := new(PreviewOrder)
@ -281,7 +282,7 @@ func (p *Processor) CheckOrder(order *model.Order) (*common.CheckInfo, error) {
if err != nil {
return nil, err
}
showHall, err := p.getCinemaFilmShowHall(cinema, order.MovieName, goutil.TimeToDateTime(order.ShowTime), order.Ting)
showHall, err := p.getCinemaFilmShowHall(cinema, order.MovieName, goutil.TimeToDateTime(order.ShowTime))
if err != nil {
return nil, err
}

View File

@ -50,9 +50,7 @@ func (w *Worker) Run() {
for {
select {
case order := <-newOrderChan:
if order.IsSeat == 1 {
w.qyClient.SendText([]string{"jiangyong"}, order.CinemaName+":"+order.MovieName)
}
if !strings.Contains(order.CinemaName, "大地影院") {
continue
}
@ -64,10 +62,12 @@ func (w *Worker) Run() {
//hahaProcessor.BidPrice(order.Id, checkInfo.UnitPrice)
go func() {
time.Sleep(60 * time.Second)
if err := dadiProcessor.CancelOrder(order, checkInfo); err != nil {
log.Errorf("cancel order[%s] error[%s]", order.OrderId, err.Error())
}
/*
time.Sleep(60 * time.Second)
if err := dadiProcessor.CancelOrder(order, checkInfo); err != nil {
log.Errorf("cancel order[%s] error[%s]", order.OrderId, err.Error())
}
*/
}()
// 发送信息