CashController.php 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. <?php
  2. namespace pt\controllers;
  3. use biz\sj\classes\CashClass;
  4. use common\components\util;
  5. use Yii;
  6. class CashController extends BaseController
  7. {
  8. //提现记录 shish 2021.5.17
  9. public function actionList()
  10. {
  11. $get = Yii::$app->request->get();
  12. $status = $get['status'] ?? 0;
  13. $where = [];
  14. if (!empty($status)) {
  15. $where['status'] = $status;
  16. }
  17. $list = CashClass::getCashList($where);
  18. util::success($list);
  19. }
  20. //提现审核通过 shish 2021.5.17
  21. public function actionCheck()
  22. {
  23. util::complete();
  24. // $get = Yii::$app->request->get();
  25. // $id = isset($get['id']) ? $get['id'] : 0;
  26. // $cash = CashClass::getById($id, true);
  27. // if ($cash['status'] == 2) {
  28. // util::fail('已经完成转账,请不要重复请求!');
  29. // }
  30. // $cashAmount = isset($cash->amount) ? floatval($cash->amount) : 0;
  31. // $sjId = isset($cash->sjId) ? $cash->sjId : 0;
  32. // $admin = xhAdminToMerchantService::getAdminByMerchantId($sjId);
  33. // $time = strtotime(date("Y-m-d"));
  34. // $income = xhStatIncomeService::getByIds($sjId, $time);
  35. // $amount = isset($income['amount']) ? $income['amount'] : 0;
  36. // $merchantExtInfo = xhMerchantExtendService::getByMerchantId($sjId);//取支付宝帐号
  37. //
  38. // $asset = xhMerchantAssetService::getByMerchantId($sjId);
  39. //
  40. // if ($merchantExtInfo['alipayAccount'] == '') {
  41. // util::fail('转账接收方的支付宝帐号为空');
  42. // }
  43. // if ($cashAmount == 0) {
  44. // util::fail('转账金额为0');
  45. // }
  46. // $alipayWap = Yii::getAlias("@vendor/alipayWap");
  47. // require_once($alipayWap . '/aop/AopClient.php');
  48. // require_once($alipayWap . '/aop/request/AlipayFundTransToaccountTransferRequest.php');
  49. // require_once($alipayWap . '/config.php');
  50. //
  51. // $aop = new \AopClient();
  52. // $aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
  53. // $aop->appId = $config['app_id'];
  54. // $aop->rsaPrivateKey = $config['merchant_private_key'];
  55. // $aop->alipayrsaPublicKey = $config['alipay_public_key'];
  56. // $aop->apiVersion = '1.0';
  57. // $aop->signType = 'RSA2';
  58. // $aop->postCharset = 'UTF-8';
  59. // $aop->format = 'json';
  60. // $request = new \AlipayFundTransToaccountTransferRequest ();
  61. // $request->setBizContent("{" .
  62. // "\"out_biz_no\":\"" . $id . "\"," .
  63. // "\"payee_type\":\"ALIPAY_LOGONID\"," .
  64. // "\"payee_account\":\"" . $merchantExtInfo['alipayAccount'] . "\"," .
  65. // "\"amount\":\"" . $cashAmount . "\"," .
  66. // "\"payee_real_name\":\"" . $merchantExtInfo['alipayAccountName'] . "\"," .
  67. // "\"payer_show_name\":\"厦门中花汇信息科技有限公司\"," .
  68. // "\"remark\":\"提现申请\"" .
  69. // " }");
  70. // $result = $aop->execute($request);
  71. // $responseNode = str_replace(".", "_", $request->getApiMethodName()) . "_response";
  72. // $resultCode = $result->$responseNode->code;
  73. // $returnOrderId = $result->$responseNode->order_id;
  74. // if (!empty($resultCode) && $resultCode == 10000) {
  75. // xhDrawCashService::updateById($id, ['thirdSerialNumber' => $returnOrderId, 'status' => 1]);
  76. // $remainAmount = stringUtil::calcSub($asset['freezeBalance'], $cashAmount);
  77. // xhMerchantAssetService::updateByMerchantId($sjId, ['freezeBalance' => $remainAmount]);
  78. // /*
  79. // $openId = $admin['openId'];
  80. // $openMerchant = xhWxOpenService::getMerchant();//取平台绑定的商家
  81. // $openMerchantId = $openMerchant['id'];
  82. // $allTM = xhTMessageService::getList($openMerchantId);
  83. // $shortTempId = 'OPENTM201319876';
  84. // if(isset($allTM[$shortTempId])){
  85. // $tempId = $allTM[$shortTempId];
  86. // $data = [
  87. // "touser" => $openId,
  88. // "template_id" => $tempId,
  89. // "url" => Yii::$app->params['adminUrl'] . '/draw-cash/list',
  90. // "data" => [
  91. // "first" => ["value" => '已经完成结算。', "color" => "#173177"],
  92. // "keyword1" => ["value" => '当天', "color" => "#173177"],
  93. // "keyword2" => ["value" => $amount . '元', "color" => "#173177"],
  94. // "remark" => ["value" => "支付宝收入:{$cashAmount}元,已汇入您的帐户。\n点击查看结算记录", "color" => "#173177"]
  95. // ]
  96. // ];
  97. // wxUtil::sendTaskInform($data, $openMerchant);
  98. // }
  99. // */
  100. // xhCommonService::sendMobileMsg($admin['mobile'], "您申请的提现金额:{$cashAmount}元已经到帐,请注意查收。");
  101. // util::complete();
  102. // } else {
  103. // $msg = $result->$responseNode->msg;
  104. // $sub_code = $result->$responseNode->sub_code;
  105. // $sub_msg = $result->$responseNode->sub_msg;
  106. // Yii::info("转帐失败,原因:code:" . $resultCode . " msg:" . $msg . " sub_code:" . $sub_code . " sub_msg:" . $sub_msg);
  107. // }
  108. // util::fail('转账失败');
  109. }
  110. }