<?php

namespace App\Http\Controllers\API\H5;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;

class IntegralSaveMoneyCouponController extends Controller
{
    //获取用户基本信息和积分、优惠券、预存款信息
  public function GetInfo()
  {
    $openid =request('openid');
    $person_id =request('person_id');
    $user=DB::table('web_users')->where(['openid'=>$openid,'status'=>1,'is_del'=>0])->first();
    if(!$user) return \Yz::echoError1('openid对应用户不存在');
    $person=DB::table('web_user_person')->where(['user_id'=>$user->id,'is_del'=>0,'id'=>$person_id])->first();
    if(!$user) return \Yz::echoError1('就诊人信息查询失败');
    return \Yz::Return(true,"查询完成",[
      'person'=>$person,
      'integral'=>10,
      'save_money'=>80,
      'coupon_list'=>[
        [
          'id'=>1,
          "title"=>"新人专属",
          "date_range"=>['2024-05-01','2024-12-31'],
          'price'=>'12',
          "desc"=>"满299可用"
        ],
        [
          'id'=>2,
          "title"=>"新人专属2",
          "date_range"=>['2024-08-01','2024-11-10'],
          'price'=>'60',
          "desc"=>"满500可用"
        ]
      ],
    ]);

  }
}
