AgreementDao.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 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\other;
  12. use app\dao\BaseDao;
  13. use app\model\other\Agreement;
  14. /**
  15. * Class AgreementDao
  16. * @package app\dao\other
  17. */
  18. class AgreementDao extends BaseDao
  19. {
  20. /**
  21. * @return string
  22. */
  23. public function setModel(): string
  24. {
  25. return Agreement::class;
  26. }
  27. /**
  28. * 修改协议内容
  29. * @param array $agreement
  30. * @param int $id
  31. * @return bool|\crmeb\basic\BaseModel
  32. */
  33. public function saveAgreement(array $agreement, int $id = 0)
  34. {
  35. if (!$agreement) return false;
  36. $agreement['add_time'] = time();
  37. if($id){
  38. return $this->getModel()->update($agreement,['id' => $id]);
  39. }
  40. return $this->getModel()->save($agreement);
  41. }
  42. }