|
@@ -75,11 +75,11 @@ class Orders extends Api{
|
|
|
// 是否在限购时间,当前时间大于开始时间,并且小于结束时间
|
|
|
if( $productInfo['quota_start'] <= $time && $time <= $productInfo['quota_end'] ){
|
|
|
// 通过时间查询商品的购买总数
|
|
|
- $total = $OrdersProduct->query()->where([['product_id','=',$productInfo['id']],['insert_time','>=',$productInfo['quota_start']],['insert_time','<=',$productInfo['quota_end']]])->sum('buy_num');
|
|
|
+ $total = $OrdersProduct->query()->where([['custom_uid','=',$uid],['product_id','=',$productInfo['id']],['insert_time','>=',$productInfo['quota_start']],['insert_time','<=',$productInfo['quota_end']]])->sum('buy_num');
|
|
|
// 判断限购数量
|
|
|
$total = $buyNum[$buyInfo['product_id']] + $total;
|
|
|
// 如果超过数量
|
|
|
- if( $total > $productInfo['quota'] ) return json_send(['code'=>'error','msg'=>$productInfo['product_name'].'已限购','data'=>['error'=>'已超限=>'.($total - $productInfo['quota'])]]);
|
|
|
+ if( $total > $productInfo['quota'] ) return json_send(['code'=>'error','msg'=>'已限购'.$productInfo['product_name'],'data'=>['error'=>'已超限=>'.($total - $productInfo['quota'])]]);
|
|
|
}
|
|
|
}
|
|
|
// 如果存在SKU
|