Update Order.php

This commit is contained in:
邹景立 2021-07-07 19:02:36 +08:00
parent 00a6a146d0
commit 31d04d2932

View File

@ -82,7 +82,7 @@ class Order extends Auth
// 限制购买数量
if (isset($goods['limit_max_num']) && $goods['limit_max_num'] > 0) {
$map = [['a.uuid', '=', $this->uuid], ['a.status', 'in', [2, 3, 4, 5]], ['b.goods_code', '=', $goods['code']]];
$buys = $this->app->db->name('DataOrder')->alias('a')->join('store_order_item b', 'a.order_no=b.order_no')->where($map)->sum('b.stock_sales');
$buys = $this->app->db->name('ShopOrderr')->alias('a')->join('store_order_item b', 'a.order_no=b.order_no')->where($map)->sum('b.stock_sales');
if ($buys + $count > $goods['limit_max_num']) $this->error('超过限购数量');
}
// 限制购买身份