12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- <?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');
- }
- public function payDetail()
- {
- return $this->hasMany(PayDetail::class, 'join_pay_order_id', 'order_groupby');
- }
- }
|