| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace app\common\model;
- class TaxiOrder extends BaseModel
- {
- /**
- * @var string
- */
- protected $name = 'taxi_order';
- /**
- * @var array
- */
- protected $auto = [];
- /**
- * @var array
- */
- protected $insert = ['created_at','updated_at','dispense_at'];
- /**
- * @var array
- */
- protected $update = ['updated_at'];
- public function setDispenseAtAttr()
- {
- return time();
- }
- /**
- * @param $value
- * @return false|string
- */
- public function getCreatedAtAttr($value)
- {
- return ['val'=>$value,'text'=>date('m.d H:i', $value)];
- }
- /**
- * 关联车俩
- * @return \think\model\relation\BelongsTo
- */
- public function user()
- {
- return $this->belongsTo('Users','user_id','id');
- }
- /**
- * 关联车辆司机
- * @return \think\model\relation\BelongsTo
- */
- public function taxiUser()
- {
- return $this->belongsTo('TaxiUser','taxi_uid','id');
- }
- /**
- * 关联车俩
- * @return \think\model\relation\BelongsTo
- */
- public function taxi()
- {
- return $this->belongsTo('Taxi','taxi_id','id');
- }
- /**
- * 关联支付订单
- * @return \think\model\relation\BelongsTo
- */
- public function paylog()
- {
- return $this->belongsTo('OrderPaylog','id', 'order_idx')
- ->field('order_idx,out_trade_no,total_price,pay_type')
- ->where('is_pay', 1);
- }
- public function category()
- {
- return $this->belongsTo('\app\common\model\TaxiServiceCategory', 'category_id')
- ->field('id,name,color');
- }
- }
|