LuckyGroupBonusLog.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. namespace addons\LuckyGroup\common\models;
  3. use common\models\base\BaseActiveRecord;
  4. use Yii;
  5. /**
  6. * This is the model class for table "qimall_addons_lucky_group_bonus_log".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城ID
  10. * @property int $user_num 参与分红人数
  11. * @property float $money 总金额
  12. * @property float $after_money 发放后奖金池金额
  13. * @property float $user_price 人均分红
  14. * @property int $status 状态[-1:删除;0:禁用;1启用]
  15. * @property int $created_at
  16. * @property int $updated_at
  17. */
  18. class LuckyGroupBonusLog extends BaseActiveRecord
  19. {
  20. /**
  21. * {@inheritdoc}
  22. */
  23. public static function tableName()
  24. {
  25. return '{{%addons_lucky_group_bonus_log}}';
  26. }
  27. /**
  28. * {@inheritdoc}
  29. */
  30. public function rules()
  31. {
  32. return [
  33. [['mall_id', 'user_num', 'status', 'created_at', 'updated_at'], 'integer'],
  34. [['money', 'user_price', 'after_money'], 'number'],
  35. ];
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function attributeLabels()
  41. {
  42. return [
  43. 'id' => 'ID',
  44. 'mall_id' => '商城ID',
  45. 'user_num' => '参与分红人数',
  46. 'money' => '总金额',
  47. 'after_money' => '发放后奖金池金额',
  48. 'user_price' => '人均分红',
  49. 'status' => '状态[-1:删除;0:禁用;1启用]',
  50. 'created_at' => 'Created At',
  51. 'updated_at' => 'Updated At',
  52. ];
  53. }
  54. public static function setData($params)
  55. {
  56. try {
  57. $model = new self();
  58. $model->loadDefaultValues();
  59. if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
  60. if (!$model->save()) throw new \Exception($model->getErrorMessage());
  61. return $model;
  62. } catch (\Exception $e) {
  63. self::$static_error = $e->getMessage();
  64. return false;
  65. }
  66. }
  67. }