from models.model import db,GoodModel,GoodTypeModel
classGoodAll(Resource):defget(self,id):
good = GoodModel.query.all()print(good)
good_all =[]for i in good:
da ={'id': i.id,'name': i.name,'img':i.img,'price':i.price
}
good_all.append(da)return jsonify({'code':200,'msg':'获取成功','one':good_all
})
from models.model import db,GoodModel,GoodTypeModel
classGoodAll(Resource):defget(self,id):
good = GoodModel.query.filter(GoodModel.type_id==id).first()
da ={'id': good.id,'name': good.name,'img':good.img,'price':good.price
}return jsonify({'code':200,'msg':'获取成功','one':da
})