DecoratePageLogic.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\logic\decorate;
  15. use app\common\logic\BaseLogic;
  16. use app\common\model\decorate\DecoratePage;
  17. /**
  18. * 装修页面
  19. * Class DecoratePageLogic
  20. * @package app\adminapi\logic\theme
  21. */
  22. class DecoratePageLogic extends BaseLogic
  23. {
  24. /**
  25. * @notes 获取详情
  26. * @param $id
  27. * @return array
  28. * @author 段誉
  29. * @date 2022/9/14 18:41
  30. */
  31. public static function getDetail($id)
  32. {
  33. return DecoratePage::findOrEmpty($id)->toArray();
  34. }
  35. /**
  36. * @notes 保存装修配置
  37. * @param $params
  38. * @return bool
  39. * @author 段誉
  40. * @date 2022/9/15 9:37
  41. */
  42. public static function save($params)
  43. {
  44. $pageData = DecoratePage::where(['id' => $params['id']])->findOrEmpty();
  45. if ($pageData->isEmpty()) {
  46. self::$error = '信息不存在';
  47. return false;
  48. }
  49. DecoratePage::update([
  50. 'id' => $params['id'],
  51. 'type' => $params['type'],
  52. 'data' => $params['data'],
  53. 'meta' => $params['meta'] ?? '',
  54. ]);
  55. return true;
  56. }
  57. }