select('id, user_id, mall_id, order_no, mobile, region_name, address, pay_status, receiver_name, order_source, remark'); return $model->where(['id' => $order_id]) ->with(['detail' => function($query) { $query->select('id, order_id, num, goods_attr_id, goods_id'); }]) ->one(); } /** * 获取地址 * * @return array */ public function getRegion() { $region = $this->region_name; list($province, $city, $area, $town) = explode(' ', $region); $town = $town ?? $area; $address = $this->address; return compact('province', 'city', 'area', 'town', 'address'); } /** * 转换成普通订单 * * @return boolean */ public function changeOrder() { $this->order_source = ''; return $this->save(); } }