This commit is contained in:
2023-03-10 16:52:48 +08:00
parent 330421fd00
commit d8ba69f9b6
4 changed files with 42 additions and 42 deletions
+35 -35
View File
@@ -82,21 +82,21 @@ class UserController extends AbstractController
// 支付测试
public function testpay(){
// 发起支付
// $out_trade_no = $this->request->input('out_trade_no');
$out_trade_no = $this->request->input('out_trade_no');
// $generator = $this->container->get(IdGeneratorInterface::class);
//
// $WechatPay = new WechatPay(1);
$WechatPay = new WechatPay(1);
//
// // 获取预支付交易会话标识
// $total = 0.01 * 100;
// $prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
// if (empty($prepay)){
// return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
// }
//
// // 获取小程序支付配置
// $pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
// return $this->response->json($pay_config);
// 获取预支付交易会话标识
$total = 0.01 * 100;
$prepay = $WechatPay->getJsapiPrepayId($out_trade_no,$total,"omgU35DlE-rxTAGgcBjOuc4xdcX8");
if (empty($prepay)){
return fail(HttpEnumCode::SERVER_ERROR, "订单创建失败");
}
// 获取小程序支付配置
$pay_config = $WechatPay->getAppletsPayConfig($prepay['prepay_id']);
return $this->response->json($pay_config);
// 发起退款
// $WechatPay = new WechatPay(1);
@@ -148,32 +148,32 @@ class UserController extends AbstractController
// $result = $friend->addFriend("123456",'1234567',"快速问诊");
// 发送消息
$arg = array();
$arg['From_Account'] = "10002"; // 发送方user_id 如系统发送,无需填写
$arg['To_Account'] = "123456"; // 接收方user_id
$arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback'];
$arg['MsgBody'] = [
[
"MsgType" => "TIMTextElem",
"MsgContent" => [
"Text" => "测试消息33",
],
]
];
// 自定义消息
$cloud_custom_data = array();
$cloud_custom_data['order_inquiry_id'] = 491963820554948608;
$cloud_custom_data['is_system'] = 0;
$arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
$result = $message->sendMessage($arg);
// $arg = array();
// $arg['From_Account'] = "10002"; // 发送方user_id 如系统发送,无需填写
// $arg['To_Account'] = "123456"; // 接收方user_id
// $arg['ForbidCallbackControl'] = ['ForbidBeforeSendMsgCallback'];
//
// $arg['MsgBody'] = [
// [
// "MsgType" => "TIMTextElem",
// "MsgContent" => [
// "Text" => "测试消息33",
// ],
// ]
// ];
//
// // 自定义消息
// $cloud_custom_data = array();
// $cloud_custom_data['order_inquiry_id'] = 491963820554948608;
// $cloud_custom_data['is_system'] = 0;
//
// $arg['CloudCustomData'] = json_encode($cloud_custom_data,JSON_UNESCAPED_UNICODE);
//
// $result = $message->sendMessage($arg);
// $result = $profile->getOneAccountPortraitList("123456");
dump($result);
// dump($result);
}