AchievementAwardLogUpdateLog.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. namespace addons\Achievement\common\models;
  3. use common\enums\StatusEnum;
  4. use common\models\base\BaseActiveRecord;
  5. use common\models\mall\MallAddons;
  6. use common\models\user\User;
  7. use common\models\common\Download;
  8. use common\enums\DownloadEnum;
  9. use common\components\export\CsvTool;
  10. use Yii;
  11. /**
  12. * This is the model class for table "qimall_addons_achievement_award_log".
  13. *
  14. * @property int $id
  15. * @property int $mall_id
  16. * @property int $grant_id 发放规则日志id
  17. * @property int $user_id 用户id
  18. * @property float $achievement_sum 总业绩
  19. * @property float $team_achievement 团队业绩
  20. * @property float $personal_achievement 个人业绩
  21. * @property float $award_proportion 奖励比例
  22. * @property float $award_money 奖励金额
  23. * @property int|null $is_settlement 是否已结算打款 1:是
  24. * @property int|null $is_skip_settlement 是否不结算 0:否 1:是
  25. * @property int|null $is_end 是否结束周期:1:是
  26. * @property float|null $award_sum 奖励总计
  27. * @property int|null $parent_team 父级团长id
  28. * @property float|null $proportion_money 比例结算金额
  29. * @property float|null $actual_money 实际应该结算金额
  30. * @property int $created_at
  31. * @property int $updated_at
  32. * @property int $status 状态[-1:删除;0:禁用;1启用]
  33. */
  34. class AchievementAwardLogUpdateLog extends BaseActiveRecord
  35. {
  36. /**
  37. * {@inheritdoc}
  38. */
  39. public static function tableName()
  40. {
  41. return 'qimall_addons_achievement_award_log_update_log';
  42. }
  43. /**
  44. * {@inheritdoc}
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['mall_id', 'grant_id', 'award_id', 'created_at', 'updated_at', 'status'], 'integer'],
  50. [['before_award_money', 'after_award_money'], 'number'],
  51. ];
  52. }
  53. /**
  54. * {@inheritdoc}
  55. */
  56. public function attributeLabels()
  57. {
  58. return [
  59. 'id' => 'ID',
  60. 'mall_id' => 'Mall ID',
  61. 'grant_id' => '发放规则日志id',
  62. 'award_id' => '奖励明细id',
  63. 'before_award_money' => '修改前奖励金额',
  64. 'after_award_money' => '修改后奖励金额',
  65. 'created_at' => 'Created At',
  66. 'updated_at' => 'Updated At',
  67. 'status' => '状态[-1:删除;0:禁用;1启用]',
  68. ];
  69. }
  70. public static function setData(array $params) {
  71. try {
  72. $model = new self();
  73. $model->loadDefaultValues();
  74. if (!$model->load($params, '')) throw new \Exception($model->getErrorMessage());
  75. if (!$model->save()) throw new \Exception($model->getErrorMessage());
  76. return $model;
  77. } catch (\Exception $e) {
  78. self::$static_error = $e->getMessage();
  79. return false;
  80. }
  81. }
  82. }