56 lines
1.4 KiB
PHP
Executable File
56 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Http\Controllers\Api\Customer;
|
|
|
|
use App\Enums\BoolEnum;
|
|
use App\Enums\LottType;
|
|
use App\Exceptions\JingCaiException;
|
|
use App\Model\Lottery;
|
|
use App\Model\LotteryType;
|
|
use App\Model\Seller\ShopCooperateLottery;
|
|
use App\Service\LotteryService;
|
|
use App\Utils\Result;
|
|
use Illuminate\Http\Request;
|
|
|
|
class LotteryController extends BaseController
|
|
{
|
|
/**
|
|
* @api {GET} /api/customer/lottery/types 所有彩种
|
|
* @apiVersion 0.1.0
|
|
* @apiGroup 客户端
|
|
*
|
|
* @apiParam {Int} [is_fadan] 1代表是发单时使用
|
|
*
|
|
* @apiSuccessExample {json} 返回结果
|
|
* [
|
|
* {
|
|
* "id": 1, // id
|
|
* "name": "第一个", // 名称
|
|
* "icon": "xx", // icon
|
|
* "info": "", // 信息提示
|
|
* },
|
|
* ...
|
|
* ]
|
|
*/
|
|
public function types(Request $request)
|
|
{
|
|
$isFadan = $request->input('is_fadan');
|
|
|
|
$idList = Lottery::active()
|
|
->where('shop_id', $this->customerShopId())
|
|
->pluck('lottery_type_id')
|
|
->toArray();
|
|
|
|
if (!$idList) {
|
|
return $this->jsonSuccess();
|
|
}
|
|
$query = LotteryType::whereIn('id', $idList)
|
|
->where('status', BoolEnum::YES);
|
|
if ($isFadan) {
|
|
$query->whereIn('type', [LottType::JCZQ, LottType::JCLQ]);
|
|
}
|
|
$lotteryTypes = $query->get();
|
|
return $this->jsonSuccess($lotteryTypes);
|
|
}
|
|
}
|