CouponReceive.php 646 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace app\model;
  3. use think\Model;
  4. class CouponReceive extends Model
  5. {
  6. protected $connection = 'mysql';
  7. protected $pk = 'id';
  8. protected $name = 'coupon_receive';
  9. public static function getReceiveState($coupon_id, $uid) {
  10. $State = self::where(['uid' => $uid, 'coupon_id' => $coupon_id])->find();
  11. if (!empty($State)) {
  12. $State = $State->toArray();
  13. }
  14. if (empty($State)) {
  15. $retdata['value'] = 1;
  16. $retdata['text'] = '立即领取';
  17. } else {
  18. $retdata['value'] = 0;
  19. $retdata['text'] = '已领取';
  20. }
  21. return $retdata;
  22. }
  23. }