request->get(); $status = $get['status'] ?? 0; $where = []; if (!empty($status)) { $where['status'] = $status; } $list = CashClass::getCashList($where); util::success($list); } //提现审核通过 shish 2021.5.17 public function actionCheck() { $get = Yii::$app->request->get(); $id = isset($get['id']) ? $get['id'] : 0; $cash = CashClass::getById($id, true); if ($cash['status'] == 2) { util::fail('已经完成转账,请不要重复请求!'); } $cashAmount = isset($cash->amount) ? floatval($cash->amount) : 0; $sjId = isset($cash->sjId) ? $cash->sjId : 0; $admin = xhAdminToMerchantService::getAdminByMerchantId($sjId); $time = strtotime(date("Y-m-d")); $income = xhStatIncomeService::getByIds($sjId, $time); $amount = isset($income['amount']) ? $income['amount'] : 0; $merchantExtInfo = xhMerchantExtendService::getByMerchantId($sjId);//取支付宝帐号 $asset = xhMerchantAssetService::getByMerchantId($sjId); if ($merchantExtInfo['alipayAccount'] == '') { util::fail('转账接收方的支付宝帐号为空'); } if ($cashAmount == 0) { util::fail('转账金额为0'); } $alipayWap = Yii::getAlias("@vendor/alipayWap"); require_once($alipayWap . '/aop/AopClient.php'); require_once($alipayWap . '/aop/request/AlipayFundTransToaccountTransferRequest.php'); require_once($alipayWap . '/config.php'); $aop = new \AopClient(); $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do'; $aop->appId = $config['app_id']; $aop->rsaPrivateKey = $config['merchant_private_key']; $aop->alipayrsaPublicKey = $config['alipay_public_key']; $aop->apiVersion = '1.0'; $aop->signType = 'RSA2'; $aop->postCharset = 'UTF-8'; $aop->format = 'json'; $request = new \AlipayFundTransToaccountTransferRequest (); $request->setBizContent("{" . "\"out_biz_no\":\"" . $id . "\"," . "\"payee_type\":\"ALIPAY_LOGONID\"," . "\"payee_account\":\"" . $merchantExtInfo['alipayAccount'] . "\"," . "\"amount\":\"" . $cashAmount . "\"," . "\"payee_real_name\":\"" . $merchantExtInfo['alipayAccountName'] . "\"," . "\"payer_show_name\":\"厦门中花汇信息科技有限公司\"," . "\"remark\":\"提现申请\"" . " }"); $result = $aop->execute($request); $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response"; $resultCode = $result->$responseNode->code; $returnOrderId = $result->$responseNode->order_id; if (!empty($resultCode) && $resultCode == 10000) { xhDrawCashService::updateById($id, ['thirdSerialNumber' => $returnOrderId, 'status' => 1]); $remainAmount = stringUtil::calcSub($asset['freezeBalance'], $cashAmount); xhMerchantAssetService::updateByMerchantId($sjId, ['freezeBalance' => $remainAmount]); /* $openId = $admin['openId']; $openMerchant = xhWxOpenService::getMerchant();//取平台绑定的商家 $openMerchantId = $openMerchant['id']; $allTM = xhTMessageService::getList($openMerchantId); $shortTempId = 'OPENTM201319876'; if(isset($allTM[$shortTempId])){ $tempId = $allTM[$shortTempId]; $data = [ "touser" => $openId, "template_id" => $tempId, "url" => Yii::$app->params['adminUrl'] . '/draw-cash/list', "data" => [ "first" => ["value" => '已经完成结算。', "color" => "#173177"], "keyword1" => ["value" => '当天', "color" => "#173177"], "keyword2" => ["value" => $amount . '元', "color" => "#173177"], "remark" => ["value" => "支付宝收入:{$cashAmount}元,已汇入您的帐户。\n点击查看结算记录", "color" => "#173177"] ] ]; wxUtil::sendTaskInform($data, $openMerchant); } */ xhCommonService::sendMobileMsg($admin['mobile'], "您申请的提现金额:{$cashAmount}元已经到帐,请注意查收。"); util::complete(); } else { $msg = $result->$responseNode->msg; $sub_code = $result->$responseNode->sub_code; $sub_msg = $result->$responseNode->sub_msg; Yii::info("转帐失败,原因:code:" . $resultCode . " msg:" . $msg . " sub_code:" . $sub_code . " sub_msg:" . $sub_msg); } util::fail('转账失败'); } }