|
@@ -210,7 +210,9 @@ class LuckLotteryServices extends BaseServices
|
|
|
$luckPrizeServices = app()->make(LuckPrizeServices::class);
|
|
$luckPrizeServices = app()->make(LuckPrizeServices::class);
|
|
|
$data = [];
|
|
$data = [];
|
|
|
$sort = 1;
|
|
$sort = 1;
|
|
|
|
|
+ $prizeStatus = false;
|
|
|
foreach ($prizes as $prize) {
|
|
foreach ($prizes as $prize) {
|
|
|
|
|
+ if (isset($prize['type']) && $prize['type'] == 1) $prizeStatus = true;
|
|
|
$prize = $luckPrizeServices->checkPrizeData($prize);
|
|
$prize = $luckPrizeServices->checkPrizeData($prize);
|
|
|
$prize['lottery_id'] = $lottery->id;
|
|
$prize['lottery_id'] = $lottery->id;
|
|
|
unset($prize['id']);
|
|
unset($prize['id']);
|
|
@@ -219,6 +221,9 @@ class LuckLotteryServices extends BaseServices
|
|
|
$data[] = $prize;
|
|
$data[] = $prize;
|
|
|
$sort++;
|
|
$sort++;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!$prizeStatus) {
|
|
|
|
|
+ throw new AdminException('必须设置至少一个未中奖');
|
|
|
|
|
+ }
|
|
|
if (!$luckPrizeServices->saveAll($data)) {
|
|
if (!$luckPrizeServices->saveAll($data)) {
|
|
|
throw new AdminException(400536);
|
|
throw new AdminException(400536);
|
|
|
}
|
|
}
|
|
@@ -261,7 +266,9 @@ class LuckLotteryServices extends BaseServices
|
|
|
$insert = [];
|
|
$insert = [];
|
|
|
$time = time();
|
|
$time = time();
|
|
|
$sort = 1;
|
|
$sort = 1;
|
|
|
|
|
+ $prizeStatus = false;
|
|
|
foreach ($newPrizes as $prize) {
|
|
foreach ($newPrizes as $prize) {
|
|
|
|
|
+ if (isset($prize['type']) && $prize['type'] == 1) $prizeStatus = true;
|
|
|
$prize = $luckPrizeServices->checkPrizeData($prize);
|
|
$prize = $luckPrizeServices->checkPrizeData($prize);
|
|
|
$prize['sort'] = $sort;
|
|
$prize['sort'] = $sort;
|
|
|
if (isset($prize['id']) && $prize['id']) {
|
|
if (isset($prize['id']) && $prize['id']) {
|
|
@@ -280,6 +287,9 @@ class LuckLotteryServices extends BaseServices
|
|
|
}
|
|
}
|
|
|
$sort++;
|
|
$sort++;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (!$prizeStatus) {
|
|
|
|
|
+ throw new AdminException('必须设置至少一个未中奖');
|
|
|
|
|
+ }
|
|
|
if ($insert) {
|
|
if ($insert) {
|
|
|
if (!$luckPrizeServices->saveAll($insert)) {
|
|
if (!$luckPrizeServices->saveAll($insert)) {
|
|
|
throw new AdminException(100022);
|
|
throw new AdminException(100022);
|