...
|
...
|
@@ -670,12 +670,48 @@ class OrderController extends HomeBaseController{ |
|
|
$insert['type']=2;
|
|
|
$insert['users_id']=$user_id;
|
|
|
$result=\db('order')->insert($insert);
|
|
|
if ($result==1){
|
|
|
$reutrn['order_no']=$insert['order_no'];
|
|
|
$this->apiResponse(200,'success',$reutrn);
|
|
|
}else{
|
|
|
if ($result!=1){
|
|
|
$this->apiResponse(400,'下单失败!');
|
|
|
}
|
|
|
// $order=Db::name('order')->where(['order_no'=>$order_no,'state'=>2])->find();
|
|
|
$openId=Db::name('users')->where('id',$user_id)->find()['open_id'];
|
|
|
|
|
|
$body='支付';
|
|
|
$price=$insert['price']*100;//订单价格
|
|
|
$notify_url=url('order/notify','','',true);//回调地址
|
|
|
$out_trade_no=$insert['order_no'];
|
|
|
$wxPay=new WeixinPay($openId,$out_trade_no,$body,$price,$notify_url);
|
|
|
$pay=$wxPay->pay();
|
|
|
if (isset($pay['package'])){
|
|
|
$data=[
|
|
|
'state'=>1,
|
|
|
'pay'=>$pay
|
|
|
];
|
|
|
$this->apiResponse(200,'success',$data);
|
|
|
}else{
|
|
|
$data=[
|
|
|
'state'=>0,
|
|
|
'message'=>'统一下单失败',
|
|
|
'error' => $pay
|
|
|
];
|
|
|
$this->apiResponse(200,'success',$data);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* @title 充值
|
|
|
* @description
|
|
|
* @author sgj
|
|
|
* @url /portal/order/chargeOrder
|
|
|
* @method GET
|
|
|
*
|
|
|
* @param name:fee type:String require:1 default:无 other: desc:金额
|
|
|
* @param name:user_id type:String require:1 default:无 other: desc:用户id
|
|
|
*
|
|
|
* @return order:订单号
|
|
|
*/
|
|
|
public function chargePay($order_no){
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|