Commit e5a5c571 by 杨树贤

完成用户签到那块

parent 8eb5e694
<?php
namespace App\Http\Controllers;
use App\Services\CheckInService;
use App\Services\UserIntegralService;
use Carbon\Carbon;
use Illuminate\Http\Request;
class CheckInController extends Controller
{
private $service;
public function __construct(CheckInService $service)
{
$this->service = $service;
}
public function index(Request $request)
{
$map = [
'user_id' => $request->user->user_id,
];
$result = $this->service->getCheckInList($map);
return $this->Export(0, 'ok', $result);
}
public function add(Request $request)
{
$map = [
'user_id' => $request->user->user_id,
];
$result = $this->service->addCheckIn($map);
if ($result) {
return $this->Export(0, 'ok');
}else{
return $this->Export(0,'签到失败');
}
}
}
\ No newline at end of file
<?php
namespace App\Services;
class CheckInService
{
public function getCheckInList($map = [])
{
$url = config('website.BaseUrl') . '/check_in/list';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
return $result;
}
public function addCheckIn($map = [])
{
$url = config('website.BaseUrl') . '/check_in/add';
$result = reportCurl($url, $map, true);
$result = json_decode($result, true);
return $result;
}
}
\ No newline at end of file
......@@ -25,6 +25,9 @@ $router->group(['middleware' => ['web', 'login']], function () use ($router) {
$router->options('/goods/upload', 'ApiController@UploadGoods');//前端插件需要这个请求
$router->get('/goods/upload/list', 'ApiController@UploadGoodsList');
//签到
$router->get('/check_in/list', 'CheckInController@index');
$router->post('/check_in/add', 'CheckInController@add');
});
$router->group(['middleware' => 'web'], function () use ($router) {
$router->post('/oss/upload', 'OssController@upload');
......@@ -33,4 +36,4 @@ $router->group(['middleware' => 'web'], function () use ($router) {
//红包活动信息
$router->get('/integrals/list', 'IntegralsController@index');
\ No newline at end of file
$router->get('/integrals/list', 'IntegralsController@index');
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment