Commit 22a2117c authored by 杨培's avatar 杨培

增加用户中心创建订单的接口

parent 4ac931ea
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/1/8
* Time: 18:52
*/
use internalApi\ucenter\Order;
require __DIR__.'/_init.php';
Order::setDebug();
$order = Order::create(12, '0.01', 'http://xue.yunya.com/api/pay-notify', 'xue_test', 'xue_test_123',
'学院测试订单', 'http://xue.yunya.com/home/course-info?courseId=123');
print_r($order);
\ No newline at end of file
<?php
/**
* Created by PhpStorm.
* User: pader
* Date: 2018/1/8
* Time: 18:35
*/
namespace internalApi\ucenter;
use internalApi\base\Client;
/**
* 用户中心订单服务
* @package internalApi\ucenter
*/
class Order extends Client
{
/**
* 创建订单
*
* @param int $uid 用户ID
* @param float $amount 订单金额,以元为单位,最多精确到小数点两位
* @param string $callbackUrl 支付回调地址
* @param string $prefix 商品类型前缀,每个平台不同商品如果需要细分需要明确类别前缀,比如学院的课程,则前缀标为 xue_course,依此类推
* @param string $key 商品唯一索引,每个商品唯一的索引值,建议使用 prefix_ID,如 xue_course_112345
* @param string $name 商品名称
* @param string $url 商品URL地址
* @param string $image 商品图片
* @param string $description 商品介绍
* @return array 订单信息
* @throws \internalApi\base\ApiException
*/
public static function create($uid, $amount, $callbackUrl, $prefix, $key, $name, $url, $image='', $description='')
{
return self::call('order.create', compact('uid', 'amount', 'callbackUrl', 'prefix', 'key', 'name', 'url', 'image', 'description'));
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment