edit-api-create_order
This commit is contained in:
@@ -11,10 +11,21 @@ require_once APPPATH . 'controllers/wxapp/Wxapp.php';
|
||||
require_once COMMPATH.'libraries/WechatPayV3.php';
|
||||
class Payment extends Wxapp{
|
||||
|
||||
private $type_array = [
|
||||
3 => '定金',
|
||||
4 => '定金',
|
||||
5 => '委托服务费',
|
||||
6 => '尾款',
|
||||
];
|
||||
|
||||
public function __construct($inputs, $app_key){
|
||||
parent::__construct($inputs, $app_key);
|
||||
|
||||
$this->load->model('apporder/order_purchase_model');
|
||||
$this->load->model('receiver/order/receiver_orders_model','orders_model');
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
$this->load->model("sys/sys_company_model");
|
||||
|
||||
$this->uid = $this->session['uid'];
|
||||
}
|
||||
@@ -38,7 +49,16 @@ class Payment extends Wxapp{
|
||||
if($this->uid<=10){
|
||||
$row['total_price'] = 0.01;
|
||||
}
|
||||
|
||||
if($row['app_id']==1){ //狸车
|
||||
$order_row = $this->orders_model->get(['id'=>$row['item_id']],'name,brand_id,s_id');
|
||||
$brand_row = $this->auto_brand_model->get(['id'=>$order_row['brand_id']],'name');
|
||||
$s_row = $this->auto_series_model->get(['id'=>$order_row['s_id']],'name');
|
||||
$company_row = $this->sys_company_model->get(['wx_mchid'=>$row['mch_id']],'title');
|
||||
$type_name = $this->type_array[$row['type']];
|
||||
$description = "{$brand_row['name']}{$s_row['name']}-{$order_row['name']}-{$company_row['title']}-{$type_name}";
|
||||
}else{
|
||||
$description = $row['item_title'];
|
||||
}
|
||||
$this->config->load('wxpay');
|
||||
$wx_config = $this->config->item('default');
|
||||
$params = [
|
||||
@@ -48,13 +68,12 @@ class Payment extends Wxapp{
|
||||
'wechatpayCertificate' => $wx_config['wechatpayCertificate'],
|
||||
];
|
||||
$WechatPayV3 = new WechatPayV3($params);
|
||||
$n_time = time();
|
||||
$json = [
|
||||
'sp_appid' => $wx_config['appid'],
|
||||
'sp_mchid' => $wx_config['mchid'],
|
||||
'sub_appid' => $wx_config['sub_appid'],
|
||||
'sub_mchid' => $row['mch_id'],
|
||||
'description' => $row['item_title'],
|
||||
'description' => $description,
|
||||
'out_trade_no' => $row['sid'],
|
||||
'notify_url' => $notify_url,
|
||||
'settle_info' => [
|
||||
|
||||
Reference in New Issue
Block a user