123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace App\Http\Controllers\V1;
- use App\Repositories\BeanRepository;
- use Illuminate\Http\Request;
- use Illuminate\Support\Facades\Validator;
- use Illuminate\Validation\Rule;
- /**
- * Created by PhpStorm.
- * User: durong
- * Date: 2019/6/19
- * Time: 下午12:25
- */
- class BeanDetailController extends Controller
- {
- public function __construct(BeanRepository $beanRepository)
- {
- $this->beanRepository = $beanRepository;
- }
- //获取指定时间彩虹豆收支明细
- public function beanDetail(Request $request)
- {
- $validator = Validator::make($request->all(), [
- 'type' => ['required',Rule::in([0,1,2,3])],
- ]);
- if ($validator->fails()) {
- return $this->jsonError($validator->errors()->first());
- }
- $beanDetail = $this->beanRepository->beanDetail($request->all());
- if ($beanDetail){
- return $this->jsonSuccess($beanDetail);
- }else{
- return $this->jsonSuccess();
- }
- }
- //排行榜
- public function rankingList(Request $request)
- {
- $validator = Validator::make($request->all(), [
- 'type' => ['required',Rule::in([0,1, 2])],
- ]);
- if ($validator->fails()) {
- return $this->jsonError($validator->errors()->first());
- }
- $top_most = $this->beanRepository->rankingList($request->all());
- if ($top_most){
- return $this->jsonSuccess($top_most);
- }else{
- return $this->jsonSuccess();
- }
- }
- //星球首页
- public function starHome(Request $request)
- {
- $star_home = $this->beanRepository->starHome($request->all());
- if ($star_home){
- return $this->jsonSuccess($star_home);
- }else{
- return $this->jsonSuccess();
- }
- }
- }
|