<?php
namespace Payment\Red; use Payment\Common\Weixin\Data\RedData; use Payment\Common\Weixin\WxBaseStrategy; use Payment\Config; use Payment\Utils\ArrayUtil; class WxRed extends WxBaseStrategy { protected $reqUrl = 'https://api.mch.weixin.qq.com/mmpaymkttransfers/sendredpack'; public function getBuildDataClass() { return RedData::class; } protected function retData(array $ret) { if ($this->config->returnRaw) { $ret['channel'] = Config::WX_RED; return $ret; } if ($ret['return_code'] != 'SUCCESS') { return $retData = [ 'is_success' => 'F', 'error' => $ret['return_msg'], 'channel' => Config::WX_RED, ]; } if ($ret['result_code'] != 'SUCCESS') { return $retData = [ 'is_success' => 'F', 'error' => $ret['err_code_des'], 'channel' => Config::WX_RED, ]; } return $this->createBackData($ret); } protected function createBackData(array $data) { $retData = [ 'is_success' => 'T', 'response' => [ 'mch_billno' => $data['mch_billno'], 'send_listid' => $data['send_listid'], 'total_amount' => $data['total_amount'], 're_openid' => $data['re_openid'], 'wxappid' => $data['wxappid'], 'mch_id' => $data['mch_id'], 'channel' => Config::WX_RED, ], ]; return $retData; } protected function verifySign(array $retData) { return true; } }