AllianceCouponSettleDetail.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * 厦门云联储网络科技有限公司
  4. * https://www.baokuaiyun.com
  5. * Copyright (c) 2023 爆块云 All rights reserved.
  6. */
  7. namespace app\models;
  8. /**
  9. * This is the model class for table "{{%alliance_coupon_settle_detail}}".
  10. *
  11. * @property integer $id
  12. * @property integer $store_id
  13. * @property integer $order_id
  14. * @property integer $settle_id
  15. * @property string $price
  16. * @property string $take_price
  17. * @property string $rl_rate
  18. * @property integer $order_type
  19. * @property string $created_at
  20. * @property string $updated_at
  21. */
  22. class AllianceCouponSettleDetail extends \yii\db\ActiveRecord
  23. {
  24. /**
  25. * @inheritdoc
  26. */
  27. public static function tableName()
  28. {
  29. return '{{%alliance_coupon_settle_detail}}';
  30. }
  31. /**
  32. * @inheritdoc
  33. */
  34. public function rules()
  35. {
  36. return [
  37. [[ 'store_id','order_type','settle_id', 'order_id'], 'integer'],
  38. [['price','take_price','rl_rate'], 'number'],
  39. [['updated_at', 'created_at'], 'string'],
  40. ];
  41. }
  42. public function beforeSave($insert)
  43. {
  44. if (parent::beforeSave($insert)) {
  45. if ($this->isNewRecord) {
  46. $this->created_at = date('Y-m-d H:i:s');
  47. }else{
  48. $this->updated_at = date('Y-m-d H:i:s');
  49. }
  50. return true;
  51. }
  52. return false;
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public function attributeLabels()
  58. {
  59. return [
  60. 'id' => 'ID',
  61. ];
  62. }
  63. }