22
33namespace Mitoop \Yzh ;
44
5+ use Illuminate \Support \Collection ;
6+ use Yzh \Model \Apiusersign \ApiUserSignContractResponseData ;
7+ use Yzh \Model \Apiusersign \ApiUserSignReleaseResponseData ;
8+ use Yzh \Model \Apiusersign \ApiUserSignResponseData ;
59use Yzh \Model \BaseResponse ;
10+ use Yzh \Model \Payment \CreateAlipayOrderResponseData ;
11+ use Yzh \Model \Payment \CreateBankpayOrderResponseData ;
612
713class Response
814{
@@ -18,9 +24,40 @@ public function ok(): bool
1824 return $ this ->status ;
1925 }
2026
21- public function data (): mixed
27+ public function data (): Collection
2228 {
23- return $ this ->response ?->getData();
29+ if ($ response = $ this ->response ) {
30+ $ data = $ response ->getData ();
31+
32+ if ($ data instanceof ApiUserSignContractResponseData) {
33+ return collect ([
34+ 'title ' => $ data ->getTitle (), // 协议名称
35+ 'url ' => $ data ->getUrl (), // 预览跳转 URL
36+ ]);
37+ }
38+
39+ if ($ data instanceof ApiUserSignResponseData) {
40+ return collect ([
41+ 'status ' => $ data ->getStatus (), // 是否签约成功
42+ ]);
43+ }
44+
45+ if ($ data instanceof ApiUserSignReleaseResponseData) {
46+ return collect ([
47+ 'status ' => $ data ->getStatus (), // 是否解约成功
48+ ]);
49+ }
50+
51+ if ($ data instanceof CreateBankpayOrderResponseData || $ data instanceof CreateAlipayOrderResponseData) {
52+ return collect ([
53+ 'order_id ' => $ data ->getOrderId (), // 平台企业订单号
54+ 'pay ' => $ data ->getPay (), // 订单金额
55+ 'ref ' => $ data ->getRef (), // 综合服务平台流水号
56+ ]);
57+ }
58+ }
59+
60+ return collect ();
2461 }
2562
2663 public function error (): string
0 commit comments