...
|
...
|
@@ -236,6 +236,11 @@ class Store extends Api |
|
|
}
|
|
|
unset($param['code']);
|
|
|
$order_sn = $param['order_sn'] = get_order_sn();
|
|
|
// 获取入驻支付金额
|
|
|
$pay_data = [];
|
|
|
$param['money'] = $this->house_model->whereIn('id',$param['house_ids'])->sum('price');
|
|
|
$param['status'] = 1;
|
|
|
if($param['money'] > 0) {
|
|
|
// 获取配置
|
|
|
$app = new Application(ConfigService::load());
|
|
|
$payment = $app->payment;
|
...
|
...
|
@@ -257,7 +262,9 @@ class Store extends Api |
|
|
} else {
|
|
|
$this->error($order_result['return_msg']);
|
|
|
}
|
|
|
$param['money'] = $this->house_model->whereIn('id',$param['house_ids'])->sum('price');
|
|
|
} else {
|
|
|
$param['status'] = 2;
|
|
|
}
|
|
|
Db::startTrans();
|
|
|
$result = false;
|
|
|
$result_invite = true;
|
...
|
...
|
@@ -281,7 +288,7 @@ class Store extends Api |
|
|
if(!$result || !$result_invite) {
|
|
|
$this->error('申请提交失败');
|
|
|
}
|
|
|
$this->success('申请提交成功',['id'=>$id,'pay_data'=>$pay_data]);
|
|
|
$this->success('申请提交成功',['id'=>$id,'pay_status'=>$param['status'],'pay_data'=>$pay_data]);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -964,6 +971,11 @@ class Store extends Api |
|
|
$param = (new StoreValidate())->goCheck('house_new');
|
|
|
$store = $this->get_store();
|
|
|
$order_sn = $param['order_sn'] = get_order_sn();
|
|
|
// 获取入驻支付金额
|
|
|
$pay_data = [];
|
|
|
$param['money'] = $this->house_model->whereIn('id',$param['house_ids'])->sum('price');
|
|
|
$param['status'] = 1;
|
|
|
if($param['money'] > 0) {
|
|
|
// 获取配置
|
|
|
$app = new Application(ConfigService::load());
|
|
|
$payment = $app->payment;
|
...
|
...
|
@@ -974,27 +986,37 @@ class Store extends Api |
|
|
'out_trade_no' => $order_sn,
|
|
|
'total_fee' => 1, // $param['money'] * 100
|
|
|
'spbill_create_ip' => request()->ip(), // 可选,如不传该参数,SDK 将会自动获取相应 IP 地址
|
|
|
'notify_url' => url('index/ajax/store_order_notify',[],true,true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
|
|
|
'openid' => Db::name('third')->where('user_id',$this->auth->id)->value('openid'),
|
|
|
'notify_url' => url('index/ajax/store_order_notify', [], true, true), // 支付结果通知网址,如果不设置则会使用配置里的默认地址
|
|
|
'openid' => Db::name('third')->where('user_id', $this->auth->id)->value('openid'),
|
|
|
];
|
|
|
$order = new Order($attributes);
|
|
|
$order_result = $payment->prepare($order);
|
|
|
if($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
|
|
|
if ($order_result['return_code'] == 'SUCCESS' && $order_result['result_code'] == 'SUCCESS') {
|
|
|
$prepayId = $order_result->prepay_id;
|
|
|
$pay_data = $payment->configForJSSDKPayment($prepayId);
|
|
|
} else {
|
|
|
$this->error($order_result['return_msg']);
|
|
|
}
|
|
|
$param['money'] = $this->house_model->whereIn('id',$param['house_ids'])->sum('price');
|
|
|
} else {
|
|
|
$param['status'] = 2;
|
|
|
}
|
|
|
$model = new StoreOrder();
|
|
|
Db::startTrans();
|
|
|
$result = false;
|
|
|
$result_invite = true;
|
|
|
$result_invite = $res_store = true;
|
|
|
try{
|
|
|
$param['store_id'] = $store['id'];
|
|
|
$param['user_id'] = $this->auth->id;
|
|
|
$result = $model->add($param);
|
|
|
$id = $model->id;
|
|
|
if($param['money'] == 0) {
|
|
|
// 新增关联社区
|
|
|
$update = [
|
|
|
'id' => $store['id'],
|
|
|
'house_ids' => $store['house_ids'].','.$param['house_ids']
|
|
|
];
|
|
|
$res_store = Db::name('store')->where('id',$param['store_id'])->update($update);
|
|
|
}
|
|
|
Db::commit();
|
|
|
} catch (PDOException $e) {
|
|
|
Db::rollback();
|
...
|
...
|
@@ -1003,10 +1025,10 @@ class Store extends Api |
|
|
Db::rollback();
|
|
|
$this->error($e->getMessage());
|
|
|
}
|
|
|
if(!$result || !$result_invite) {
|
|
|
if(!$result || !$result_invite || !$res_store) {
|
|
|
$this->error('提交失败');
|
|
|
}
|
|
|
$this->success('提交成功',['id'=>$id,'pay_data'=>$pay_data]);
|
|
|
$this->success('提交成功',['id'=>$id,'pay_status'=>$param['status'],'pay_data'=>$pay_data]);
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|