| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- <?php
- namespace addons\Community\common\models;
- use common\models\order\Order;
- use common\models\user\User;
- use Yii;
- use yii\db\ActiveQuery;
- /**
- * This is the model class for table "qimall_addons_community_head_order".
- *
- * @property int $id 主键
- * @property int $status 状态[-1:删除;0:禁用;1启用]
- * @property int $created_at 创建时间
- * @property int $updated_at 修改时间
- * @property int $mall_id 所属商城
- * @property int $user_id 团长ID
- * @property int $head_id 自提点ID
- * @property int $order_id 订单ID
- * @property int $buyer_user_id 买家ID
- * @property int $order_status 买家ID
- * @property string $order_no 买家ID
- */
- class CommunityHeadOrder extends \common\models\base\BaseActiveRecord
- {
- /**
- * {@inheritdoc}
- */
- public static function tableName()
- {
- return 'qimall_addons_community_head_order';
- }
- /**
- * {@inheritdoc}
- */
- public function rules()
- {
- return [
- [['status', 'created_at', 'updated_at', 'mall_id', 'user_id', 'head_id', 'order_id', 'buyer_user_id', 'order_status'], 'integer'],
- [['order_no'], 'string', 'max' => 30]
- ];
- }
- /**
- * {@inheritdoc}
- */
- public function attributeLabels()
- {
- return [
- 'id' => 'ID',
- 'status' => 'Status',
- 'created_at' => 'Created At',
- 'updated_at' => 'Updated At',
- 'mall_id' => 'Mall ID',
- 'user_id' => 'User ID',
- 'head_id' => 'Head ID',
- 'order_id' => 'Order ID',
- 'buyer_user_id' => 'Buyer User ID',
- ];
- }
- /**
- * @return ActiveQuery
- */
- public function getOrder(): ActiveQuery
- {
- return $this->hasOne(Order::class, ['id' => 'order_id']);
- }
- /**
- * @return ActiveQuery
- */
- public function getHead(): ActiveQuery
- {
- return $this->hasOne(CommunityHead::class, ['id' => 'head_id']);
- }
- /**
- * @return ActiveQuery
- */
- public function getHeadUser(): ActiveQuery
- {
- return $this->hasOne(User::class, ['id' => 'user_id'])->select('id, avatar_url, mobile, nickname');
- }
- /**
- * @return ActiveQuery
- */
- public function getBuyer(): ActiveQuery
- {
- return $this->hasOne(User::class, ['id' => 'buyer_user_id'])->select('id, avatar_url, mobile, nickname');
- }
- }
|