thinkphp查询当天购买特定商品的订单数量

代码如下

// <!--查询当前用户在当天购买特定商品的订单数量

$GoodsOrder = M('goods_order');

$t_start=strtotime(date("Y-m-d 00:00:01"));

$t_end =strtotime(date("Y-m-d 23:59:59"));

$mapGo['add_time'] = array(array('egt',$t_start),array('elt',$t_end));

$mapGo['userid'] = session('user.id');

$mapGo['gid'] = $data['gid'];

$buyGoodNum = $GoodsOrder->where($mapGo)->count();