| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <?php
- namespace common\models;
- /**
- * This is the model class for table "xhOrderGoods".
- *
- * @property integer $id
- * @property string $orderId
- * @property integer $goodsId
- * @property integer $userId
- * @property integer $merchantId
- * @property string $title
- * @property string $cover
- * @property string $unitPrice
- * @property integer $num
- * @property string $createTime
- * @property string $updateTime
- */
- class xhOrderGoods extends xhBaseModel
- {
- /**
- * @inheritdoc
- */
- public static function tableName()
- {
- return 'xhOrderGoods';
- }
- /**
- * @inheritdoc
- */
- public function rules()
- {
- return [
- [['goodsId', 'userId', 'merchantId', 'num', 'multiPriceId'], 'integer'],
- [['unitPrice'], 'number'],
- [['createTime'], 'required'],
- [['createTime', 'updateTime'], 'safe'],
- [['orderId'], 'string', 'max' => 100],
- [['title', 'cover'], 'string', 'max' => 200]
- ];
- }
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'orderId' => 'Order ID',
- 'goodsId' => 'Goods ID',
- 'userId' => 'User ID',
- 'merchantId' => 'Merchant ID',
- 'title' => 'Title',
- 'cover' => 'Cover',
- 'unitPrice' => 'Unit Price',
- 'num' => 'Num',
- 'multiPriceId' => 'Multi Price Id',
- 'createTime' => 'Create Time',
- 'updateTime' => 'Update Time',
- ];
- }
- public function getXhGoods()
- {
- // 关系和商品通过 Goods.id -> goodsId 关联建立一对一关系
- return $this->hasOne(xhGoods::className(), ['id' => 'goodsId']);
- }
- }
|