mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-30 06:20:50 +00:00
删除无用代码
This commit is contained in:
parent
4961dca45f
commit
1b6ce633ec
@ -85,6 +85,9 @@ class LuckLottery extends AuthController
|
||||
/**
|
||||
* 添加抽奖
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
|
||||
@ -102,7 +102,11 @@ class LuckLotteryController
|
||||
/**
|
||||
* 领取奖品
|
||||
* @param Request $request
|
||||
* @param LuckLotteryRecordServices $lotteryRecordServices
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function lotteryReceive(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
|
||||
{
|
||||
@ -125,6 +129,9 @@ class LuckLotteryController
|
||||
* @param Request $request
|
||||
* @param LuckLotteryRecordServices $lotteryRecordServices
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function lotteryRecord(Request $request, LuckLotteryRecordServices $lotteryRecordServices)
|
||||
{
|
||||
|
||||
@ -365,30 +365,13 @@ class StoreCouponIssueServices extends BaseServices
|
||||
$issueCouponInfo = $this->dao->getInfo((int)$id);
|
||||
$uid = $user->uid;
|
||||
if (!$issueCouponInfo) throw new ApiException(400516);
|
||||
/** @var MemberRightServices $memberRightService */
|
||||
$memberRightService = app()->make(MemberRightServices::class);
|
||||
if ($issueCouponInfo->receive_type == 4 && (!$user->is_money_level || !$memberRightService->getMemberRightStatus("coupon"))) {
|
||||
if (!$user->is_money_level) throw new ApiException(400097);
|
||||
if (!$memberRightService->getMemberRightStatus("coupon")) throw new ApiException(400098);
|
||||
}
|
||||
/** @var StoreCouponIssueUserServices $issueUserService */
|
||||
$issueUserService = app()->make(StoreCouponIssueUserServices::class);
|
||||
if ($is_receive) {
|
||||
$alreadyReceived = $issueUserService->count(['uid' => $uid, 'issue_coupon_id' => $id]);
|
||||
if ($alreadyReceived >= $issueCouponInfo['receive_limit']) {
|
||||
throw new ApiException(400518);
|
||||
}
|
||||
}
|
||||
/** @var StoreCouponUserServices $couponUserService */
|
||||
$couponUserService = app()->make(StoreCouponUserServices::class);
|
||||
if ($issueCouponInfo->remain_count <= 0 && !$issueCouponInfo->is_permanent) throw new ApiException(400518);
|
||||
$this->transaction(function () use ($issueUserService, $uid, $id, $couponUserService, $issueCouponInfo) {
|
||||
$issueUserService->save(['uid' => $uid, 'issue_coupon_id' => $id, 'add_time' => time()]);
|
||||
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "get");
|
||||
if ($issueCouponInfo['total_count'] > 0) {
|
||||
$issueCouponInfo['remain_count'] -= 1;
|
||||
$issueCouponInfo->save();
|
||||
}
|
||||
$couponUserService->addUserCoupon($uid, $issueCouponInfo, "send");
|
||||
});
|
||||
}
|
||||
|
||||
@ -429,6 +412,9 @@ class StoreCouponIssueServices extends BaseServices
|
||||
* @param int $uid
|
||||
* @param $types
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getUserCouponList(int $uid, $types)
|
||||
{
|
||||
@ -512,6 +498,9 @@ class StoreCouponIssueServices extends BaseServices
|
||||
* 获取单个优惠券类型
|
||||
* @param array $where
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getOne(array $where)
|
||||
{
|
||||
@ -538,6 +527,8 @@ class StoreCouponIssueServices extends BaseServices
|
||||
/**
|
||||
* 给会员发放优惠券
|
||||
* @param $uid
|
||||
* @param int $couponId
|
||||
* @return bool
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
|
||||
@ -46,6 +46,9 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
* 获取抽奖记录列表
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where)
|
||||
{
|
||||
@ -108,7 +111,11 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
* 写入中奖纪录
|
||||
* @param int $uid
|
||||
* @param array $prize
|
||||
* @param array $userInfo
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function insertPrizeRecord(int $uid, array $prize, array $userInfo = [])
|
||||
{
|
||||
@ -218,13 +225,6 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
throw new ApiException(410053);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
//TODO 未完善
|
||||
break;
|
||||
case 8:
|
||||
break;
|
||||
case 9:
|
||||
break;
|
||||
}
|
||||
$this->dao->update($lottery_record_id, $data, 'id');
|
||||
});
|
||||
@ -272,7 +272,11 @@ class LuckLotteryRecordServices extends BaseServices
|
||||
/**
|
||||
* 获取中奖记录
|
||||
* @param int $uid
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getRecord(int $uid, $where = [])
|
||||
{
|
||||
|
||||
@ -154,7 +154,6 @@ class LuckLotteryServices extends BaseServices
|
||||
}
|
||||
$lottery = $lottery->toArray();
|
||||
if (isset($lottery['prize']) && $lottery['prize']) {
|
||||
$products = $coupons = [];
|
||||
$product_ids = array_unique(array_column($lottery['prize'], 'product_id'));
|
||||
$coupon_ids = array_unique(array_column($lottery['prize'], 'coupon_id'));
|
||||
/** @var StoreProductServices $productServices */
|
||||
@ -173,6 +172,9 @@ class LuckLotteryServices extends BaseServices
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($lottery['user_level'] as &$item) {
|
||||
$item = (int)$item;
|
||||
}
|
||||
/** @var UserLabelServices $userLabelServices */
|
||||
$userLabelServices = app()->make(UserLabelServices::class);
|
||||
$lottery['user_label'] = !empty($lottery['user_label']) ? $userLabelServices->getLabelList(['ids' => $lottery['user_label']], ['id', 'label_name']) : [];
|
||||
@ -183,6 +185,9 @@ class LuckLotteryServices extends BaseServices
|
||||
* 添加抽奖活动以及奖品
|
||||
* @param array $data
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function add(array $data)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user