DtalkRobot.php 1014 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. namespace app\common\model;
  3. use app\common\model\BaseModel;
  4. use think\db\Query;
  5. /**
  6. * 钉钉机器人
  7. *
  8. * @Author Mark
  9. * @DateTime 2024-08-09
  10. */
  11. class DtalkRobot extends BaseModel
  12. {
  13. protected $name = 'dtalk_robot';
  14. /**
  15. * [detail]
  16. *
  17. * @Author: Yeshihao
  18. * @DateTime: 2024/8/9 17:26
  19. * @param $id
  20. * @return DtalkRobot|null
  21. * @throws \think\exception\DbException
  22. */
  23. public static function detail($id)
  24. {
  25. return static::get($id);
  26. }
  27. /**
  28. * [handlerSearch]
  29. * 搜索器
  30. * @Author: Yeshihao
  31. * @DateTime: 2024/8/9 17:26
  32. * @param Query $query
  33. * @param array $param
  34. * @return Query
  35. */
  36. public function handlerSearch(Query $query, array $param)
  37. {
  38. //应用名称
  39. if (!empty($param['name'])) {
  40. $query->where('name', 'like', "%".$param['name']."%");
  41. }
  42. return $query;
  43. }
  44. /**
  45. * 删除记录
  46. * @return int
  47. * @throws \think\Exception
  48. * @throws \think\exception\PDOException
  49. */
  50. public function setDelete()
  51. {
  52. return $this->save(['is_delete' => 1]);
  53. }
  54. }