cinemabrand

This commit is contained in:
jiangyong27 2023-05-16 09:42:30 +08:00
parent 9be23976f9
commit 8c8aa7662e
3 changed files with 18 additions and 1 deletions

View File

@ -1,7 +1,21 @@
package util package util
import "fmt" import (
"fmt"
"regexp"
"strings"
)
func MoneyFen(money int64) string { func MoneyFen(money int64) string {
return fmt.Sprintf("%.2f", float64(money)/100) return fmt.Sprintf("%.2f", float64(money)/100)
} }
func CinemaBrand(name string) string {
reg, err := regexp.Compile("[^(]*")
if err != nil {
panic(err)
}
r := reg.Find([]byte(name))
return strings.Trim(string(r), "\r\n\t ")
}

View File

@ -30,6 +30,7 @@ type Order struct {
ProvinceName string ProvinceName string
Ting string Ting string
CinemaName string CinemaName string
CinemaBrand string
MovieName string MovieName string
Address string Address string
Count int Count int

View File

@ -3,6 +3,7 @@ package haha
import ( import (
"crypto/tls" "crypto/tls"
"encoding/json" "encoding/json"
"film/base/util"
"film/model" "film/model"
"fmt" "fmt"
"github.com/go-co-op/gocron" "github.com/go-co-op/gocron"
@ -99,6 +100,7 @@ func (s *SyncOrder) run() {
order.Address = cast.ToString(data["address"]) order.Address = cast.ToString(data["address"])
order.Ting = cast.ToString(data["ting"]) order.Ting = cast.ToString(data["ting"])
order.CinemaName = cast.ToString(data["cinemaName"]) order.CinemaName = cast.ToString(data["cinemaName"])
order.CinemaBrand = util.CinemaBrand(order.CinemaName)
order.Count = cast.ToInt(data["count"]) order.Count = cast.ToInt(data["count"])
order.IsSeat = cast.ToInt(data["is_seat"]) order.IsSeat = cast.ToInt(data["is_seat"])
order.LoverSeat = cast.ToInt(data["loverSeat"]) order.LoverSeat = cast.ToInt(data["loverSeat"])