add carousel & test submenu

This commit is contained in:
pakintada@gmail.com 2024-01-15 11:48:25 +07:00
parent edcccaaab9
commit 7102f644d4
7 changed files with 242 additions and 314 deletions

View file

@ -426,6 +426,24 @@ func (d *Data) GetToppingsOfRecipe(countryID, filename string, productCode strin
return recipe.ToppingSet, nil
}
func (d *Data) GetSubmenusOfRecipe(countryID, filename, productCode string) ([]models.Recipe01, error) {
recipe, err := d.GetRecipe01ByProductCode(filename, countryID, productCode)
if err != nil {
d.taoLogger.Log.Error("Error when read recipe file, Return default recipe", zap.Error(err))
return []models.Recipe01{}, err
}
submenu := recipe.SubMenu
if submenu == nil {
return []models.Recipe01{}, fmt.Errorf("no submenu")
}
return submenu, nil
}
func (d *Data) GetCountryNameByID(countryID string) (string, error) {
for _, country := range d.Countries {
if country.CountryID == countryID {