李帅

1.使用谷歌服务账号进行验证

......@@ -3,6 +3,7 @@
namespace App\Console\Commands;
use App\Payment\GooglePayment;
use Carbon\Carbon;
use Illuminate\Console\Command;
class DevGoogle extends Command
......@@ -38,21 +39,27 @@ class DevGoogle extends Command
*/
public function handle()
{
//
// $credentials_file = public_path().'/pc-api-7482901338487549764-603-566eccf76b91.json';
// $client = new \Google_Client();
// $client->setAuthConfig($credentials_file);
// $client->setApplicationName("Client_Library_Examples");
// $client->setScopes(
// [
// \Google_Service_AndroidPublisher::ANDROIDPUBLISHER,
// ]
// );
//
// $validator =new \Google_Service_AndroidPublisher($client);
// $resp = $validator->purchases_subscriptions->get('pub.yiyan.parlando.Parlando', 'monthly_yiyan_vip', 'aa');
// dd($resp);
$credentials_file = public_path().'/pc-api-7482901338487549764-603-566eccf76b91.json';
$client = new \Google_Client();
$client->setAuthConfig($credentials_file);
$client->setApplicationName("Client_Library_Examples");
$client->setScopes(
[
\Google_Service_AndroidPublisher::ANDROIDPUBLISHER,
]
);
$validator =new \Google_Service_AndroidPublisher($client);
$resp = $validator->purchases_subscriptions->get('pub.yiyan.parlando.Parlando', 'monthly_yiyan_vip', 'aa');
dd($resp);
$time = 1668186646527;
$startTime = 1668184557316;
echo date('Y-m-d H:i:s',$startTime/1000) . PHP_EOL;
echo date('Y-m-d H:i:s',$time/1000) . PHP_EOL;
echo Carbon::createFromTimestampMs($time)->toDateTimeString();
return 0;
}
}
......
......@@ -25,6 +25,12 @@ class Controller extends BaseController
{
$ua = request()->header('user-agent');
return 'ios';
if (strpos($ua, 'iPhone') || strpos($ua, 'iPad') || strpos($ua,'Mac OS X')) {
return 'ios';
}else if (strpos($ua, 'Android') || strpos($ua, 'android')){
return 'android';
}else{
return 'unkown';
}
}
}
......
This diff is collapsed. Click to expand it.