智能小程序 Ray 开发菜谱 API ——食谱列表及详情 API 接口汇总(一)

获取食谱列表

getRecipeList

引入

@ray-js/ray^1.5.0 以上版本可使用

import { getRecipeList } from '@ray-js/ray'

参数

GetRecipeListParams 对象,包含以下属性:

属性类型默认值必填说明
queryRecipeListQuery食谱列表查询条件

RecipeListQuery 包含以下属性:

属性类型默认值必填说明
productIdstring产品 ID
namestring食谱名称
categoryIdsnumber[]分类 ID 数组
cookTimeMinnumber最小烹饪时间
cookTimeMaxnumber最大烹饪时间
easyLevelIdsnumber[]难易等级 ID 数组
foodTypeIdsnumber[]食品类型 ID 数组
allergenIdsnumber[]过敏原 ID 数组
isFoodChannelnumber是否为食品频道
orderTypenumber排序类型
pvWeightnumber浏览量权重
starCountWeightnumber收藏数权重
avgScoreWeightnumber平均评分权重
customInfoQueryCustomInfoQueryItem[]自定义属性查询 @ray-js/ray^1.5.5 新增
pageNonumber页码
pageSizenumber每页显示数量

CustomInfoQueryItem

属性类型默认值必填说明
codestring自定义属性 code
langValuestring自定义属性 value

返回结果 RecipeListResponse

属性类型说明
totalCountnumber总记录数
pageNonumber当前页码
pageSizenumber每页记录数
hasNextboolean是否有下一页
dataRecipeInfo[]食谱信息数组

RecipeInfo

属性类型说明
idnumber食谱 ID
mainImgsstring[]主图数组
langnumber语言类型
langDescstring语言描述
descstring描述
cookTypenumber烹饪方式
sourceTypenumber来源类型
isMainShownumber是否主显示
isShowControlnumber是否显示控制
isControlnumber是否受控
namestring名称
easyLevelstring难易等级
easyLevelDescstring难易等级描述
tastestring口味
tasteDescstring口味描述
foodTypestring食品类型
foodTypeDescstring食品类型描述
cookTimenumber烹饪时间
eatCountnumber用餐人数
avgScorenumber平均评分
isStarboolean是否加星
gmtCreatenumber创建时间
gmtModifiednumber修改时间

函数定义示例

/**
 * 获取食谱列表
 * @param {GetRecipeListParams} params - 包含查询条件的对象
 * @returns {Promise<RecipeListResponse>} - 返回食谱列表响应的 Promise
 */
export function getRecipeList(params: GetRecipeListParams): Promise<RecipeListResponse>

👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。  

食谱点赞

operateRecipeLike

引入

@ray-js/ray^1.5.5 以上版本可使用

import { operateRecipeLike } from '@ray-js/ray'

参数

OperateRecipeLikeParams 对象,包含以下属性:

属性类型默认值必填说明
likeRecipeLike点赞信息

RecipeLike

属性类型默认值必填说明
menuIdnumber食谱 Id
devIdstring设备 Id

OperateRecipeLikeResponse 返回结果

boolean

函数定义示例

/**
 * 食谱点赞
 * @param {OperateRecipeLikeParams} params - query: { menuId: number, devId: string}
 * @returns {Promise<OperateRecipeLikeResponse>} - 返回食谱点赞响应的 Promise<boolean>
 */
export function operateRecipeLike(
  params: OperateRecipeLikeParams
): Promise<OperateRecipeLikeResponse>

👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。   

  • 24
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IoT砖家涂拉拉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值