初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\app\sign;
|
||||
|
||||
use app\common\controller\Api;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*/
|
||||
class Config extends Api
|
||||
{
|
||||
|
||||
protected $noNeedLogin = [];
|
||||
// 无需鉴权的接口,*表示全部
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config','sign');
|
||||
|
||||
$this->model = new \app\common\model\app\agent\Member();
|
||||
}
|
||||
|
||||
public function getConfig(){
|
||||
$config = \app\common\model\app\Config::getConfig('sign');
|
||||
|
||||
$this->success('获取成功',$config);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\app\sign;
|
||||
|
||||
use app\common\controller\Api;
|
||||
|
||||
/**
|
||||
* 日历签到
|
||||
*/
|
||||
class Handle extends Api
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config','sign');
|
||||
}
|
||||
|
||||
|
||||
// 按月份获取签到记录
|
||||
public function index()
|
||||
{
|
||||
$month = $this->request->post('month');
|
||||
|
||||
$this->success('获取成功', \app\api\model\app\sign\Log::getList($this->auth->id,$month));
|
||||
}
|
||||
|
||||
|
||||
public function sign () {
|
||||
|
||||
|
||||
$month = $this->request->post('month');
|
||||
|
||||
// 获取积分规则
|
||||
$config = \app\common\model\app\Config::getConfig('sign');
|
||||
|
||||
if($config['status'] !=1){
|
||||
$this->error('签到功能暂时停用');
|
||||
}
|
||||
|
||||
$this->success('签到成功', \app\api\model\app\sign\Log::sign($this->auth->id,$month));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller\app\sign;
|
||||
|
||||
use app\common\controller\Api;
|
||||
|
||||
/**
|
||||
* 签到
|
||||
*/
|
||||
class Log extends Api
|
||||
{
|
||||
protected $noNeedLogin = [];
|
||||
protected $noNeedRight = ['*'];
|
||||
|
||||
public function _initialize()
|
||||
{
|
||||
parent::_initialize();
|
||||
|
||||
\app\common\model\fill\Handle::check('app_config','sign');
|
||||
}
|
||||
|
||||
|
||||
// 按月份获取签到记录
|
||||
public function getList()
|
||||
{
|
||||
$limit = input('limit',10);
|
||||
$page = input('page',1);
|
||||
|
||||
$where = [
|
||||
'user_id'=>$this->auth->id
|
||||
];
|
||||
$list = \app\api\model\app\sign\Log::where($where)
|
||||
->limit($limit)->page($page)
|
||||
->order('createtime','desc')
|
||||
->select();
|
||||
|
||||
$this->success('获取成功', $list);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user