CommissionIncrementLog.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. namespace common\models\common;
  3. use PHPUnit\Util\Exception;
  4. use Yii;
  5. /**
  6. * This is the model class for table "{{%commission_increment_log}}".
  7. *
  8. * @property int $id
  9. * @property int $mall_id 商城id
  10. * @property string $wallet_type 类型[commission:佣金收益]
  11. * @property int|null $enable 是否开启
  12. * @property float $radio 比例
  13. * @property float $send_num 发放数量
  14. * @property int $send_user_num 发放人数
  15. * @property int|null $status 状态[-1:删除;0:禁用;1启用]
  16. * @property int $created_at 添加时间戳
  17. * @property int $updated_at 更新时间戳
  18. */
  19. class CommissionIncrementLog extends \common\models\base\BaseActiveRecord
  20. {
  21. /**
  22. * {@inheritdoc}
  23. */
  24. public static function tableName(): string
  25. {
  26. return '{{%commission_increment_log}}';
  27. }
  28. /**
  29. * {@inheritdoc}
  30. */
  31. public function rules(): array
  32. {
  33. return [
  34. [['mall_id', 'enable', 'send_user_num', 'status', 'created_at', 'updated_at'], 'integer'],
  35. [['radio', 'send_num'], 'number'],
  36. [['wallet_type'], 'string', 'max' => 20],
  37. ];
  38. }
  39. /**
  40. * {@inheritdoc}
  41. */
  42. public function attributeLabels(): array
  43. {
  44. return [
  45. 'id' => 'ID',
  46. 'mall_id' => 'Mall ID',
  47. 'wallet_type' => 'Wallet Type',
  48. 'enable' => 'Enable',
  49. 'radio' => 'Radio',
  50. 'send_num' => 'Send Num',
  51. 'send_user_num' => 'Send User Num',
  52. 'status' => 'Status',
  53. 'created_at' => 'Created At',
  54. 'updated_at' => 'Updated At',
  55. ];
  56. }
  57. public static function setData(array $params)
  58. {
  59. try {
  60. $model = new self();
  61. $model->loadDefaultValues();
  62. if (!$model->load($params, '') || !$model->save()) throw new Exception($model->getErrorMessage());
  63. return $model;
  64. } catch (Exception $e) {
  65. self::$static_error = $e->getMessage();
  66. return false;
  67. }
  68. }
  69. }