...
|
...
|
@@ -4,13 +4,6 @@ namespace Home; |
|
|
|
|
|
use LibModels\Wap\Home\OrderData;
|
|
|
use Plugin\Helpers;
|
|
|
use Configs\CacheConfig;
|
|
|
|
|
|
/*
|
|
|
* To change this license header, choose License Headers in Project Properties.
|
|
|
* To change this template file, choose Tools | Templates
|
|
|
* and open the template in the editor.
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
* Description of Order
|
...
|
...
|
@@ -18,7 +11,6 @@ use Configs\CacheConfig; |
|
|
*/
|
|
|
class OrderModel
|
|
|
{
|
|
|
/* 频道选择页取背景图片的位置码 */
|
|
|
|
|
|
const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
|
|
|
const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
|
...
|
...
|
@@ -26,12 +18,18 @@ class OrderModel |
|
|
/**
|
|
|
* 订单相关数据处理
|
|
|
*/
|
|
|
public static function getOrder($type, $page, $limit, $gender, $yh_channel, $uid) {
|
|
|
|
|
|
public static function getOrder($type, $page, $limit, $gender, $yh_channel, $uid)
|
|
|
{
|
|
|
$result = array();
|
|
|
//调用接口获得数据
|
|
|
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
|
|
|
// 判断是否还有数据, 没有数据则返回空
|
|
|
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
|
|
|
return $result;
|
|
|
}
|
|
|
//检查数据返回是否正常,正常则处理数据
|
|
|
if ($data['code'] == 200 && isset($data['data'])) {
|
|
|
if (!empty($data['data']['order_list'])) {
|
|
|
foreach ($data['data']['order_list'] as $key => $vo) {
|
|
|
//订单号,支付状态,订单商品数量,订单总价格
|
|
|
$result[$key]['orderNum'] = $vo['order_code'];
|
...
|
...
|
@@ -48,8 +46,8 @@ class OrderModel |
|
|
break;
|
|
|
}
|
|
|
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
|
|
|
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
|
|
|
*/
|
|
|
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
|
|
|
*/
|
|
|
//支付方式为非货到付款时,计算订单状态。
|
|
|
if ($vo['payment_type'] != 2) {
|
|
|
switch ($vo['status']) {
|
...
|
...
|
@@ -61,35 +59,13 @@ class OrderModel |
|
|
case 2:
|
|
|
case 3:
|
|
|
//已付款状态不给查看物流URL
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
break;
|
|
|
case 4:
|
|
|
case 5:
|
|
|
//已发货状态,给查看物流URL
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
|
|
|
break;
|
|
|
case 6:
|
|
|
$result[$key]['completed'] = true;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
} elseif ($vo['payment_type'] == 2) {
|
|
|
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
|
|
|
switch ($vo['status']) {
|
|
|
case 0:
|
|
|
case 1:
|
|
|
case 2:
|
|
|
case 3:
|
|
|
//备货中、已付款状态不给查看物流链接
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
break;
|
|
|
case 4:
|
|
|
case 5:
|
|
|
//待收货状态,给查看物流url
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
$resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据";
|
|
|
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
|
|
|
break;
|
|
|
case 6:
|
|
|
$result[$key]['completed'] = true;
|
...
|
...
|
@@ -97,6 +73,29 @@ class OrderModel |
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
|
|
|
switch ($vo['status']) {
|
|
|
case 0:
|
|
|
case 1:
|
|
|
case 2:
|
|
|
case 3:
|
|
|
//备货中、已付款状态不给查看物流链接
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
break;
|
|
|
case 4:
|
|
|
case 5:
|
|
|
//待收货状态,给查看物流url
|
|
|
$result[$key]['unreceived'] = true;
|
|
|
$result[$key]['logisticsUrl'] = Helpers::url('/home/logistic', array('order_code' => $vo['order_code']));
|
|
|
break;
|
|
|
case 6:
|
|
|
$result[$key]['completed'] = true;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
} while (false);
|
|
|
}
|
...
|
...
|
@@ -105,39 +104,67 @@ class OrderModel |
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得支付链接
|
|
|
*/
|
|
|
public static function payment($gender, $yh_channel)
|
|
|
{
|
|
|
$code = self::CODE_PAYMENT;
|
|
|
$data = OrderData::paymentData($gender, $yh_channel, $code);
|
|
|
}
|
|
|
|
|
|
|
|
|
//根据type值设置nav属性
|
|
|
static function getNavs($type) {
|
|
|
$navType = array(1=>'全部',2=>'待付款',3=>'待发货',4=>'待收货');
|
|
|
/**
|
|
|
* 查看物流
|
|
|
*
|
|
|
* @param int $orderCode 订单编号
|
|
|
* @param int $uid 用户ID
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function Logistics($orderCode, $uid)
|
|
|
{
|
|
|
$result = array();
|
|
|
|
|
|
if (isset($orderCode) && is_numeric($uid)) {
|
|
|
$logistics = OrderData::LogisticsData($orderCode, $uid);
|
|
|
if (!empty($logistics['data'])) {
|
|
|
$result['logisticUrl'] = $logistics['data']['url'];
|
|
|
$result['logisticImg'] = $logistics['data']['logo'];
|
|
|
$result['logisticCompany'] = $logistics['data']['caption'];
|
|
|
$result['logisticNumber'] = $logistics['data']['express_number'];
|
|
|
|
|
|
$build = array();
|
|
|
foreach ($logistics['data']['express_detail'] as $value) {
|
|
|
$build['status'] = $value['accept_address'];
|
|
|
$build['date'] = $value['acceptTime'];
|
|
|
$result['logisticDetail'][] = $build;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
return $result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 根据type值设置nav属性
|
|
|
*/
|
|
|
public static function getNavs($type)
|
|
|
{
|
|
|
$navType = array(1 => '全部', 2 => '待付款', 3 => '待发货', 4 => '待收货');
|
|
|
$nav = array();
|
|
|
foreach ($navType as $key => $value) {
|
|
|
$act = false;
|
|
|
if($type == $key){
|
|
|
if ($type == $key) {
|
|
|
$act = true;
|
|
|
}
|
|
|
$tmp = array(
|
|
|
'name'=>$value,
|
|
|
'typeId'=>$key,
|
|
|
'active'=>$act,
|
|
|
'url'=> Helpers::url('/home/order',array('type'=>$key))
|
|
|
$nav[] = array(
|
|
|
'name' => $value,
|
|
|
'typeId' => $key,
|
|
|
'active' => $act,
|
|
|
'url' => Helpers::url('/home/order', array('type' => $key))
|
|
|
);
|
|
|
$nav[] = $tmp;
|
|
|
}
|
|
|
|
|
|
return $nav;
|
|
|
}
|
|
|
|
|
|
|
|
|
//获得支付链接
|
|
|
static function payment($gender, $yh_channel) {
|
|
|
$code = self::CODE_PAYMENT;
|
|
|
$data = OrderData::paymentData($gender, $yh_channel, $code);
|
|
|
return $nav;
|
|
|
}
|
|
|
|
|
|
//查看物流
|
|
|
// static function Logistics(){
|
|
|
// OrderData::LogisticsData();
|
|
|
// }
|
|
|
|
|
|
} |
...
|
...
|
|