123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class OrderSheet extends Model
- {
- protected $table = 'order_sheet';
- protected $primaryKey = 'order_sheet_id';
- protected $dateFormat = 'U';
- const CREATED_AT = 'order_sheet_addtimes';
- const UPDATED_AT = null;
- public function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- /**
- * @Desc 关联Member
- * @Author Gorden
- * @Date 2024/3/29 9:18
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'join_sheet_member_id');
- }
- public function memberInfo()
- {
- return $this->hasOne(MemberInfo::class, 'join_info_member_id', 'join_sheet_member_id')
- ->select('join_info_member_id', 'member_info_nickname');
- }
- public function cert()
- {
- return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_sheet_member_id')
- ->select('join_cert_member_id', 'member_cert_name');
- }
- /**
- * @Desc 关联Goods
- * @Author Gorden
- * @Date 2024/3/29 9:19
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function goods()
- {
- return $this->hasOne(Goods::class, 'goods_id', 'join_sheet_goods_id');
- }
- /**
- * @Desc 关联订单
- * @Author Gorden
- * @Date 2024/3/29 9:19
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function order()
- {
- return $this->hasOne(Order::class, 'order_id', 'join_sheet_order_id');
- }
- /**
- * @Desc 发货信息
- * @Author Gorden
- * @Date 2024/4/23 15:02
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function express()
- {
- return $this->hasOne(OrderExpress::class, 'join_express_order_id', 'join_sheet_order_id');
- }
- /**
- * @Desc 退货退款
- * @Author Gorden
- * @Date 2024/4/26 10:16
- *
- * @return \Illuminate\Database\Eloquent\Relations\HasOne
- */
- public function refund()
- {
- return $this->hasOne(OrderReturn::class, 'join_return_order_id', 'join_sheet_order_id');
- }
- public function running()
- {
- return $this->hasOne(GoodsRunning::class, 'join_running_goods_id', 'join_sheet_goods_id')
- ->select('join_running_goods_id', 'goods_running_storage', 'goods_running_sale');
- }
- public function skus(){
- return $this->hasMany(GoodsSku::class,'join_sku_goods_id','join_sheet_goods_id');
- }
- public function sku()
- {
- return $this->hasOne(GoodsSku::class, 'goods_sku_id', 'join_sheet_goods_sku_id');
- }
- }
|