|
@@ -23,8 +23,29 @@ use Log;
|
|
|
class simple_order
|
|
|
{
|
|
|
private $info;
|
|
|
+ private $rgoods;
|
|
|
public function __construct($order_info) {
|
|
|
$this->info = $order_info;
|
|
|
+ $this->rgoods = $this->find_recommend();
|
|
|
+ }
|
|
|
+ private function find_recommend()
|
|
|
+ {
|
|
|
+ $result = null;
|
|
|
+ foreach ($this->info['order_goods'] as $good)
|
|
|
+ {
|
|
|
+ if(empty($result)) {
|
|
|
+ $result = $good;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if($result['goods_price'] < $good['goods_price']) {
|
|
|
+ $result = $good;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
}
|
|
|
public function user() {
|
|
|
return $this->info['order_info']['buyer_id'];
|
|
@@ -33,7 +54,7 @@ class simple_order
|
|
|
return $this->info['order_info']['pd_amount'];
|
|
|
}
|
|
|
public function recommend_goods() {
|
|
|
- return $this->info['order_goods'][0];
|
|
|
+ return $this->rgoods;
|
|
|
}
|
|
|
public function total() {
|
|
|
return $this->info['order_info']['order_amount'];
|