SystemPemDao.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\dao\system;
  12. use app\dao\BaseDao;
  13. use app\model\system\SystemPem;
  14. class SystemPemDao extends BaseDao
  15. {
  16. protected function setModel(): string
  17. {
  18. return SystemPem::class;
  19. }
  20. public function savePem($data)
  21. {
  22. $info = $this->getModel()->where('name', $data['name'])->find();
  23. if ($info) {
  24. $info = $info->toArray();
  25. $this->getModel()->where('id', $info['id'])->update($data);
  26. } else {
  27. $data['add_time'] = time();
  28. $this->getModel()->save($data);
  29. }
  30. return true;
  31. }
  32. }