<?php namespace app\api\controller\user; use app\models\system\SystemUserLevel; use app\models\system\SystemUserTask; use app\models\user\UserLevel; use app\Request; use think\db\exception\DataNotFoundException; use think\db\exception\DbException; use think\db\exception\ModelNotFoundException; /** * 会员等级类 * Class UserLevelController * @package app\api\controller\user */ class UserLevelController { /** * 检测用户是否可以成为会员 * @param Request $request * @return mixed * @throws DataNotFoundException * @throws ModelNotFoundException * @throws DbException */ public function detection(Request $request) { return app('json')->successful(UserLevel::setLevelComplete($request->uid(), false, $request->mer_id())); } /** * 会员等级列表 * @param Request $request * @return mixed * @throws DataNotFoundException * @throws ModelNotFoundException * @throws DbException */ public function grade(Request $request) { return app('json')->successful(SystemUserLevel::getLevelList($request->uid(), $request->mer_id())); } /** * 获取等级任务 * @param Request $request * @param $id * @return mixed * @throws DataNotFoundException * @throws DbException * @throws ModelNotFoundException */ public function task(Request $request, $id) { return app('json')->successful(SystemUserTask::getTashList($id, $request->uid(), null, 1400, $request->mer_id())); } }