12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <?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])],
- ]);
- if ($validator->fails()) {
- return $this->jsonError($validator->errors()->first());
- }
- $beanDetail = $this->beanRepository->beanDetail($request->all());
- if ($beanDetail){
- return $this->jsonSuccess($beanDetail);
- }else{
- return $this->jsonError('没有找到对应彩虹豆明细');
- }
- }
- //获取星球-用户彩虹豆相关信息
- public function getBean(Request $request)
- {
- $user_bean = $this->beanRepository->getBean($request->all());
- if ($user_bean){
- return $this->jsonSuccess($user_bean);
- }else{
- return $this->jsonError('没有找到星球彩虹豆信息');
- }
- }
- //昨日优秀居民
- public function excellentResidents(Request $request)
- {
- $excellent_residents = $this->beanRepository->excellentResidents($request->all());
- if ($excellent_residents){
- return $this->jsonSuccess($excellent_residents);
- }else{
- return $this->jsonError('没有找到昨日优秀居民相关信息');
- }
- }
- //昨日拉新最多前十人
- public function registeredMost(Request $request)
- {
- $registered_most = $this->beanRepository->registeredMost($request->all());
- if ($registered_most){
- return $this->jsonSuccess($registered_most);
- }else{
- return $this->jsonError('没有找到昨日拉新最多人相关信息');
- }
- }
- //昨日文章产生彩虹豆最多前十人
- public function bestAuthor(Request $request)
- {
- $best_author = $this->beanRepository->bestAuthor($request->all());
- if ($best_author){
- return $this->jsonSuccess($best_author);
- }else{
- return $this->jsonError('没有找到昨日最佳作者相关信息');
- }
- }
- }
|