InviteNewUsersConfig.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. namespace App\Models;
  3. class InviteNewUsersConfig extends Model
  4. {
  5. //
  6. protected $table = "invite_new_users_configs";
  7. protected $guarded = [];
  8. const CONDITION_IDCARD = 1;
  9. const CONDITION_NEW_ORDER = 2;
  10. public static $conditionMaps = [
  11. self::CONDITION_IDCARD => '实名认证',
  12. self::CONDITION_NEW_ORDER => '完成首单',
  13. ];
  14. const REPEAT_OK = 1;
  15. const REPEAT_NO = 0;
  16. public static $repeatMaps = [
  17. self::REPEAT_NO => '不可重复任务',
  18. self::REPEAT_OK => '可重复任务',
  19. ];
  20. const GIVE_CARD_OK = 1;
  21. const GIVE_CARD_NO = 0;
  22. public static $giveCardMaps = [
  23. self::GIVE_CARD_OK => '赠卡',
  24. self::GIVE_CARD_NO => '不赠卡',
  25. ];
  26. const GIVE_COUPON_OK = 1;
  27. const GIVE_COUPON_NO = 0;
  28. public static $giveCouponMaps = [
  29. self::GIVE_COUPON_NO=>'不送优惠券',
  30. self::GIVE_COUPON_OK=>'送优惠券',
  31. ];
  32. const STATUS_OK = 1;
  33. const STATUS_NO = 0;
  34. public static $statusMaps = [
  35. self::STATUS_OK => '启用',
  36. self::STATUS_NO => '停用',
  37. ];
  38. public function setDynamicItemAttribute($value){
  39. $this->attributes['dynamic_item'] = json_encode($value,true);
  40. }
  41. public function getDynamicItemAttribute($value){
  42. return json_decode($value,true);
  43. }
  44. public function areas(){
  45. return $this->belongsTo(Area::class,'area_id','id');
  46. }
  47. }