|
@@ -24,12 +24,15 @@ class Level extends Api
|
|
|
['level_id',0],
|
|
['level_id',0],
|
|
|
['body',''],
|
|
['body',''],
|
|
|
['pay_type',0],
|
|
['pay_type',0],
|
|
|
- ['name',''],
|
|
|
|
|
['pay_price',0],
|
|
['pay_price',0],
|
|
|
['from','weixin'],
|
|
['from','weixin'],
|
|
|
],$request
|
|
],$request
|
|
|
);
|
|
);
|
|
|
- $order = OrderLevel::order_create($where);
|
|
|
|
|
|
|
+ $where1 = $where;
|
|
|
|
|
+ unset($where1['from']);
|
|
|
|
|
+ $where1['order_id'] = OrderLevel::getNewOrderId();
|
|
|
|
|
+ $where1['createtime'] = time();
|
|
|
|
|
+ $order = OrderLevel::order_create($where1);
|
|
|
if(!$order) $this->error(OrderLevel::getErrorInfo());
|
|
if(!$order) $this->error(OrderLevel::getErrorInfo());
|
|
|
$orderId = $order['order_id'];
|
|
$orderId = $order['order_id'];
|
|
|
$info = compact('orderId');
|
|
$info = compact('orderId');
|
|
@@ -39,18 +42,18 @@ class Level extends Api
|
|
|
if ($orderInfo['paid']) $this->error('支付已支付!');
|
|
if ($orderInfo['paid']) $this->error('支付已支付!');
|
|
|
try {
|
|
try {
|
|
|
if ($where['from'] == 'routine') {
|
|
if ($where['from'] == 'routine') {
|
|
|
- $jsConfig = LevelRepository::jsPay($orderId); //创建订单jspay
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::jsPay($this->cid,$orderId); //创建订单jspay
|
|
|
} else if ($where['from'] == 'weixinh5') {
|
|
} else if ($where['from'] == 'weixinh5') {
|
|
|
- $jsConfig = LevelRepository::h5Pay($orderId);
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::h5Pay($this->cid,$orderId);
|
|
|
} else {
|
|
} else {
|
|
|
- $jsConfig = LevelRepository::wxPay($orderId);
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::wxPay($this->cid,$orderId);
|
|
|
}
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
return $this->error( $e->getMessage());
|
|
return $this->error( $e->getMessage());
|
|
|
}
|
|
}
|
|
|
$info['jsConfig'] = $jsConfig;
|
|
$info['jsConfig'] = $jsConfig;
|
|
|
|
|
|
|
|
- return $this->success('订单创建成功');
|
|
|
|
|
|
|
+ return $this->success('订单创建成功',$info);
|
|
|
|
|
|
|
|
} else $this->error(OrderLevel::getErrorInfo());
|
|
} else $this->error(OrderLevel::getErrorInfo());
|
|
|
}
|
|
}
|
|
@@ -80,7 +83,7 @@ class Level extends Api
|
|
|
['from', 'weixin']
|
|
['from', 'weixin']
|
|
|
], $request, true);
|
|
], $request, true);
|
|
|
if (!$uni) $this->error('参数错误!');
|
|
if (!$uni) $this->error('参数错误!');
|
|
|
- $order = OrderLevel::where('cid',$this->cid)->where('order_id',$uni)->find();
|
|
|
|
|
|
|
+ $order = LevelRepository::where('cid',$this->cid)->where('order_id',$uni)->find();
|
|
|
if (!$order)
|
|
if (!$order)
|
|
|
$this->error('订单不存在!');
|
|
$this->error('订单不存在!');
|
|
|
if ($order['paid'])
|
|
if ($order['paid'])
|
|
@@ -90,11 +93,11 @@ class Level extends Api
|
|
|
case '0':
|
|
case '0':
|
|
|
try {
|
|
try {
|
|
|
if ($from == 'routine') {
|
|
if ($from == 'routine') {
|
|
|
- $jsConfig = OrderLevel::jsPay($order); //订单列表发起支付
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::jsPay($this->cid,$order); //订单列表发起支付
|
|
|
} else if ($from == 'weixinh5') {
|
|
} else if ($from == 'weixinh5') {
|
|
|
- $jsConfig = OrderLevel::h5Pay($order);
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::h5Pay($this->cid,$order);
|
|
|
} else {
|
|
} else {
|
|
|
- $jsConfig = OrderLevel::wxPay($order);
|
|
|
|
|
|
|
+ $jsConfig = LevelRepository::wxPay($this->cid,$order);
|
|
|
}
|
|
}
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
$this->error($e->getMessage());
|
|
$this->error($e->getMessage());
|