quanwei
2025-11-26 6ae85f8ddbae19f5586f4b0c37680fe21889ef14
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
 
namespace app\common\model\plus\point;
 
use app\common\model\BaseModel;
 
/**
 * Class Exchange
 * 积分兑换模型
 * @package app\common\model\plus\exchange
 */
class Product extends BaseModel
{
    protected $name = 'point_product';
    protected $pk = 'point_product_id';
 
 
    /**
     * 详情
     */
    public static function detail($point_product_id, $with = [])
    {
        return (new static())->with($with)->find($point_product_id);
    }
 
    /**
     *关联商品表
     */
    public function product()
    {
        return $this->belongsTo('app\\common\\model\\product\\Product', 'product_id', 'product_id');
    }
 
    /**
     *关联商品表
     */
    public function sku()
    {
        return $this->hasMany('app\\common\\model\\plus\\point\\ProductSku');
    }
 
    /**
     * 商品ID是否存在
     */
    public static function isExistProductId($productId)
    {
        return (new static)->where('product_id', '=', $productId)
            ->where('is_delete', '=', 0)
            ->value('point_product_id');
    }
}