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

获取食谱列表

getRecipeList

引入

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

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

参数

GetRecipeListParams 对象,包含以下属性:

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

RecipeListQuery 包含以下属性:

属性 类型 默认值 必填 说明
productId string 产品 ID
name string 食谱名称
categoryIds number[] 分类 ID 数组
cookTimeMin number 最小烹饪时间
cookTimeMax number 最大烹饪时间
easyLevelIds number[] 难易等级 ID 数组
foodTypeIds number[] 食品类型 ID 数组
allergenIds number[] 过敏原 ID 数组
isFoodChannel number 是否为食品频道
orderType number 排序类型
pvWeight number 浏览量权重
starCountWeight number 收藏数权重
avgScoreWeight number 平均评分权重
customInfoQuery CustomInfoQueryItem[] 自定义属性查询 @ray-js/ray^1.5.5 新增
pageNo number 页码
pageSize number 每页显示数量

CustomInfoQueryItem

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

返回结果 RecipeListResponse

属性 类型 说明
totalCount number 总记录数
pageNo number 当前页码
pageSize number 每页记录数
hasNext boolean 是否有下一页
data RecipeInfo[] 食谱信息数组

RecipeInfo

属性 类型 说明
id number 食谱 ID
mainImgs string[] 主图数组
lang number 语言类型
langDesc string 语言描述
desc string 描述
cookType number 烹饪方式
sourceType number 来源类型
isMainShow number 是否主显示
isShowControl number 是否显示控制
isControl number 是否受控
name string 名称
easyLevel string 难易等级
easyLevelDesc string 难易等级描述
taste string 口味
tasteDesc string 口味描述
foodType string 食品类型
foodTypeDesc string 食品类型描述
cookTime number 烹饪时间
eatCount number 用餐人数
avgScore number 平均评分
isStar boolean 是否加星
gmtCreate number 创建时间
gmtModified number 修改时间

函数定义示例

/**
 * 获取食谱列表
 * @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 对象,包含以下属性:

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

RecipeLike

属性 类型 默认值 必填 说明
menuId number 食谱 Id
devId string 设备 Id

OperateRecipeLikeResponse 返回结果

boolean

函数定义示例

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

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

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-16 11:56:01       67 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-16 11:56:01       72 阅读
  3. 在Django里面运行非项目文件

    2024-07-16 11:56:01       58 阅读
  4. Python语言-面向对象

    2024-07-16 11:56:01       69 阅读

热门阅读

  1. AI安全入门-人工智能数据与模型安全

    2024-07-16 11:56:01       24 阅读
  2. 容器安全最佳实践和工具

    2024-07-16 11:56:01       27 阅读
  3. 小程序图片设置大小

    2024-07-16 11:56:01       22 阅读
  4. 实战:Linux下静默安装DM达梦数据库

    2024-07-16 11:56:01       28 阅读
  5. Redis中lua脚本和pipeline的区别

    2024-07-16 11:56:01       24 阅读
  6. R语言学习笔记7-列表

    2024-07-16 11:56:01       28 阅读
  7. 【设计模式】策略模式你真的掌握了吗?

    2024-07-16 11:56:01       25 阅读
  8. 奇奇怪怪构造思维题列表

    2024-07-16 11:56:01       28 阅读