<?php
// +----------------------------------------------------------------------
// | SentCMS [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2024 http://www.tensent.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: molong <molong@tensent.cn> <http://www.tensent.cn>
// +----------------------------------------------------------------------
namespace Modules\Wechat\Controllers\Api;

use Illuminate\Http\Request;
use Modules\Wechat\Services\PayService;
use App\Http\Controllers\BaseController;

class Pay extends BaseController {

	public function miniapp(Request $request, PayService $service){
		try {
			$this->data['data'] = $service->getPayData('miniapp', $request);
		} catch (\Exception $th) {
			$this->data['message'] = $th->getMessage();
			$this->data['code'] = $th->getCode();
		}

		return response()->json($this->data);
	}

	public function nativepc(Request $request, PayService $service){
		try {
			$this->data['data'] = $service->getNativePayData('native', $request);
		} catch (\Exception $th) {
			$this->data['message'] = $th->getMessage();
			$this->data['code'] = $th->getCode();
		}

		return response()->json($this->data);
	}
}