123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- <?php
- namespace app\model;
- use DateTimeInterface;
- use support\Model;
- class Order extends Model
- {
- protected $table = 'order';
- protected $primaryKey = 'order_id';
- protected $keyType = 'string';
- protected $dateFormat = 'U';
- const CREATED_AT = 'order_addtimes';
- const UPDATED_AT = null;
- const AUTOMATIC_RECEIPT_PREFIX = 'ORDER:AUTOMATIC:RECEIPT:';
- const AUTOMATIC_COMPLETE_PREFIX = 'ORDER:AUTOMATIC:COMPLETE:';
- public function serializeDate(DateTimeInterface $date)
- {
- return $date->format('Y-m-d H:i:s');
- }
- public function sheet()
- {
- return $this->hasOne(OrderSheet::class, 'join_sheet_order_id', 'order_id');
- }
- public function sheets()
- {
- return $this->hasMany(OrderSheet::class, 'join_sheet_order_id', 'order_id');
- }
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'join_order_member_id');
- }
- public function cert()
- {
- return $this->hasOne(MemberCert::class, 'join_cert_member_id', 'join_order_member_id');
- }
- public function return()
- {
- return $this->hasOne(OrderReturn::class, 'join_return_order_id', 'order_id');
- }
- public function express(){
- return $this->hasOne(OrderExpress::class, 'join_express_order_id','order_id');
- }
- public function benefit(){
- return $this->hasMany(MemberBenefit::class,'join_benefit_order_id','order_id');
- }
- }
|