return self::find()
            ->where(["is_del" => 0, "status" => 1])
            ->andWhere('CONCAT(",", `user_category_id`, ",") REGEXP ",('. implode('|', $categoryIds) .'),"')
            ->orderBy("weight DESC")
            ->one();

$categoryIds是一个数组,要查询表中以逗号分割的数据是否命中该数组中的任何一个元素

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2021-09-28
  • 2018-07-02
猜你喜欢
  • 2021-11-03
  • 2022-12-23
  • 2021-06-26
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案