Files
chazhi_admin_parten/app/api/controller/UserCouponController.php
2026-03-14 16:20:49 +08:00

101 lines
2.7 KiB
PHP

<?php
namespace app\api\controller;
use app\api\logic\UserCouponLogic;
class UserCouponController extends BaseApiController
{
/**
* 用户优惠券
* Class TeaUser
* @package app\common\model\UserCoupon
*/
public array $notNeedLogin = [];
/**
* @notes 用户优惠券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/21 13:49
*/
public function UserCoupinList(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::getUserCoupinList($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
public function isCoupin(){
$user_id = $this->userId;
$result = UserCouponLogic::isCoupin($user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 用户订单优惠券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/10/21 13:49
*/
public function orderCoupinList(){
$data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::getOrderCoupinList($data,$user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 领取优惠券
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 14:58
* @data
*/
public function receiveCoupon(){
$data = $this->request->post();
$userId = $this->userId;
$result = UserCouponLogic::receiveCoupon($data,$userId);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserCouponLogic::getError());
}
/**
* @notes 首页领取优惠券
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/4 14:58
* @data
*/
public function shouyeCoupon(){
$userId = $this->userId;
$result = UserCouponLogic::shouyeCoupon($userId);
if($result){
return $this->success('操作成功', [], 1, 1);
}
return $this->fail(UserCouponLogic::getError());
}
/**
* @notes 个人中心发券列表
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 15:30
*/
public function coupinList(){
// $data = $this->request->post();
$user_id = $this->userId;
$result = UserCouponLogic::coupinList($user_id);
return $this->success('查询成功', $result, 1, 1);
}
/**
* @notes 脚本用户优惠券自动过期
* @return \think\response\Json
* @author 胥聪
* @date 2025/11/3 10:42
*/
public function expireCoupin(){
UserCouponLogic::expireCoupin();
}
}