payUrl == null) { $this->payUrl = Yii::$app->params['fulinmen.payUrl']; } if ($this->merNo == null) { $this->merNo = Yii::$app->params['fulinmen.merNo']; } if ($this->secretKey == null) { $this->secretKey = Yii::$app->params['fulinmen.secretKey']; } } /** * @param array $deposit * @param array $params * @return string */ public function outPay($deposit, $params = []) { $data = []; //提交的参数 $data['version'] = '1.0'; //版本号码 $data['customerid'] = $this->merNo; //商户号码 $data['sdorderno'] = $deposit['order_sn']; //订单号码 $data['total_fee'] = sprintf("%.2f",$deposit['rmb']); //订单金额(以元为单位,保留两位小数) $data['paytype'] = 'bank'; //支付类型(网银) $data['bankcode'] = $params['bankCode']; //网银支付(额外参数:什么银行) //$data[''] = ''; //用户号 $data['notifyurl'] = $this->notifyUrl; //异步地址 $data['returnurl'] = $this->returnUrl; //同步地址 $data['sign'] = PayUtils::makeSign($data, $this->secretKey); // 签名 return self::createHtml($data, $this->payUrl); } /** * @param array $data * @return bool */ public function handleNotify($data) { if (PayUtils::checkSign($data, $this->secretKey)) { if ( isset($data['status']) && $data['status'] == "1" ) { $merOrderId = trim($data['sdorderno']); /** @var Deposit $model */ $reuslt = Deposit::find()->where(['order_sn' => $merOrderId])->asArray()->limit(1)->one(); if ($reuslt['type'] != 1) { $res = Deposit::updateAll(['type' => 1], "order_sn = $merOrderId"); $configData = Config::find()->asArray()->one(); if ($configData['auto_deposit'] == 1 && $res) { $syncDespositModel = new SyncDesposit(); $syncDespositModel->login = $reuslt['login']; $syncDespositModel->amount = $reuslt['amount']; $syncDespositModel->comment = 'Deposit'; $syncDespositModel->memo = $merOrderId; $syncDespositModel->type = 2; $syncDespositModel->in_time = time(); $syncDespositModel->save(); } } return true; } } return false; } public function outNotify($success) { if ($success == true) { return "success"; } else { return "FAIL"; } } /** * @param array $data * @return bool */ public function handleReturn($data) { if (PayUtils::checkSign($data, $this->secretKey)) { if (isset($data['status']) && $data['status'] == "1") { $merOrderId = trim($data['sdorderno']); /** @var Deposit $model */ $model = Deposit::find()->where(['id' => $merOrderId])->asArray()->limit(1)->one(); if ($model) { return true; } } } return false; } public function outReturn($success) { } }