PointConfig.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. namespace addons\TinyShop\common\models\marketing;
  3. use common\behaviors\MerchantBehavior;
  4. /**
  5. * This is the model class for table "{{%addon_tiny_shop_marketing_point_config}}".
  6. *
  7. * @property int $id 主键
  8. * @property int|null $merchant_id 商户id
  9. * @property float $convert_rate 1积分对应金额
  10. * @property float|null $min_order_money 订单金额门槛
  11. * @property int|null $deduction_type 抵现金额上限
  12. * @property float|null $max_deduction_money 每笔订单最多抵扣金额
  13. * @property float|null $max_deduction_rate 每笔订单最多抵扣比率
  14. * @property string|null $explain 积分说明
  15. * @property int|null $status 状态[-1:删除;0:禁用;1启用]
  16. * @property int|null $created_at 添加时间
  17. * @property int|null $updated_at 修改时间
  18. */
  19. class PointConfig extends \common\models\base\BaseModel
  20. {
  21. use MerchantBehavior;
  22. /**
  23. * {@inheritdoc}
  24. */
  25. public static function tableName()
  26. {
  27. return '{{%addon_tiny_shop_marketing_point_config}}';
  28. }
  29. /**
  30. * {@inheritdoc}
  31. */
  32. public function rules()
  33. {
  34. return [
  35. [['merchant_id', 'deduction_type', 'status', 'created_at', 'updated_at'], 'integer'],
  36. [['min_order_money', 'max_deduction_money', 'max_deduction_rate'], 'number', 'min' => 0],
  37. [['convert_rate'], 'number', 'min' => 0.01],
  38. [['max_deduction_rate'], 'number', 'min' => 0, 'max' => 100],
  39. [['convert_rate', 'min_order_money', 'max_deduction_money', 'max_deduction_rate', 'status'], 'required'],
  40. [['explain'], 'string'],
  41. ];
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function attributeLabels()
  47. {
  48. return [
  49. 'id' => '主键',
  50. 'merchant_id' => '商户id',
  51. 'convert_rate' => '积分抵现比率',
  52. 'min_order_money' => '订单金额门槛',
  53. 'deduction_type' => '抵现金额上限',
  54. 'max_deduction_money' => '每笔订单最多抵扣金额',
  55. 'max_deduction_rate' => '每笔订单最多抵扣比率',
  56. 'status' => '积分抵现',
  57. 'explain' => '积分说明',
  58. 'created_at' => '添加时间',
  59. 'updated_at' => '修改时间',
  60. ];
  61. }
  62. /**
  63. * {@inheritdoc}
  64. */
  65. public function attributeHints()
  66. {
  67. return [
  68. 'status' => '只有启用该选项,才可以使用积分抵现功能',
  69. 'convert_rate' => '单位: 元; 积分抵现比率 1 积分可抵多少元现金',
  70. 'min_order_money' => '订单金额超出该金额可使用积分抵现',
  71. 'max_deduction_rate' => '单位: 百分比;0 - 100%',
  72. ];
  73. }
  74. }
粤ICP备19079148号