Product.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. namespace frontend\models;
  3. use Yii;
  4. /**
  5. * This is the model class for table "bit_article".
  6. *
  7. * @property integer $id
  8. * @property string $create_date
  9. * @property string $modify_date
  10. * @property string $author
  11. * @property string $content
  12. * @property integer $down
  13. * @property integer $hits
  14. * @property string $image_path
  15. * @property boolean $is_publication
  16. * @property boolean $is_recommend
  17. * @property boolean $is_top
  18. * @property string $link_url
  19. * @property string $meta_description
  20. * @property string $meta_keywords
  21. * @property string $min_content
  22. * @property string $sub_title
  23. * @property string $title
  24. * @property integer $up
  25. * @property integer $article_category_id
  26. * @property string $createdatea
  27. * @property string $modifydatea
  28. * @property string $meta_imge
  29. */
  30. class Product extends \yii\db\ActiveRecord
  31. {
  32. /**
  33. * @inheritdoc
  34. */
  35. public static function tableName()
  36. {
  37. return 'bit_product';
  38. }
  39. public static function getDb()
  40. {
  41. return Yii::$app->get('dbXcoq');
  42. }
  43. /**
  44. * @inheritdoc
  45. */
  46. public function rules()
  47. {
  48. return [
  49. [['c_time','m_time','is_del'],'safe'],
  50. [['category_id','name','name1','name2','tradetype','tradecode','contract','deposit','commission','interest','min_amplitude','price','min_trade','max_trade','trade_time','trade_time1','trade_time2','settlement_time','settlement_time1','settlement_time2','limit_line','limit_line1','limit_line2','lock_deposit','lock_deposit1','lock_deposit2','unit','unit1','unit2'],'required'],
  51. [['name','name1','name2','tradecode'],'unique'],
  52. ];
  53. }
  54. /**
  55. * @inheritdoc
  56. */
  57. public function attributeLabels()
  58. {
  59. return [
  60. 'id' => 'ID',
  61. 'category_id' => 'category_id',
  62. 'name' => 'name',
  63. 'name1' => 'name1',
  64. 'name2' => 'name2',
  65. 'tradetype' => 'tradetype',
  66. 'tradecode' => 'tradecode',
  67. 'contract' => 'contract',
  68. 'deposit' => 'deposit',
  69. 'commission' => 'commission',
  70. 'interest' => 'interest',
  71. 'min_amplitude' => 'min_amplitude',
  72. 'price' => 'price',
  73. 'min_trade' => 'min_trade',
  74. 'max_trade' => 'max_trade',
  75. 'trade_time' => 'trade_time',
  76. 'trade_time1' => 'trade_time1',
  77. 'trade_time2' => 'trade_time2',
  78. 'settlement_time' => 'settlement_time',
  79. 'settlement_time1' => 'settlement_time1',
  80. 'settlement_time2' => 'settlement_time2',
  81. 'limit_line' => 'limit_line',
  82. 'limit_line1' => 'limit_line1',
  83. 'limit_line2' => 'limit_line2',
  84. 'lock_deposit' => 'lock_deposit',
  85. 'lock_deposit1' => 'lock_deposit1',
  86. 'lock_deposit2' => 'lock_deposit2',
  87. 'unit' => 'unit',
  88. 'unit1' => 'unit1',
  89. 'unit2' => 'unit2',
  90. 'c_time' => 'c_time',
  91. 'm_time' => 'm_time',
  92. 'is_del' => 'is_del',
  93. ];
  94. }
  95. // 关联
  96. public function getCategory()
  97. {
  98. return $this->hasOne(ProductCategory::className(), ['id' => 'category_id']);
  99. }
  100. }