CloudStockBonusPoolLog.php 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <?php
  2. namespace addons\CloudStock\common\models;
  3. use common\enums\StatusEnum;
  4. use common\models\base\BaseActiveRecord;
  5. use Yii;
  6. /**
  7. * This is the model class for table "qimall_addons_cloud_stock_bonus_pool_log".
  8. *
  9. * @property int $id
  10. * @property int $mall_id 商城ID
  11. * @property int $level 分红池等级
  12. * @property int $start 开始时间
  13. * @property int $end 结束时间
  14. * @property float $money 当前分红池金额
  15. * @property float $dispatch_money 分出去金额
  16. * @property int $people 人数
  17. * @property int $is_upgrade_bag_give_goods_pool 开启云仓代理升级礼包赠送的商品计算补货盒数,关闭则不计算
  18. * @property int $is_superposition 分红池开关:每个分红池可以开启是否可以叠加分红,开启则进行叠加,关闭则不叠加
  19. * @property int $pool_settlement_type 结算类型:0:月;1:季度
  20. * @property int $status 状态[-1:删除;0:禁用;1启用]
  21. * @property int|null $created_at
  22. * @property int|null $updated_at
  23. */
  24. class CloudStockBonusPoolLog extends BaseActiveRecord
  25. {
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public static function tableName()
  30. {
  31. return '{{%addons_cloud_stock_bonus_pool_log}}';
  32. }
  33. /**
  34. * {@inheritdoc}
  35. */
  36. public function rules()
  37. {
  38. return [
  39. [['mall_id'], 'required'],
  40. [['mall_id', 'level', 'start', 'end', 'people', 'is_upgrade_bag_give_goods_pool', 'is_superposition', 'pool_settlement_type', 'status', 'created_at', 'updated_at'], 'integer'],
  41. [['money', 'dispatch_money'], 'number'],
  42. ];
  43. }
  44. /**
  45. * {@inheritdoc}
  46. */
  47. public function attributeLabels()
  48. {
  49. return [
  50. 'id' => 'ID',
  51. 'mall_id' => '商城ID',
  52. 'level' => 'level',
  53. 'start' => '开始时间',
  54. 'end' => '结束时间',
  55. 'money' => '当前分红池金额',
  56. 'dispatch_money' => '分出去金额',
  57. 'people' => '人数',
  58. 'is_upgrade_bag_give_goods_pool' => '开启云仓代理升级礼包赠送的商品计算补货盒数,关闭则不计算',
  59. 'is_superposition' => '分红池开关:每个分红池可以开启是否可以叠加分红,开启则进行叠加,关闭则不叠加',
  60. 'pool_settlement_type' => '结算类型:0:月;1:季度',
  61. 'status' => '状态[-1:删除;0:禁用;1启用]',
  62. 'created_at' => 'Created At',
  63. 'updated_at' => 'Updated At',
  64. ];
  65. }
  66. public static function create($params)
  67. {
  68. try {
  69. $model = new self();
  70. $model->loadDefaultValues();
  71. if (!$model->load($params, '') || !$model->save()) throw new \Exception($model->getErrorMessage());
  72. return $model->toArray();
  73. } catch (\Exception $e) {
  74. self::setStaticError($e->getMessage());
  75. return false;
  76. }
  77. }
  78. }