update recipe detail
This commit is contained in:
parent
d52cad09fd
commit
9279ef0247
11 changed files with 58 additions and 123 deletions
|
|
@ -55,12 +55,12 @@ type RecipeDetailResponse struct {
|
|||
}
|
||||
|
||||
type RecipeDetailMat struct {
|
||||
IsUse bool `json:"isUse"`
|
||||
MaterialID uint64 `json:"materialID"`
|
||||
Name string `json:"name"`
|
||||
MixOrder int `json:"mixOrder"`
|
||||
FeedParameter int `json:"feedParameter"`
|
||||
FeedPattern int `json:"feedPattern"`
|
||||
IsUse bool `json:"isUse"`
|
||||
MaterialPathId int `json:"materialPathId"`
|
||||
PowderGram int `json:"powderGram"`
|
||||
PowderTime int `json:"powderTime"`
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ type Data struct {
|
|||
func NewData() *Data {
|
||||
|
||||
countries := []helpers.CountryName{{
|
||||
CountryID: "thai",
|
||||
CountryID: "tha",
|
||||
CountryName: "Thailand",
|
||||
}, {
|
||||
CountryID: "mys",
|
||||
|
|
@ -46,8 +46,8 @@ func NewData() *Data {
|
|||
|
||||
allRecipeFiles := helpers.ScanRecipeFiles(countries)
|
||||
|
||||
defaultFile := "coffeethai02_580.json"
|
||||
defaultCountry := "thai"
|
||||
defaultFile := "coffeethai02_600.json"
|
||||
defaultCountry := "tha"
|
||||
defaultRecipe, err := helpers.ReadRecipeFile(defaultCountry, defaultFile)
|
||||
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -32,10 +32,6 @@ func ReadFile(filePath string) (string, error) {
|
|||
|
||||
func ReadRecipeFile(countryID, filePath string) (*models.Recipe, error) {
|
||||
|
||||
if countryID == "thai" {
|
||||
countryID = ""
|
||||
}
|
||||
|
||||
file, err := os.Open(path.Join("cofffeemachineConfig", countryID, filePath))
|
||||
|
||||
if err != nil {
|
||||
|
|
@ -69,12 +65,7 @@ func ScanRecipeFiles(countries []CountryName) map[string][]RecipePath {
|
|||
recipeFiles := map[string][]RecipePath{}
|
||||
|
||||
for _, country := range countries {
|
||||
var files []string
|
||||
if country.CountryID == "thai" {
|
||||
files = ListFile("cofffeemachineConfig/coffeethai02_*.json")
|
||||
} else {
|
||||
files = ListFile("cofffeemachineConfig/" + country.CountryID + "/coffeethai02_*.json")
|
||||
}
|
||||
files := ListFile("cofffeemachineConfig/" + country.CountryID + "/coffeethai02_*.json")
|
||||
sort.Slice(files, func(i, j int) bool {
|
||||
file1, err := os.Stat(files[i])
|
||||
|
||||
|
|
|
|||
|
|
@ -73,12 +73,12 @@ func (rs *recipeService) GetRecipeDetailMat(request *contracts.RecipeDetailReque
|
|||
for _, mat := range matsCode {
|
||||
if v.MaterialPathId == int(mat.MaterialID) {
|
||||
result.Result = append(result.Result, contracts.RecipeDetailMat{
|
||||
IsUse: v.IsUse,
|
||||
MaterialID: mat.MaterialID,
|
||||
Name: mat.PackageDescription,
|
||||
MixOrder: v.MixOrder,
|
||||
FeedParameter: v.FeedParameter,
|
||||
FeedPattern: v.FeedPattern,
|
||||
IsUse: v.IsUse,
|
||||
MaterialPathId: v.MaterialPathId,
|
||||
PowderGram: v.PowderGram,
|
||||
PowderTime: v.PowderTime,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue