api/app/model/Order.php
2021-01-04 13:45:02 +08:00

37 lines
742 B
PHP

<?php
declare (strict_types = 1);
namespace app\model;
use think\facade\Db;
use think\Model;
use app\BaseModel;
/**
* @mixin \think\Model
*/
class Order extends BaseModel
{
//
protected $pk = 'id';
protected $table = 'orders';
private $og = null;
/**
* @param $uid
* @return \think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function queryByUid($uid)
{
$orders = $this->where('uid',$uid)->order('id','desc')->select();
return $orders;
}
public function getOrderGoods($id){
return (new OrderGoods())->goods($id);
}
}