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
import "fmt"
import (
"fmt"
"regexp"
"strings"
)
func MoneyFen(money int64) string {
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
Ting string
CinemaName string
CinemaBrand string
MovieName string
Address string
Count int

View File

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