| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\common\model;
- class ActivityProductModel extends BaseModel
- {
- protected $table = 'erp_activity_product';
- protected function genSchema(array $schema)
- {
- // TODO: Implement genSchema() method.
- }
- public function product() {
- return $this->hasOne(ProductModel::class,'id','product_id');
- }
- public function doesItExist($activity_id,$product_id) {
- return $this->where([
- ["product_id", '=', $product_id],
- ["activity_id", '=', $activity_id],
- ["is_delete", '=', 0]
- ])->find();
- }
- public function fetchByProductIds(array $p_ids) {
- return $this->where([
- ['is_delete', '=', 0],
- ['product_id', 'in', $p_ids],
- ['start_time', '<=', time()],
- ['end_time', '>=', time()],
- ])->select();
- }
- }
|