|
@@ -4,9 +4,11 @@ namespace App\Http\Controllers\QuickApp\User;
|
|
|
|
|
|
|
|
|
use App\Http\Controllers\QuickApp\BaseController;
|
|
|
+use App\Http\Controllers\Wap\User\Transformers\SignRecordTransformer;
|
|
|
use App\Libs\AliSMS;
|
|
|
use App\Modules\Subscribe\Services\YearOrderService;
|
|
|
use App\Modules\User\Services\QappUserService;
|
|
|
+use App\Modules\User\Services\ReadRecordService;
|
|
|
use App\Modules\User\Services\UserSignService;
|
|
|
use Illuminate\Http\Request;
|
|
|
use Redis;
|
|
@@ -178,4 +180,63 @@ class UserController extends BaseController
|
|
|
return response()->error('WAP_SEND_CODE_ERROR');
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @apiVersion 1.0.0
|
|
|
+ * @apiDescription 用户签到记录
|
|
|
+ * @api {GET} user/sign_record 用户签到记录
|
|
|
+ * @apiGroup User
|
|
|
+ * @apiName signRecord
|
|
|
+ * @apiSuccess {int} code 状态码
|
|
|
+ * @apiSuccess {String} msg 信息
|
|
|
+ * @apiSuccess {object} data 结果集
|
|
|
+ * @apiSuccess {reward} data.reward 奖励金额.
|
|
|
+ * @apiSuccess {sign_time} data.sign_time 签到时间.
|
|
|
+ * @apiParam {page} page
|
|
|
+ * @apiSuccessExample {json} Success-Response:
|
|
|
+ *
|
|
|
+ * {
|
|
|
+ * code: 0,
|
|
|
+ * msg: "",
|
|
|
+ * data: {
|
|
|
+ * list: [
|
|
|
+ * {
|
|
|
+ * reward: 50,
|
|
|
+ * sign_time: "2018-03-20 13:43:11"
|
|
|
+ * },
|
|
|
+ * {
|
|
|
+ * reward: 50,
|
|
|
+ * sign_time: "2018-01-18 16:22:33"
|
|
|
+ * },
|
|
|
+ * ],
|
|
|
+ * meta: {
|
|
|
+ * total: 12,
|
|
|
+ * per_page: 15,
|
|
|
+ * current_page: 1,
|
|
|
+ * last_page: 1,
|
|
|
+ * next_page_url: "",
|
|
|
+ * prev_page_url: ""
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ public function signRecord(Request $request)
|
|
|
+ {
|
|
|
+ $sign_result = paginationTransform(new SignRecordTransformer(), UserSignService::getUserSignRecord($this->uid));
|
|
|
+ $sign_status = UserSignService::isSign($this->uid);
|
|
|
+ $sign_today = [];
|
|
|
+ if ($sign_status) {
|
|
|
+ $sign_today = ReadRecordService::getByField($this->uid, 'sign_info');
|
|
|
+ if ($sign_today) $sign_today = json_decode($sign_today, 1);
|
|
|
+ isset($sign_today['sign_time']) && $sign_today['sign_time'] = date('Y-m-d H:i:s', $sign_today['sign_time']);
|
|
|
+ isset($sign_today['sign_at']) && $sign_today['sign_time'] = $sign_today['sign_at'];
|
|
|
+ isset($sign_today['price']) && $sign_today['reward'] = $sign_today['price'];
|
|
|
+ }
|
|
|
+ $result = [
|
|
|
+ 'sign_status' => $sign_status,
|
|
|
+ 'sign_result' => $sign_result,
|
|
|
+ 'sign_today' => $sign_today
|
|
|
+ ];
|
|
|
+ return response()->success($result);
|
|
|
+ }
|
|
|
}
|