Merge branch 'develop' of https://github.com/wangtianrui/NutritionMaster into develop
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
package com.example.ninefourone.nutritionmaster.bean;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
public class FoodMenu implements Serializable {
|
||||
public class FoodMenu {
|
||||
|
||||
|
||||
/**
|
||||
* flavor : 五香味
|
||||
@@ -20,6 +20,7 @@ public class FoodMenu implements Serializable {
|
||||
private String flavor;
|
||||
private float calorie;
|
||||
private String name;
|
||||
private int is_breakfast;
|
||||
private String technology;
|
||||
private String image_url;
|
||||
private String practice;
|
||||
@@ -33,6 +34,7 @@ public class FoodMenu implements Serializable {
|
||||
"flavor='" + flavor + '\'' +
|
||||
", calorie=" + calorie +
|
||||
", name='" + name + '\'' +
|
||||
", is_breakfast=" + is_breakfast +
|
||||
", technology='" + technology + '\'' +
|
||||
", image_url='" + image_url + '\'' +
|
||||
", practice='" + practice + '\'' +
|
||||
@@ -42,6 +44,14 @@ public class FoodMenu implements Serializable {
|
||||
'}';
|
||||
}
|
||||
|
||||
public int getIs_breakfast() {
|
||||
return is_breakfast;
|
||||
}
|
||||
|
||||
public void setIs_breakfast(int is_breakfast) {
|
||||
this.is_breakfast = is_breakfast;
|
||||
}
|
||||
|
||||
public String getFlavor() {
|
||||
return flavor;
|
||||
}
|
||||
@@ -114,7 +124,7 @@ public class FoodMenu implements Serializable {
|
||||
this.menuclassification_set = menuclassification_set;
|
||||
}
|
||||
|
||||
public static class ElementsBean implements Serializable{
|
||||
public static class ElementsBean {
|
||||
/**
|
||||
* id : 3940
|
||||
* calorie : 183
|
||||
@@ -412,7 +422,7 @@ public class FoodMenu implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public static class CookQuantityBean implements Serializable{
|
||||
public static class CookQuantityBean {
|
||||
/**
|
||||
* menu : 五香酥鱼
|
||||
* quantity : 500
|
||||
@@ -459,4 +469,3 @@ public class FoodMenu implements Serializable {
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -398,17 +398,20 @@ public class WebUtil {
|
||||
|
||||
/**
|
||||
* 用户吃了一个菜,更新用户本周已吃摄入的营养元素的量
|
||||
* 传入这顿饭摄入的营养量
|
||||
* 返回当前user的最新信息,用MyUser类解析json
|
||||
*
|
||||
* @param username
|
||||
* @param menuName
|
||||
*/
|
||||
public void eatenMenu(String username, String menuName, Callback callback) {
|
||||
public void eatenElements(String username, Map<String, Double> elements, Callback callback) {
|
||||
String url = "http://120.77.182.38/myuser/eaten_menu/";
|
||||
RequestBody formBody = new FormBody.Builder()
|
||||
.add("username", username)
|
||||
.add("menu_name", menuName)
|
||||
.build();
|
||||
FormBody.Builder builder = new FormBody.Builder();
|
||||
//构造RequestBody参数
|
||||
for (Map.Entry<String, Double> entry : elements.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
double value = entry.getValue();
|
||||
builder.add(key, String.valueOf(value));
|
||||
}
|
||||
builder.add("username", username);
|
||||
RequestBody formBody = builder.build();
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(formBody)
|
||||
|
||||
Reference in New Issue
Block a user