hasOne('\App\Models\ImsCjdcUser','id','user_id'); } public function market() { return $this->hasOne('\App\Models\ImsCjdcMarket','id','market_id'); } /** * 变更订单状态, * @param $oid //主订单id * @param $state //订单状态 */ public function modifyState($oid,$state) { $where = []; $where['state'] = $state; $where['updated_at'] = time(); if ($state==3) { $where['receive_time'] = time(); }elseif ($state==4){ $where['complete_time'] = time(); }elseif ($state==6){ $where['cancel_time'] = time(); } return self::where('id',$oid)->update($where); } public function updateShippingType($oid,$type) { return self::where('id',$oid)->update(['shipping_type'=>$type]); } }