ActivityProductModel.php 537 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace app\common\model;
  3. class ActivityProductModel extends BaseModel
  4. {
  5. protected $table = 'erp_activity_product';
  6. protected function genSchema(array $schema)
  7. {
  8. // TODO: Implement genSchema() method.
  9. }
  10. public function product() {
  11. return $this->hasOne(ProductModel::class,'id','product_id');
  12. }
  13. public function doesItExist($product_id) {
  14. return $this->where([
  15. ["product_id", '=', $product_id],
  16. ["is_delete", '=', 0]
  17. ])->find();
  18. }
  19. }