|
@@ -80,12 +80,12 @@ class ExchangeLogic extends BaseLogic
|
|
|
->field('a.id,a.good_id,b.good_code,b.good_name,b.status,b.moq,c.id inventory_id,c.inventory')
|
|
|
->leftJoin('good b', 'b.id=a.good_id AND b.is_del=' . CommonModel::$del_normal)
|
|
|
->leftJoin('inventory_exchange c', 'c.account_id=' . self::$aid . ' AND c.good_id=a.good_id')
|
|
|
- ->where(['a.is_del' => CommonModel::$del_normal, 'a.group_id' => self::$group_id, 'good_id' => $data['good_id']])
|
|
|
+ ->where(['a.is_del' => CommonModel::$del_normal, 'a.group_id' => self::$group_id, 'a.good_id' => $data['good_id']])
|
|
|
->findOrEmpty();
|
|
|
|
|
|
if ($rs->isEmpty()) throw new Exception('该商品不存在或不允许兑换');
|
|
|
- if ($rs->status != CommonModel::$status_disable) throw new Exception('该商品已被禁用');
|
|
|
- if ($rs->moq > $data['num']) throw new Exception('不满足该商品的起订量');
|
|
|
+ if ($rs->status != CommonModel::$status_normal) throw new Exception('该商品已被禁用');
|
|
|
+ if ($rs->moq > $data['num']) throw new Exception('不满足该商品的起订量,'.$rs->moq);
|
|
|
if ($rs->inventory < $data['num']) throw new Exception('库存数不足');
|
|
|
|
|
|
$date = date('Y-m-d H:i:s');
|