@@ -231,6 +231,65 @@ private function getCookieValue($name)
231231 return $ cookies [$ name ] ?? null ;
232232 }
233233
234+ public function card ()
235+ {
236+ $ id = Request::param ('id ' );
237+ $ ticket = Request::param ('ticket ' );
238+ if (!$ id || !$ ticket ) {
239+ return Response::json (-1 , '缺少参数 ' );
240+ }
241+ $ this ->cookie = $ this ->cookie ::fromArray ([
242+ 'tgp_id ' => $ id ,
243+ 'tgp_ticket ' => $ ticket ,
244+ ], '.wegame.com.cn ' );
245+ $ response = $ this ->client ->request ('POST ' , 'https://www.wegame.com.cn/api/v1/wegame.pallas.dfm.DfmSocial/GetUserCards ' , [
246+ 'cookies ' => $ this ->cookie ,
247+ 'json ' => [
248+ 'from_src ' => '三角洲行动 ' ,
249+ ],
250+ 'headers ' => [
251+ 'referer ' => 'https://www.wegame.com.cn/helper/df/ ' ,
252+ ],
253+ ]);
254+ $ result = $ response ->getBody ()->getContents ();
255+ $ data = json_decode ($ result , true );
256+ if ($ data ['result ' ]['error_code ' ] != 0 ) {
257+ return Response::json (-1 , '获取卡牌信息失败 ' );
258+ }
259+ if ($ data ['has_drawn_today ' ]) {
260+ return Response::json (0 , '今日已抽卡 ' );
261+ }
262+ $ response = $ this ->client ->request ('POST ' , 'https://www.wegame.com.cn/api/v1/wegame.pallas.dfm.DfmSocial/DrawCard ' , [
263+ 'cookies ' => $ this ->cookie ,
264+ 'json ' => [
265+ 'from_src ' => '三角洲行动 ' ,
266+ ],
267+ 'headers ' => [
268+ 'referer ' => 'https://www.wegame.com.cn/helper/df/ ' ,
269+ ],
270+ ]);
271+ $ result = $ response ->getBody ()->getContents ();
272+ $ data = json_decode ($ result , true );
273+ if ($ data ['result ' ]['error_code ' ] != 0 ) {
274+ return Response::json (-1 , '自动抽取卡牌失败 ' );
275+ }
276+ $ response = $ this ->client ->request ('POST ' , 'https://www.wegame.com.cn/api/v1/wegame.pallas.dfm.DfmSocial/GetCardsBestCombination ' , [
277+ 'cookies ' => $ this ->cookie ,
278+ 'json ' => [
279+ 'from_src ' => '三角洲行动 ' ,
280+ ],
281+ 'headers ' => [
282+ 'referer ' => 'https://www.wegame.com.cn/helper/df/ ' ,
283+ ],
284+ ]);
285+ $ result = $ response ->getBody ()->getContents ();
286+ $ data = json_decode ($ result , true );
287+ if ($ data ['result ' ]['error_code ' ] != 0 ) {
288+ return Response::json (-1 , '获取卡牌组合失败 ' );
289+ }
290+ return Response::json (0 , '获取成功 ' , $ data ['cards ' ]);
291+ }
292+
234293 public function gift ()
235294 {
236295
@@ -404,4 +463,4 @@ private function findArrayMemberByName($array, $searchName) {
404463 }
405464 return '' ;
406465 }
407- }
466+ }
0 commit comments