Completed
Push — master ( c52910...66a65c )
by lyu
02:53 queued 47s
created

GoodsDetail::setGoodsName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 5
ccs 0
cts 5
cp 0
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Kaylyu\Alipay\F2fpay\Base\Model\Builder;
4
5
class GoodsDetail
6
{
7
    // 商品编号(国标)
8
    private $goodsId;
9
10
    //支付宝定义的统一商品编号
11
    private $alipayGoodsId;
12
13
    // 商品名称
14
    private $goodsName;
15
16
    // 商品数量
17
    private $quantity;
18
19
    // 商品价格,此处单位为元,精确到小数点后2位
20
    private $price;
21
22
    // 商品类别
23
    private $goodsCategory;
24
25
    // 商品详情
26
    private $body;
27
28
    private $goodsDetail = array();
29
30
    //单个商品json字符串
31
    //private $goodsDetailStr = NULL;
32
33
    //获取单个商品的json字符串
34
    public function getGoodsDetail()
35
    {
36
        return $this->goodsDetail;
37
        /*$this->goodsDetailStr = "{";
38
        foreach ($this->goodsDetail as $k => $v){
39
            $this->goodsDetailStr.= "\"".$k."\":\"".$v."\",";
40
        }
41
        $this->goodsDetailStr = substr($this->goodsDetailStr,0,-1);
42
        $this->goodsDetailStr.= "}";
43
        return $this->goodsDetailStr;*/
44
    }
45
46
    public function setGoodsId($goodsId)
47
    {
48
        $this->goodsId = $goodsId;
49
        $this->goodsDetail['goods_id'] = $goodsId;
50
    }
51
52
    public function getGoodsId()
53
    {
54
        return $this->goodsId;
55
    }
56
57
    public function setAlipayGoodsId($alipayGoodsId)
58
    {
59
        $this->alipayGoodsId = $alipayGoodsId;
60
        $this->goodsDetail['alipay_goods_id'] = $alipayGoodsId;
61
    }
62
63
    public function getAlipayGoodsId()
64
    {
65
        return $this->alipayGoodsId;
66
    }
67
68
    public function setGoodsName($goodsName)
69
    {
70
        $this->goodsName = $goodsName;
71
        $this->goodsDetail['goods_name'] = $goodsName;
72
    }
73
74
    public function getGoodsName()
75
    {
76
        return $this->goodsName;
77
    }
78
79
    public function setQuantity($quantity)
80
    {
81
        $this->quantity = $quantity;
82
        $this->goodsDetail['quantity'] = $quantity;
83
    }
84
85
    public function getQuantity()
86
    {
87
        return $this->quantity;
88
    }
89
90
    public function setPrice($price)
91
    {
92
        $this->price = $price;
93
        $this->goodsDetail['price'] = $price;
94
    }
95
96
    public function getPrice()
97
    {
98
        return $this->price;
99
    }
100
101
    public function setGoodsCategory($goodsCategory)
102
    {
103
        $this->goodsCategory = $goodsCategory;
104
        $this->goodsDetail['goods_category'] = $goodsCategory;
105
    }
106
107
    public function getGoodsCategory()
108
    {
109
        return $this->goodsCategory;
110
    }
111
112
    public function setBody($body)
113
    {
114
        $this->body = $body;
115
        $this->goodsDetail['body'] = $body;
116
    }
117
118
    public function getBody()
119
    {
120
        return $this->body;
121
    }
122
123
124
}