123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace App\Http\Controllers\User;
- use App\Exceptions\AlertException;
- use App\Http\Controllers\Controller;
- use App\Http\Controllers\Core\Auth;
- use App\Services\User\TaskService;
- /**
- * 用户任务
- * Class TaskController
- * @package App\Http\Controllers\User
- */
- class TaskController extends Controller
- {
- /**
- * 完成任务
- * @param int $type
- * @return array
- * @throws AlertException
- */
- public function wcTask(int $type)
- {
- $uid = Auth::auth();
- if (!in_array($type, [1, 2, 3, 4, 5, 6, 7])) {
- throw new AlertException('参数错误');
- }
- $ts = new TaskService();
- $ts->task($uid, $type);
- return response([
- 'code' => 200,
- 'message' => 'success'
- ]);
- }
- /**
- * 获取新年小花红包
- */
- public function getYearFlower()
- {
- $uid = Auth::auth();
- $taskService = new TaskService();
- $flower = $taskService->getYearFlower($uid);
- return array(
- 'code' => 200,
- 'message' => 'success',
- 'data' => [
- 'red_flower' => $flower
- ]
- );
- }
- }
|