| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <?php
- namespace App\Http\Controllers\Api\v1;
- use App\Http\Controllers\Api\BaseController;
- use App\Services\CityService;
- use App\Services\ConfigService;
- use App\Services\GongdengOrderService;
- use App\Services\RechargeService;
- use App\Services\RedisService;
- use App\Services\WechatService;
- /**
- * 主控制器类
- * @author wesmiler
- * @since 2020/11/10
- * Class IndexController
- * @package App\Http\Controllers
- */
- class IndexController extends BaseController
- {
- /**
- * 构造函数
- * @author wesmiler
- * @since 2020/11/11
- * IndexController constructor.
- */
- public function __construct()
- {
- parent::__construct();
- $this->gdService = new GongdengOrderService();
- $this->rechargeService = new RechargeService();
- $this->cityService = new CityService();
- }
- /**
- * 获取jssdk参数
- * @return array
- */
- public function jssdk(){
- $url = request()->get('url', '');
- $jssdkParams = WechatService::getJssdkParams($url);
- RedisService::set('caches:shares:'.date('YmdHis'), ['url'=> $url,'params'=> $jssdkParams], 600);
- return message(1005,true, $jssdkParams);
- }
- /**
- * 城市列表
- * @return array
- */
- public function city(){
- return $this->cityService->getPickerList();
- }
- /**
- * 邀请奖励参数
- * @return array
- */
- public function inviteParams(){
- $config = ConfigService::make()->getConfigByGroup(14);
- return message(1005,true, $config);
- }
- /**
- * 获取验证订单信息
- * @return array
- */
- public function orderInfo(){
- $orderSn = request()->get('order_sn');
- if(empty($orderSn)){
- return message('订单号参数错误', false);
- }
- $info = [];
- $prefix = substr($orderSn, 0,1);
- switch ($prefix){
- case 'G': // 供灯
- $info = $this->gdService->orderInfo($orderSn);
- break;
- case 'R': // 充值
- $info = $this->rechargeService->orderInfo($orderSn);
- break;
- }
- if($info){
- return message('获取订单信息', true, $info);
- }else{
- return message('获取订单信息失败', false);
- }
- }
- }
|