Blame view

library/LibModels/Wap/Home/OrderData.php 4.59 KB
1 2 3 4 5 6
<?php

namespace LibModels\Wap\Home;

use Api\Yohobuy;
use Api\Sign;
7
8
/**
9 10
 * 订单相关的数据模型
 * 
11 12 13 14
 */
class OrderData
{
    /*
15 16
     * 获取订单数据
     */
17
18
    public static function getOrderData($type, $page, $limit, $gender, $channel, $uid)
19
    {
20
        //构建必传参数
21 22 23 24 25 26 27
        $param = Yohobuy::param();
        $param['gender'] = $gender;
        $param['limit'] = $limit;
        $param['method'] = 'app.SpaceOrders.get';
        $param['page'] = $page;
        $param['type'] = $type;
        $param['uid'] = $uid;
28
        $param['yh_channel'] = $channel;
29
        $param['client_secret'] = Sign::getSign($param);
30
        //调用接口获得数据
yangyang authored
31
        return Yohobuy::get(Yohobuy::API_URL, $param);
32
    }
33
34 35 36
    /*
     * 取消订单
     */
37
38
    public static function cancelOrderData($orderCode, $uid, $gender, $channel)
39
    {
40
        //构建必传参数
41
        $param = Yohobuy::param();
42
        $param['order_code'] = $orderCode;
43 44
        $param['uid'] = $uid;
        $param['gender'] = $gender;
45
        $param['yh_channel'] = $channel;
46
        $param['method'] = 'app.SpaceOrders.close';
47
        $param['client_secret'] = Sign::getSign($param);
48
        //调用接口获得数据
49 50 51 52 53 54
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }

    /*
     * 删除订单
     */
55
56
    public static function deleteOrderData($orderCode, $uid, $gender, $channel)
57
    {
58
        //构建必传参数
59
        $param = Yohobuy::param();
60
        $param['order_code'] = $orderCode;
61 62
        $param['uid'] = $uid;
        $param['gender'] = $gender;
63
        $param['yh_channel'] = $channel;
64
        $param['method'] = 'app.SpaceOrders.delOrderByCode';
65
        $param['client_secret'] = Sign::getSign($param);
66
        //调用接口删除订单
67 68
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }
69
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    /**
     * 查看订单详情
     * 
     * @param string $orderCode 订单号
     * @param int $uid 用户ID
     * @param string $sessionKey 用户会话
     * @return array
     */
    public static function viewOrderData($orderCode, $uid, $sessionKey)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.SpaceOrders.info';
        $param['order_code'] = $orderCode;
        $param['uid'] = $uid;
        $param['session_key'] = $sessionKey;
        $param['client_secret'] = Sign::getSign($param);
86
87 88
        return Yohobuy::get(Yohobuy::API_URL, $param);
    }
89
yangyang authored
90
    /*
91
     * 我的订单-查看物流
92 93 94 95
     * 
     * @param int $orderCode 订单号
     * @param int $uid 用户ID
     * @return array
yangyang authored
96
     */
97
98
    public static function LogisticsData($orderCode, $uid)
99
    {
100 101 102
        //构建必传参数
        $param = Yohobuy::param();
        $param['method'] = 'app.express.li';
103 104
        $param['order_code'] = $orderCode;
        $param['uid'] = $uid;
105 106
        $param['client_secret'] = Sign::getSign($param);
        //调用接口获得数据
107
        return Yohobuy::get(Yohobuy::API_URL, $param);
108 109 110
    }

    /*
111
     * 支付页面的资源位
112
     */
113
    
114
    public static function paymentData($gender, $yh_channel, $code)
115
    {
116
        //构建必传参数
yangyang authored
117
        $param = Yohobuy::param();
118
        $param['content_code'] = $code;
yangyang authored
119 120 121
        $param['gender'] = $gender;
        $param['yh_channel'] = $yh_channel;
        $param['client_secret'] = Sign::getSign($param);
122 123 124 125 126
        //调用接口获得数据
        return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
    }

    /*
127 128 129
     * 随便逛逛url
     * 
     * 备注:暂不使用
130
     */
131
132
    public static function strollData($gender, $yh_channel, $code)
133
    {
134 135 136 137 138 139 140
        //构建必传参数
        $param = Yohobuy::param();
        $param['content_code'] = $code;
        $param['gender'] = $gender;
        $param['yh_channel'] = $yh_channel;
        $param['client_secret'] = Sign::getSign($param);
        //调用接口获得数据
yangyang authored
141 142
        return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
    }
143 144 145 146 147 148 149 150
    
    /**
     * 更新订单的支付方式
     * 
     * @param int $orderCode 订单号
     * @param int $payment 支付方式
     * @param int $uid 用户ID
     * @return array
151
     */
152
    public static function updateOrderPayment($orderCode, $payment, $uid)
153
    {
154 155 156 157 158 159
        // 构建必传参数
        $param = Yohobuy::param();
        $param['method'] = 'app.SpaceOrders.updateOrdersPaymentByCode';
        $param['order_code'] = (int) $orderCode;
        $param['payment'] = $payment;
        $param['uid'] = $uid;
160
        $param['client_secret'] = Sign::getSign($param);
161 162 163
        
        // 调用接口获得数据
        return Yohobuy::post(Yohobuy::API_URL, $param);
164
    }
yangyang authored
165
166
}