ProductGroupSkuDao.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\common\dao\store\product;
  12. use app\common\dao\BaseDao;
  13. use app\common\model\store\product\ProductGroupSku;
  14. class ProductGroupSkuDao extends BaseDao
  15. {
  16. public function getModel(): string
  17. {
  18. return ProductGroupSku::class;
  19. }
  20. public function clear($id)
  21. {
  22. return $this->getModel()::getDB()->where('product_group_id', $id)->delete();
  23. }
  24. public function incStock($product_group_id, $unique, $inc)
  25. {
  26. return ProductGroupSku::getDB()->where('product_group_id', $product_group_id)->where('unique', $unique)->inc('stock', $inc)->update();
  27. }
  28. public function descStock($product_group_id, $unique, $inc)
  29. {
  30. return ProductGroupSku::getDB()->where('product_group_id', $product_group_id)->where('unique', $unique)->dec('stock', $inc)->update();
  31. }
  32. }