ExtendRepository.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\repositories\system;
  12. use app\common\dao\system\ExtendDao;
  13. use app\common\repositories\BaseRepository;
  14. /**
  15. * Class ExtendRepository
  16. * @package app\common\repositories\system
  17. * @author xaboy
  18. * @day 2020-04-24
  19. * @mixin ExtendDao
  20. */
  21. class ExtendRepository extends BaseRepository
  22. {
  23. const TYPE_SERVICE_USER_MARK = 'service_user_mark';
  24. /**
  25. * CacheRepository constructor.
  26. * @param ExtendDao $dao
  27. */
  28. public function __construct(ExtendDao $dao)
  29. {
  30. $this->dao = $dao;
  31. }
  32. public function updateInfo($extend_type, $link_id, $mer_id, $extend_value)
  33. {
  34. $data = compact('extend_type', 'link_id', 'mer_id');
  35. $extend = $this->getWhere($data);
  36. if ($extend) {
  37. $extend->extend_value = $extend_value;
  38. $extend->save();
  39. } else {
  40. $data['extend_value'] = $extend_value;
  41. $extend = $this->dao->create($data);
  42. }
  43. return $extend;
  44. }
  45. }