文件
mashangyoujiu/Application/SmallProgramApi/Controller/ShopCouponController.class.php

111 行
3.0 KiB
PHP
可执行文件

<?php
namespace SmallProgramApi\Controller;
use Common\Business\ShopCoupon;
//[1.5.84]
/**
* 商家券类
* Class ShopCouponController
* [
* 用户的商家券列表 userShopCouponList
* 领取商家券成功后 receiveCouponCallback
* 领券的参数 grantCouponParam
* 商家券列表 couponList
* ]
* @package SmallProgramApi\Controller
*/
class ShopCouponController extends BaseController
{
//用户的商家券列表
public function userShopCouponList()
{
$data = I('post.');
$data['merchant_id'] = self::$merchant_id;
$data['xcx_id'] = self::$uid;
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->userShopCouponList($data);
$this->ajaxReturn($result);
}
//领取商家券成功后
public function receiveCouponCallback()
{
$data = I('post.');
$data['merchant_id'] = self::$merchant_id;
$data['xcx_id'] = self::$uid;
$data['openid'] = self::$openid;
$data['store_id'] = self::$store_id;
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->receiveCouponCallback($data);
$this->ajaxReturn($result);
}
//领券的参数
public function grantCouponParam()
{
$data = I('post.');
$data['xcx_id'] = self::$uid;
$data['merchant_id'] = self::$merchant_id;
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->grantCouponSign($data);
$this->ajaxReturn($result);
}
//已领取后点击商家券显示商家券详情(2020-10-13已作废)
public function shopCouponRule()
{
$coupon_id = I('post.id');
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->shopCouponRule([
'coupon_id' => $coupon_id
]);
$this->ajaxReturn($result);
}
/**
* 商家券点击立即使用
*/
public function useShopCoupon()
{
$coupon_id = I('post.id');
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->useShopCoupon([
'coupon_id' => $coupon_id
]);
$this->ajaxReturn($result);
}
/**
* 未领取的商家券详情(2020-10-13已作废)
*/
public function notReceivedCouponRule()
{
$id = I('post.id');
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->notReceivedCouponRule([
'id' => $id,
'merchant_id' => self::$merchant_id
]);
$this->ajaxReturn($result);
}
//商家券详情
public function couponInfo()
{
$id = I('post.id');
$ShopCouponClass = new ShopCoupon();
$result = $ShopCouponClass->userCoupon([
'id' => $id,
'merchant_id' => self::$merchant_id,
'xcx_id'=>self::$uid
]);
$this->ajaxReturn($result);
}
}