ProductCateDao.php 992 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\common\dao\store\product;
  3. use app\common\dao\BaseDao;
  4. use app\common\model\store\product\ProductCate as model;
  5. class ProductCateDao extends BaseDao
  6. {
  7. protected function getModel(): string
  8. {
  9. return model::class;
  10. }
  11. /**
  12. * @Author:Qinii
  13. * @Date: 2020/5/9
  14. * @param int $productId
  15. * @return mixed
  16. */
  17. public function clearAttr(int $productId)
  18. {
  19. return ($this->getModel())::where('product_id',$productId)->delete();
  20. }
  21. /**
  22. * @Author:Qinii
  23. * @Date: 2020/5/13
  24. * @param array $data
  25. * @return mixed
  26. */
  27. public function insert(array $data)
  28. {
  29. return ($this->getModel()::getDB())->insertAll($data);
  30. }
  31. /**
  32. * TODO 软删除商户的所有商品
  33. * @param $merId
  34. * @author Qinii
  35. * @day 5/15/21
  36. */
  37. public function clearProduct($merId)
  38. {
  39. $this->getModel()::getDb()->where('mer_id',$merId)->update(['is_del' => 1]);
  40. }
  41. }