MemberCoin.php 835 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * Author: 芸众商城 www.yunzshop.com
  5. * Date: 17/2/23
  6. * Time: 下午5:40
  7. */
  8. namespace app\frontend\models;
  9. use app\common\models\VirtualCoin;
  10. abstract class MemberCoin
  11. {
  12. /**
  13. * @var Member
  14. */
  15. protected $member;
  16. function __construct(\app\common\models\Member $member)
  17. {
  18. $this->member = $member;
  19. }
  20. //
  21. /**
  22. * 会员虚拟币使用限制
  23. * @return bool true 不限制 false 限制使用
  24. */
  25. public function useLimit()
  26. {
  27. return true;
  28. }
  29. /**
  30. * @return VirtualCoin $coin
  31. */
  32. abstract public function getMaxUsableCoin();
  33. abstract public function lockCoin($coin);
  34. /**
  35. * @param VirtualCoin $coin
  36. * @return bool
  37. */
  38. abstract public function consume(VirtualCoin $coin, $data);
  39. }