收到什么信息就原样给返回去就行了啊,下面是php版例子(laravel)
<?php
/**
* 接收好友转账:收到转账事件
* {"event":"EventReceivedTransfer","robot_wxid":"wxid_5hxa04j4z6pg22","robot_name":null,"type":2000,"from_wxid":"sundreamer","from_name":"壳牌vip悠剑","final_from_wxid":"sundreamer","final_from_name":"壳牌vip悠剑","to_wxid":"wxid_5hxa04j4z6pg22","money":"0.01","msgid":null,"msg":{"is_arrived":1,"is_received":0,"money":"0.01","payer_pay_id":"100005000122052800071233317817649864","paysubtype":"1","receiver_pay_id":"1000050001202205280016242428535","remark":null,"robot_pay_id":"1000050001202205280016242428535","pay_id":"100005000122052800071233317817649864","update_msg":"receiver_pay_id、payer_pay_id属性为robot_pay_id、pay_id的新名字,内容是一样的,建议更换"}}
* @param array $request 接收的消息
* @return array
* @throws GuzzleException
*/
public function _acceptTransfer(array $request): array
{
$is_received = $request['msg']['is_received'] ?? '-1';
$paysubtype = $request['msg']['paysubtype'] ?? '-1';//1对外发 3是收款
if ($is_received == 0) {
if ($request['robot_wxid'] != $request['from_wxid'])
return [
"event" => "AcceptTransfer",
"robot_wxid" => $request['robot_wxid'],
"to_wxid" => $request['final_from_wxid'],
"member_wxid" => '',
"member_name" => '',
"group_wxid" => '',
"msg" => $request['msg']
];
} elseif ($is_received == '1' && $paysubtype == 3) {
$requ['final_from_wxid'] = $request['to_wxid'];//接收转账是机器人发出 用户接收
$requ['money'] = $request['money'] ?? 0;
Log::info("Transfer:{$requ['final_from_wxid']}-{$requ['money']}");
$param = $this->_cashMoney($requ);//把转账转化为为二维码收款程序处理
$param['robot_id'] = $this->robot_id;
SendMsgJob::enqueue($param, 0);
}
return [];
}