|
|
@@ -5,12 +5,10 @@ namespace mall\controllers;
|
|
|
use bizHd\custom\classes\CustomClass;
|
|
|
use bizMall\px\classes\PxApplyClass;
|
|
|
use bizMall\px\classes\PxClassClass;
|
|
|
-use bizMall\wx\classes\WxOpenClass;
|
|
|
use common\components\dict;
|
|
|
-use common\components\httpUtil;
|
|
|
use common\components\util;
|
|
|
use Yii;
|
|
|
-use bizMall\promote\services\CouponService;
|
|
|
+use bizHd\wx\classes\WxOpenClass;
|
|
|
|
|
|
/**
|
|
|
* 培训报名
|
|
|
@@ -56,35 +54,20 @@ class PxApplyController extends BaseController
|
|
|
|
|
|
public function actionWxPay()
|
|
|
{
|
|
|
- $data = [
|
|
|
- "appId" => "wx21b7c3ef12082099",
|
|
|
- "nonceStr" => "i7f1e9z6ls42f3342m4j2bngxj6rq08e",
|
|
|
- "package" => "prepay_id=wx042304351179687ee46ee32d8ecf420000",
|
|
|
- "signType" => "MD5",
|
|
|
- "timeStamp" => "1612451097",
|
|
|
- "paySign" => "39FD249CD03B24FDA1755493F09D7C2E",
|
|
|
- ];
|
|
|
- util::success($data);
|
|
|
-
|
|
|
ini_set('date.timezone', 'Asia/Shanghai');
|
|
|
$post = Yii::$app->request->post();
|
|
|
- $orderSn = isset($post['orderSn']) ? $post['orderSn'] : 0;
|
|
|
- $couponId = isset($post['couponId']) ? $post['couponId'] : 0;
|
|
|
-
|
|
|
+ $orderSn = $post['orderSn'] ?? 0;
|
|
|
+ $couponId = 0;
|
|
|
$order = PxApplyClass::getByCondition(['customId' => $this->customId, 'orderSn' => $orderSn, 'status' => PxApplyClass::STATUS_UN_CONFIRM]);
|
|
|
if (empty($order)) {
|
|
|
util::fail('订单号无效');
|
|
|
}
|
|
|
$name = $orderSn;
|
|
|
$totalFee = $order['actPrice'];
|
|
|
- $wxPayType = 0;
|
|
|
- //小程序使用miniOpenId
|
|
|
- if (httpUtil::isMiniProgram()) {
|
|
|
- $openId = $this->user['miniOpenId'];
|
|
|
- $wxPayType = 1;
|
|
|
- } else {
|
|
|
- $openId = $this->user['openId'];
|
|
|
- }
|
|
|
+
|
|
|
+ //强制使用小程序miniOpenId,不再考虑web
|
|
|
+ $openId = $this->user['miniOpenId'];
|
|
|
+ $wxPayType = 1;
|
|
|
|
|
|
$typeList = dict::getConfig('capitalType');
|
|
|
$capitalType = $typeList['pxApply']['id'];
|
|
|
@@ -106,19 +89,10 @@ class PxApplyController extends BaseController
|
|
|
$input->SetTime_expire(date("YmdHis", $expireTime));
|
|
|
$input->SetNotify_url(Yii::$app->params['mallHost'] . '/notice/wx-callback/');
|
|
|
$input->SetTrade_type("JSAPI");
|
|
|
+ $input->SetOpenid($openId);
|
|
|
|
|
|
- //花卉宝代为申请的微信支付
|
|
|
- $sjExtend = $this->sjExtend;
|
|
|
- if ($sjExtend['wxPayApply'] == 1) {
|
|
|
- $input->SetSub_openid($openId);
|
|
|
- } else {
|
|
|
- $input->SetOpenid($openId);
|
|
|
- }
|
|
|
-
|
|
|
- //小程序使用miniAppId
|
|
|
- if (httpUtil::isMiniProgram()) {
|
|
|
- $sjExtend['wxAppId'] = $sjExtend['miniAppId'];
|
|
|
- }
|
|
|
+ $sjExtend = WxOpenClass::getMallWxInfo();
|
|
|
+ $sjExtend['wxAppId'] = $sjExtend['miniAppId'];
|
|
|
|
|
|
$wxOrder = \WxPayApi::unifiedOrder($input, 6, $sjExtend);
|
|
|
$tools = new \JsApiPay();
|
|
|
@@ -126,4 +100,5 @@ class PxApplyController extends BaseController
|
|
|
$newParams = json_decode($jsApiParameters, true);
|
|
|
util::success($newParams);
|
|
|
}
|
|
|
+
|
|
|
}
|