微信公众号 订单 待发货-配送中-已收货 logic
w
function logistics_sameorder($logistics) { $arr = array(); $tmp_wxout_trade_no = ''; $w = 0; $wi = 0; $wonce = 0; foreach ($logistics as $one) { if ($wonce == 0) { $arr[$w]['wxout_trade_no'] = $one->wxout_trade_no; $arr[$w]['wtime'] = $one->wtime; $arr[$w]['comname'] = $one->comname; $arr[$w]['expressno'] = $one->expressno; $arr[$w]['receiver'] = $one->receiver; $arr[$w]['tel'] = $one->tel; $arr[$w]['province'] = $one->province; $arr[$w]['city'] = $one->city; $arr[$w]['district'] = $one->district; $arr[$w]['street'] = $one->street; $arr[$w]['goods'] = array(); $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; $tmp_wxout_trade_no = $arr[$w]['wxout_trade_no']; $wonce = 1; continue; } if ($tmp_wxout_trade_no == $one->wxout_trade_no) { $wi++; $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; } else { $w++; $wi = 0; $arr[$w]['wxout_trade_no'] = $one->wxout_trade_no; $arr[$w]['wtime'] = $one->wtime; $arr[$w]['comname'] = $one->comname; $arr[$w]['expressno'] = $one->expressno; $arr[$w]['receiver'] = $one->receiver; $arr[$w]['tel'] = $one->tel; $arr[$w]['province'] = $one->province; $arr[$w]['city'] = $one->city; $arr[$w]['district'] = $one->district; $arr[$w]['street'] = $one->street; $arr[$w]['goods'] = array(); $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; $tmp_wxout_trade_no = $arr[$w]['wxout_trade_no']; } } return $arr; }
function logistics_sameorder($logistics) { $arr = array(); $tmp_wxout_trade_no = ''; $w = 0; $wi = 0; foreach ($logistics as $one) { if ($w == 0) { $arr[$w]['wxout_trade_no'] = $one->wxout_trade_no; $arr[$w]['wtime'] = $one->wtime; $arr[$w]['comname'] = $one->comname; $arr[$w]['expressno'] = $one->expressno; $arr[$w]['receiver'] = $one->receiver; $arr[$w]['tel'] = $one->tel; $arr[$w]['province'] = $one->province; $arr[$w]['city'] = $one->city; $arr[$w]['district'] = $one->district; $arr[$w]['street'] = $one->street; $arr[$w]['goods'] = array(); $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; $tmp_wxout_trade_no = $arr[$w]['wxout_trade_no']; continue; } if ($tmp_wxout_trade_no == $one->wxout_trade_no) { $wi++; $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; } else { $w++; $wi = 0; $arr[$w]['wxout_trade_no'] = $one->wxout_trade_no; $arr[$w]['wtime'] = $one->wtime; $arr[$w]['comname'] = $one->comname; $arr[$w]['expressno'] = $one->expressno; $arr[$w]['receiver'] = $one->receiver; $arr[$w]['tel'] = $one->tel; $arr[$w]['province'] = $one->province; $arr[$w]['city'] = $one->city; $arr[$w]['district'] = $one->district; $arr[$w]['street'] = $one->street; $arr[$w]['goods'] = array(); $arr[$w]['goods'][$wi]['name'] = $one->name; $arr[$w]['goods'][$wi]['gid'] = $one->gid; $arr[$w]['goods'][$wi]['img_string'] = $one->img_string; $arr[$w]['goods'][$wi]['num'] = $one->num; $arr[$w]['goods'][$wi]['price_out'] = $one->price_out; $tmp_wxout_trade_no = $arr[$w]['wxout_trade_no']; } } return $arr; }