DoubleCopyPoolSend.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace addons\DoubleCopy\common\models;
  3. use Yii;
  4. use yii\db\Exception;
  5. /**
  6. * This is the model class for table "{{%addons_double_copy_pool_send}}".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城ID
  10. * @property int $level 等级(权重)
  11. * @property float|null $total_bonus_money 本次分红总额,单位:元
  12. * @property int|null $bonus_num 分红人数
  13. * @property float|null $bonus_money 每人可得分红金额,单位:元
  14. * @property int $cycle_type 分红周期[1=日,2=周,3=月]
  15. * @property int $date 执行日期,如:20220919
  16. * @property int $status 状态[-1:删除;0:禁用;1启用]
  17. * @property int|null $created_at 创建时间
  18. * @property int|null $updated_at 更新时间
  19. * @property string $reward_currency 奖励类型:佣金-commission,积分-score
  20. */
  21. class DoubleCopyPoolSend extends \common\models\base\BaseActiveRecord
  22. {
  23. /**
  24. * {@inheritdoc}
  25. */
  26. public static function tableName()
  27. {
  28. return '{{%addons_double_copy_pool_send}}';
  29. }
  30. /**
  31. * {@inheritdoc}
  32. */
  33. public function rules()
  34. {
  35. return [
  36. [['mall_id', 'level', 'bonus_num', 'cycle_type', 'date', 'status', 'created_at', 'updated_at'], 'integer'],
  37. [['total_bonus_money', 'bonus_money'], 'number'],
  38. [['reward_currency'],'string']
  39. ];
  40. }
  41. /**
  42. * {@inheritdoc}
  43. */
  44. public function attributeLabels()
  45. {
  46. return [
  47. 'id' => 'ID',
  48. 'mall_id' => '商城ID',
  49. 'level' => '等级(权重)',
  50. 'total_bonus_money' => '本次分红总额,单位:元',
  51. 'bonus_num' => '分红人数',
  52. 'bonus_money' => '每人可得分红金额,单位:元',
  53. 'cycle_type' => '分红周期[1=日,2=周,3=月]',
  54. 'date' => '执行日期,如:20220919',
  55. 'status' => '状态[-1:删除;0:禁用;1启用]',
  56. 'created_at' => '创建时间',
  57. 'updated_at' => '更新时间',
  58. ];
  59. }
  60. /**
  61. * 生成数据
  62. * @Author: lun
  63. * @DateTime: 2022/9/19 0019 16:37
  64. * @Copyright: copyright (c) 2021 广东七件事集团
  65. * @param $params
  66. * @return array|bool
  67. */
  68. public static function create($params)
  69. {
  70. try {
  71. $model = new self();
  72. $model->loadDefaultValues();
  73. if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
  74. return $model->toArray();
  75. } catch (\Exception $e) {
  76. self::setStaticError($e->getMessage());
  77. return false;
  78. }
  79. }
  80. }