<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class OrderPriceModel extends Model { protected $table = 'order_price'; protected $primaryKey = 'rec_id'; public $timestamps = false; //获取订单详情 public static function getOrderPriceInfo($where) { $res = self::where($where)->first(); return ($res) ? $res->toArray() : []; } //计算订单总金额 public static function getOrderSubTotal($order_id) { return self::where("order_id",$order_id)->wherein("price_type",[1,3,5])->sum("price"); } }