删除 没有用的控制器
This commit is contained in:
parent
5e8f28f459
commit
c016641044
|
@ -0,0 +1,29 @@
|
||||||
|
<?php
|
||||||
|
namespace App\Utils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* app页面返回api
|
||||||
|
* 推断1是成功
|
||||||
|
*/
|
||||||
|
class ApiResponseApp
|
||||||
|
{
|
||||||
|
public static function success($code = 1, $data = [], $message = '请求成功')
|
||||||
|
{
|
||||||
|
return json([
|
||||||
|
'code' => $code,
|
||||||
|
'data' => $data,
|
||||||
|
'message' => $message,
|
||||||
|
'time' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function error($code = 400, $data = [], $message = '操作失败')
|
||||||
|
{
|
||||||
|
return json([
|
||||||
|
'code' => $code,
|
||||||
|
'message' => $message,
|
||||||
|
'data' => $data,
|
||||||
|
'time' => time()
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,55 +0,0 @@
|
||||||
<?php
|
|
||||||
namespace app\controller;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Project;
|
|
||||||
use App\model\ProjectRegister;
|
|
||||||
use App\model\ProjectDetailed;
|
|
||||||
use App\dao\MessageDao;
|
|
||||||
class ProjectRegisterController
|
|
||||||
{
|
|
||||||
public function index(Request $request)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 报名函数
|
|
||||||
*/
|
|
||||||
public function signup(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$data = $request->post();
|
|
||||||
/**
|
|
||||||
* 通过中间件获取userid
|
|
||||||
*/
|
|
||||||
$userid=$user['id'];
|
|
||||||
$projectid=$data['projectid'];
|
|
||||||
$type=$data['type'];
|
|
||||||
$search_type=$type==1?'registerserve':'recruitingpersonnel';
|
|
||||||
$res=ProjectDetailed::where('projectid',$projectid)->first();
|
|
||||||
$Project=Project::where('id',$projectid)->first();
|
|
||||||
if(ProjectRegister::where('projectid',$projectid)->where('type','=',$type)->count()==$res->$search_type){
|
|
||||||
return ApiResponse::success(402,[],"当前报名人数已经满员");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询用户是否报名过
|
|
||||||
*/
|
|
||||||
$issignup=ProjectRegister::where('userid',$userid)->where('projectid',$projectid)->count();
|
|
||||||
if($issignup==0){
|
|
||||||
$ProjectRegister=new ProjectRegister();
|
|
||||||
$ProjectRegister->projectid=$projectid;
|
|
||||||
$ProjectRegister->type=$type;
|
|
||||||
$ProjectRegister->userid=$userid;
|
|
||||||
$ProjectRegister->save();
|
|
||||||
MessageDao::SendMessage($userid,"系统提醒","您已成功报名 $Project->title ");
|
|
||||||
return ApiResponse::success(200,[],"报名成功");
|
|
||||||
}
|
|
||||||
return ApiResponse::success(402,$issignup,"您已经报名过了");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
use App\Utils\ApiResponse;
|
||||||
|
|
||||||
|
use App\model\Carousel;
|
||||||
|
use App\model\Project;
|
||||||
|
use App\model\ProjectDetailed;
|
||||||
|
use App\model\ProjectRegister;
|
||||||
|
use App\model\Carouselad;
|
||||||
|
use App\model\Mechanism;
|
||||||
|
use Tinywan\Jwt\JwtToken;
|
||||||
|
|
||||||
|
use hg\apidoc\annotation as Apidoc;
|
||||||
|
use support\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Apidoc\Title("用户vip控制器")
|
||||||
|
*/
|
||||||
|
|
||||||
|
class TaskController
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = ['phone_list', 'get_project', 'get_projectdetailed', 'get_mechanism_list'];
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Apidoc\Title("1.0 获取首页轮播图")
|
||||||
|
* @Apidoc\Url("api/task/phone_list")
|
||||||
|
* @Apidoc\Method("POST")
|
||||||
|
*/
|
||||||
|
public function phone_list(Request $request)
|
||||||
|
{
|
||||||
|
// return json(['code' => 0, 'msg' => 'ok']);
|
||||||
|
$res['carousel'] = Carousel::all();
|
||||||
|
$res['carouselad'] = Carouselad::all();
|
||||||
|
return ApiResponse::success(200, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,94 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\admin\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Carousel;
|
|
||||||
use App\model\Carouselad;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("轮播图控制器")
|
|
||||||
*/
|
|
||||||
class CarouselController
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取首页轮播图")
|
|
||||||
* @Apidoc\Url("api/admin/v1/carousel/get_carousel")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_carousel(Request $request)
|
|
||||||
{
|
|
||||||
// return json(['code' => 0, 'msg' => 'ok']);
|
|
||||||
$res = Carousel::all();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取首页底部轮播图")
|
|
||||||
* @Apidoc\Url("api/admin/v1/carousel/get_carouselad")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_carouselad(Request $request)
|
|
||||||
{
|
|
||||||
$res = Carouselad::all();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 添加轮播图")
|
|
||||||
* @Apidoc\Url("admin/api/v1/carousel/add")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="类型0是首页轮播图1是广告图")
|
|
||||||
* @Apidoc\Param("img_url", type="string",require=true, desc="img_url")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function add(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
if ($data['type'] == 0) {
|
|
||||||
$Carousel = new Carousel();
|
|
||||||
} else {
|
|
||||||
$Carousel = new Carouselad();
|
|
||||||
}
|
|
||||||
$Carousel->img_url = $data['img_url'];
|
|
||||||
$Carousel->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除轮播图")
|
|
||||||
* @Apidoc\Url("admin/api/v1/carousel/del")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="类型0是首页轮播图1是广告图")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="图片id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function del(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
if ($data['type'] == 0) {
|
|
||||||
$Carousel = Carousel::where('id', $data['id'])->first();
|
|
||||||
} else {
|
|
||||||
$Carousel = Carouselad::where('id', $data['id'])->first();
|
|
||||||
}
|
|
||||||
$Carousel->delete();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除轮播图")
|
|
||||||
* @Apidoc\Url("admin/api/v1/carousel/chang")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="类型0是首页轮播图1是广告图")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="图片id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function chang(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
if ($data['type'] == 0) {
|
|
||||||
$Carousel = Carousel::where('id', $data['id'])->first();
|
|
||||||
} else {
|
|
||||||
$Carousel = Carouselad::where('id', $data['id'])->first();
|
|
||||||
}
|
|
||||||
$Carousel->img_url = $data['img_url'];
|
|
||||||
$Carousel->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,75 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\admin\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\ProjectDetailed;
|
|
||||||
use App\model\Project;
|
|
||||||
use App\model\Hotinformation;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("文章控制器")
|
|
||||||
*/
|
|
||||||
class HotinformationController{
|
|
||||||
protected $noNeedLogin = ['get_list','get_details'];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取所有文章")
|
|
||||||
* @Apidoc\Url("admin/api/v1/hotinformation/get_list")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="0是热点资讯1是银龄")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_list(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$res = Hotinformation::where('type', $data['type'])->get();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取文章详细")
|
|
||||||
* @Apidoc\Url("admin/api/v1/hotinformation/get_details")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="文章id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_details(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$res = Hotinformation::where('id', $data['id'])->first();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 编辑文章")
|
|
||||||
* @Apidoc\Url("admin/api/v1/hotinformation/edi")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="文章id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function edi(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$hotinformation = Hotinformation::where('id', $data['id'])->first();
|
|
||||||
if(!isset($hotinformation)){
|
|
||||||
$hotinformation=new Hotinformation();
|
|
||||||
}
|
|
||||||
$hotinformation->title=$data['title'];
|
|
||||||
$hotinformation->writer=$data['writer'];
|
|
||||||
$hotinformation->content=$data['content'];
|
|
||||||
$hotinformation->type=$data['type'];
|
|
||||||
$hotinformation->img=$data['img'];
|
|
||||||
$hotinformation->weight=$data['weight'];
|
|
||||||
$hotinformation->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除文章")
|
|
||||||
* @Apidoc\Url("admin/api/v1/hotinformation/del")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="文章id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function del(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$hotinformation = Hotinformation::where('id', $data['id'])->first();
|
|
||||||
$hotinformation->delete();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,66 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\admin\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\ProjectDetailed;
|
|
||||||
use App\model\Project;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
class projectController{
|
|
||||||
protected $noNeedLogin = ['edi'];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取首页轮播图")
|
|
||||||
* @Apidoc\Url("admin/api/v1/project/edi")
|
|
||||||
* @Apidoc\Param("projectid", type="int",require=true, desc="项目id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function edi(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
|
|
||||||
if($data['projectid']>0){
|
|
||||||
$project = Project::where('id', $data['projectid'])->first();
|
|
||||||
$projectDetailed = ProjectDetailed::where('projectid', $data['projectid'])->first();
|
|
||||||
}else{
|
|
||||||
$project =new Project();
|
|
||||||
$projectDetailed =new ProjectDetailed();
|
|
||||||
}
|
|
||||||
$project->img=$data['img'];
|
|
||||||
$project->start_time=$data['start_time'];
|
|
||||||
$project->end_time=$data['end_time'];
|
|
||||||
$project->address=$data['address'];
|
|
||||||
$project->title=$data['title'];
|
|
||||||
$project->type=$data['type'];
|
|
||||||
$project->save();
|
|
||||||
$id=Project::where('img', $data['img'])->first();
|
|
||||||
$id=$id->id;
|
|
||||||
$projectDetailed->projectid = $id;
|
|
||||||
$projectDetailed->recruitingpersonnel=(int)$data['recruitingpersonnel'];
|
|
||||||
$projectDetailed->registerserve=(int)$data['registerserve'];
|
|
||||||
$projectDetailed->servicedescription=$data['servicedescription'];
|
|
||||||
$projectDetailed->totalnumberoftimecoins=(int)$data['totalnumberoftimecoins'];
|
|
||||||
$projectDetailed->volunteergender=(int)$data['volunteergender'];
|
|
||||||
$projectDetailed->volunteerage=(int)$data['volunteerage'];
|
|
||||||
$projectDetailed->registrationisclosed=$data['registrationisclosed'];
|
|
||||||
$projectDetailed->serviceduration=$minute=floor((strtotime($data['end_time'])-strtotime($data['start_time']))%86400/60);;
|
|
||||||
$projectDetailed->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除")
|
|
||||||
* @Apidoc\Url("admin/api/v1/project/del")
|
|
||||||
* @Apidoc\Param("projectid", type="int",require=true, desc="项目id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function del(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$project = Project::where('id', $data['projectid'])->first();
|
|
||||||
$projectDetailed = ProjectDetailed::where('projectid', $data['projectid'])->first();
|
|
||||||
$project->delete();
|
|
||||||
$projectDetailed->delete();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,121 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\admin\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
|
|
||||||
use App\model\Volunteerservicecorp;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\Volunteerservicecorpsdetailed;
|
|
||||||
use App\model\Volunteerjoinrequest;
|
|
||||||
use App\model\Message;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use plugin\admin\app\model\User;
|
|
||||||
use App\dao\VolunteerservicecorpsDao;
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("admin志愿者队伍控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class VolunteerservicecorpsController
|
|
||||||
{
|
|
||||||
protected $noNeedLogin = ['get_volunteerservicecorp_list','get_volunteerservicecorp_details','del_volunteerservicecorp','add_volunteerservicecorp','edi_volunteerservicecorp'];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 志愿队查询所有")
|
|
||||||
* @Apidoc\Url("admin/api/v1/Volunteerservicecorps/get_volunteerservicecorp_list")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_volunteerservicecorp_list(Request $request)
|
|
||||||
{
|
|
||||||
$tmp = Volunteerservicecorp::all();
|
|
||||||
$res = [];
|
|
||||||
foreach ($tmp as $k => $v) {
|
|
||||||
$tmp2 = Volunteerservicecorpsdetailed::where('groupid', $v->id)->get();
|
|
||||||
$number = Volunteerservicecorpsdetailed::where('groupid', $v->id)->count();
|
|
||||||
$leader = Users::where('id', $v->leaderid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
foreach ($tmp2 as $key => $value) {
|
|
||||||
$member[] = Users::where('id', $value->userid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
}
|
|
||||||
$res['group'][] = array('groupname' => $v->groupname, 'leaderid' => $v->leaderid, 'groupid' => $v->id, "category" => $v->category, 'img' => $v->img, 'number' => $number, 'leader' => $leader, 'member' => $member);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取志愿队伍详细信息根据id")
|
|
||||||
* @Apidoc\Url("admin/api/v1/Volunteerservicecorps/get_volunteerservicecorp_details")
|
|
||||||
* @Apidoc\Param("volunteerservicecorp_id", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_volunteerservicecorp_details(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$volunteerservicecorp_id = $data['volunteerservicecorp_id'];
|
|
||||||
$tmp = Volunteerservicecorp::where('id', $volunteerservicecorp_id)->get();
|
|
||||||
$res = [];
|
|
||||||
foreach ($tmp as $k => $v) {
|
|
||||||
$tmp2 = Volunteerservicecorpsdetailed::where('groupid', $v->id)->get();
|
|
||||||
$number = Volunteerservicecorpsdetailed::where('groupid', $v->id)->count();
|
|
||||||
$leader = Users::where('id', $v->leaderid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
foreach ($tmp2 as $key => $value) {
|
|
||||||
$member[] = Users::where('id', $value->userid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
}
|
|
||||||
$res['group'] = array('groupname' => $v->groupname, 'leaderid' => $v->leaderid, "category" => $v->category, 'briefly' => $v->briefly, 'created_at' => $v->created_at, 'img' => $v->img, 'number' => $number, 'leader' => $leader, 'member' => $member);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除志愿队伍根据id")
|
|
||||||
* @Apidoc\Url("admin/api/v1/Volunteerservicecorps/del_volunteerservicecorp")
|
|
||||||
* @Apidoc\Param("groupid", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function del_volunteerservicecorp(Request $request){
|
|
||||||
$data = $request->post();
|
|
||||||
VolunteerservicecorpsDao::del($data['groupid']);
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 增加志愿队伍")
|
|
||||||
* @Apidoc\Url("admin/api/v1/Volunteerservicecorps/add_volunteerservicecorp")
|
|
||||||
* @Apidoc\Param("leaderid", type="int",require=true, desc="组长用户id")
|
|
||||||
* @Apidoc\Param("groupname", type="string",require=true, desc="组名称")
|
|
||||||
* @Apidoc\Param("category", type="string",require=true, desc="组分类")
|
|
||||||
* @Apidoc\Param("img", type="string",require=true, desc="首页图片url")
|
|
||||||
* @Apidoc\Param("briefly", type="string",require=true, desc="队伍简介")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function add_volunteerservicecorp(Request $request){
|
|
||||||
$data = $request->post();
|
|
||||||
$col_array=['leaderid','groupname','category','img','briefly'];
|
|
||||||
$Volunteerservicecorp=new Volunteerservicecorp();
|
|
||||||
foreach($col_array as $v){
|
|
||||||
$Volunteerservicecorp->$v=$data[$v];
|
|
||||||
}
|
|
||||||
$Volunteerservicecorp->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 修改志愿队伍")
|
|
||||||
* @Apidoc\Url("admin/api/v1/Volunteerservicecorps/add_volunteerservicecorp")
|
|
||||||
* @Apidoc\Param("leaderid", type="int",require=true, desc="组长用户id")
|
|
||||||
* @Apidoc\Param("groupname", type="string",require=true, desc="组名称")
|
|
||||||
* @Apidoc\Param("category", type="string",require=true, desc="组分类")
|
|
||||||
* @Apidoc\Param("img", type="string",require=true, desc="首页图片url")
|
|
||||||
* @Apidoc\Param("briefly", type="string",require=true, desc="队伍简介")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function edi_volunteerservicecorp(Request $request){
|
|
||||||
$data = $request->post();
|
|
||||||
$col_array=['leaderid','groupname','category','img','briefly'];
|
|
||||||
$Volunteerservicecorp=Volunteerservicecorp::where('id',$data['id']);
|
|
||||||
foreach($col_array as $v){
|
|
||||||
$Volunteerservicecorp->$v=$data[$v];
|
|
||||||
}
|
|
||||||
$Volunteerservicecorp->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\controller;
|
||||||
|
|
||||||
|
use support\Request;
|
||||||
|
|
||||||
|
use App\Utils\ApiResponse;
|
||||||
|
|
||||||
|
use App\model\Carousel;
|
||||||
|
use App\model\Project;
|
||||||
|
use App\model\ProjectDetailed;
|
||||||
|
use App\model\ProjectRegister;
|
||||||
|
use App\model\Carouselad;
|
||||||
|
use App\model\Mechanism;
|
||||||
|
use Tinywan\Jwt\JwtToken;
|
||||||
|
|
||||||
|
use hg\apidoc\annotation as Apidoc;
|
||||||
|
use support\Db;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Apidoc\Title("用户vip控制器")
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Vip_salaryController
|
||||||
|
{
|
||||||
|
protected $noNeedLogin = ['get_carousel', 'get_project', 'get_projectdetailed', 'get_mechanism_list'];
|
||||||
|
public function index(Request $request)
|
||||||
|
{
|
||||||
|
static $readme;
|
||||||
|
if (!$readme) {
|
||||||
|
$readme = file_get_contents(base_path('README.md'));
|
||||||
|
}
|
||||||
|
return $readme;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function view(Request $request)
|
||||||
|
{
|
||||||
|
return view('index/view', ['name' => 'webman']);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* @Apidoc\Title("1.0 获取首页轮播图")
|
||||||
|
* @Apidoc\Url("Apiv1/get_carousel")
|
||||||
|
* @Apidoc\Method("POST")
|
||||||
|
*/
|
||||||
|
public function user_count(Request $request)
|
||||||
|
{
|
||||||
|
// return json(['code' => 0, 'msg' => 'ok']);
|
||||||
|
$res['carousel'] = Carousel::all();
|
||||||
|
$res['carouselad'] = Carouselad::all();
|
||||||
|
return ApiResponse::success(200, $res);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,117 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\BankLog;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use App\dao\BankDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("时间币控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class BankController
|
|
||||||
{
|
|
||||||
protected $noNeedLogin = ['index'];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 测试")
|
|
||||||
* @Apidoc\Url("api/v1/bank/index")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function index(Request $request)
|
|
||||||
{
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取当前用户时间币余额")
|
|
||||||
* @Apidoc\Url("api/v1/bank/get")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
* @Apidoc\Returned("timecoin", type="int", desc="余额")
|
|
||||||
*/
|
|
||||||
public function get(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$res = Users::where('id', $userid)->first('timecoin');
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取当前用户时间币记录")
|
|
||||||
* @Apidoc\Url("api/v1/bank/get_back_log")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_back_log(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$res = BankLog::where('userid', $userid)->orderBy('created_at', 'desc')->limit(3)->get();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取当前用户时间币所有记录")
|
|
||||||
* @Apidoc\Url("api/v1/bank/get_back_log_all")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_back_log_all(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$res = BankLog::where('userid', $userid)->orderBy('created_at', 'desc')->get();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 转账时间币到其他用户")
|
|
||||||
* @Apidoc\Url("api/v1/bank/transfer")
|
|
||||||
* @Apidoc\Param("amount", type="int",require=true, desc="金额",default="1")
|
|
||||||
* @Apidoc\Param("phone", type="int",require=true, desc="收款人手机号",default="我是你爹")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function transfer(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$amount = $data['amount'];
|
|
||||||
$phone = $data['phone'];
|
|
||||||
$res = BankDao::transfer($userid, $phone, $amount);
|
|
||||||
if($res['status']=='error'){
|
|
||||||
return ApiResponse::success(402, $res);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 增加时间币测试")
|
|
||||||
* @Apidoc\Url("api/v1/bank/add")
|
|
||||||
* @Apidoc\Param("amount", type="int",require=true, desc="金额",default="1")
|
|
||||||
* @Apidoc\Param("remark", type="string",require=true, desc="备注",default="我是你爹")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function add(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$amount = $data['amount'];
|
|
||||||
$remark = $data['remark'];
|
|
||||||
BankDao::add($userid, $amount, $remark);
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 搜索转账人")
|
|
||||||
* @Apidoc\Url("api/v1/bank/search_user")
|
|
||||||
* @Apidoc\Param("key", type="string",require=true, desc="关键词",default="1")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function search_user(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$users = Users::where('nickname', 'like', '%' . $data['key'] . '%')
|
|
||||||
->orWhere('phone', 'like', '%' . $data['key'] . '%')
|
|
||||||
->get(['id','nickname','phone']);
|
|
||||||
return ApiResponse::success(200, $users);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,101 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\Contact;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use App\dao\BankDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("联系人控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class ContactController
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取当前用户联系人列表")
|
|
||||||
* @Apidoc\Url("api/v1/contact/get")
|
|
||||||
* @Apidoc\Param("id", type="int",require=false, desc="联系人id",default="")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$data = $request->post();
|
|
||||||
if (isset($data['id'])) {
|
|
||||||
$res = Contact::where('userid', $userid)->where('id', $data['id'])->first(['id', 'name', 'phone', 'relationship']);
|
|
||||||
} else {
|
|
||||||
$res = Contact::where('userid', $userid)->get(['id', 'name', 'phone', 'relationship']);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 增加联系人")
|
|
||||||
* @Apidoc\Url("api/v1/contact/add_contact")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
* @Apidoc\Param("name", type="string",require=true, desc="联系人姓名",default="我是你爹")
|
|
||||||
* @Apidoc\Param("phone", type="int",require=true, desc="手机号",default="")
|
|
||||||
* @Apidoc\Param("relationship", type="int",require=true, desc="关系",default="0")
|
|
||||||
*/
|
|
||||||
public function add_contact(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$data = $request->post();
|
|
||||||
|
|
||||||
$count=Contact::where('userid',$userid)->where('phone',$data['phone'])->count();
|
|
||||||
if($count>0){
|
|
||||||
return ApiResponse::success(402, [],'联系人手机号已存在');
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = new Contact();
|
|
||||||
$contact->name = $data['name'];
|
|
||||||
$contact->phone = $data['phone'];
|
|
||||||
$contact->relationship = $data['relationship'];
|
|
||||||
$contact->userid = $userid;
|
|
||||||
$contact->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 编辑联系人")
|
|
||||||
* @Apidoc\Url("api/v1/contact/edi_contact")
|
|
||||||
* @Apidoc\Param("name", type="string",require=true, desc="联系人姓名",default="我是你爹")
|
|
||||||
* @Apidoc\Param("phone", type="int",require=true, desc="手机号",default="")
|
|
||||||
* @Apidoc\Param("relationship", type="int",require=true, desc="关系",default="0")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="记录id",default="0")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function edi_contact(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$data = $request->post();
|
|
||||||
$contact = Contact::where('userid', $userid)->where('id', $data['id'])->first();
|
|
||||||
$contact->name = $data['name'];
|
|
||||||
$contact->phone = $data['phone'];
|
|
||||||
$contact->relationship = $data['relationship'];
|
|
||||||
$contact->userid = $userid;
|
|
||||||
$contact->save();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 删除联系人")
|
|
||||||
* @Apidoc\Url("api/v1/contact/del_contact")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="记录id",default="0")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function del_contact(Request $request)
|
|
||||||
{
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$data = $request->post();
|
|
||||||
$contact = Contact::where('userid', $userid)->where('id', $data['id'])->first();
|
|
||||||
$contact->delete();
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,44 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\Hotinformation;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use App\dao\BankDao;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("文章控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class HotinformationController
|
|
||||||
{
|
|
||||||
protected $noNeedLogin = ['get_list','get_details'];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取所有文章")
|
|
||||||
* @Apidoc\Url("api/v1/hotinformation/get_list")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="0是热点资讯1是银龄")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_list(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$res = Hotinformation::where('type', $data['type'])->get();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取文章详细")
|
|
||||||
* @Apidoc\Url("api/v1/hotinformation/get_details")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="文章id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_details(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$res = Hotinformation::where('id', $data['id'])->first();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,48 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use Webman\Controller;
|
|
||||||
use support\Request;
|
|
||||||
use support\Response;
|
|
||||||
use Webman\File;
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
|
|
||||||
class ImageController
|
|
||||||
{
|
|
||||||
// 显示上传图片的页面
|
|
||||||
public function showUploadForm()
|
|
||||||
{
|
|
||||||
return view('admin.image_upload');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理图片上传
|
|
||||||
public function upload(Request $request)
|
|
||||||
{
|
|
||||||
// 获取上传的文件
|
|
||||||
$file = $request->file('image');
|
|
||||||
|
|
||||||
// 验证文件是否上传成功
|
|
||||||
if ($file && $file->isValid()) {
|
|
||||||
// 设置保存路径
|
|
||||||
$uploadPath = public_path('uploads/images');
|
|
||||||
// 生成文件名,防止重名
|
|
||||||
$filename = uniqid('img_', true) . '.' . $file->getUploadExtension();
|
|
||||||
// 保存文件
|
|
||||||
$file->move($uploadPath. $filename);
|
|
||||||
|
|
||||||
// 返回成功消息
|
|
||||||
return ApiResponse::success(200, [
|
|
||||||
'status' => 'success',
|
|
||||||
'message' => '上传成功!',
|
|
||||||
'file' => "/uploads/images/{$filename}",
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 上传失败
|
|
||||||
return ApiResponse::success(200, [
|
|
||||||
'status' => 'error',
|
|
||||||
'message' => '文件上传失败,请重试。',
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Mechanism;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("养老机构控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class MechanismController
|
|
||||||
{
|
|
||||||
protected $noNeedLogin = ['get_mechanism_list','get_mechanism_details'];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取所有养老机构")
|
|
||||||
* @Apidoc\Url("api/v1/mechanism/get_mechanism_list")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_mechanism_list(Request $request)
|
|
||||||
{
|
|
||||||
$res = Mechanism::all();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取养老机构详细信息")
|
|
||||||
* @Apidoc\Url("api/v1/mechanism/get_mechanism_details")
|
|
||||||
* @Apidoc\Param("id", type="int",require=true, desc="养老机构id",default="1")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_mechanism_details(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$res = Mechanism::where('id', $data['id'])->first();
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,45 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\BankLog;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use App\dao\BankDao;
|
|
||||||
use App\model\Mechanism;
|
|
||||||
use App\model\Hotinformation;
|
|
||||||
use simplehtmldom\HtmlDocument;
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("自己用的批量修改控制器")
|
|
||||||
*/
|
|
||||||
class SetController
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取所有养老机构")
|
|
||||||
* @Apidoc\Url("api/v1/Set/chang_url")
|
|
||||||
* @Apidoc\Param("url", type="string",require=true, desc="url",default="http://")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function chang_url(Request $request)
|
|
||||||
{
|
|
||||||
$url = "39.98.251.138";
|
|
||||||
$res = Hotinformation::all();
|
|
||||||
foreach($res as $k => $v){
|
|
||||||
$html = new HtmlDocument();
|
|
||||||
$html->load($v->content);
|
|
||||||
$img = $html->find('img');
|
|
||||||
foreach ($img as $paragraph) {
|
|
||||||
$paragraph->src=str_replace("127.0.0.1:8787", $url, $paragraph->src);
|
|
||||||
}
|
|
||||||
$change_img_attr=$html->save();
|
|
||||||
$v->img=str_replace("127.0.0.1:8787", $url, $v->img);
|
|
||||||
$v->content = $change_img_attr;
|
|
||||||
$v->save();
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,178 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
namespace app\controller\api\v1;
|
|
||||||
|
|
||||||
use support\Request;
|
|
||||||
|
|
||||||
use App\Utils\ApiResponse;
|
|
||||||
|
|
||||||
use App\model\Volunteerservicecorp;
|
|
||||||
use App\model\Users;
|
|
||||||
use App\model\Volunteerservicecorpsdetailed;
|
|
||||||
use App\model\Volunteerjoinrequest;
|
|
||||||
use App\model\Message;
|
|
||||||
use hg\apidoc\annotation as Apidoc;
|
|
||||||
use plugin\admin\app\model\User;
|
|
||||||
use App\dao\MessageDao;
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("志愿者队伍控制器")
|
|
||||||
*/
|
|
||||||
|
|
||||||
class VolunteerservicecorpsController
|
|
||||||
{
|
|
||||||
protected $noNeedLogin = [];
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取所有志愿队伍")
|
|
||||||
* @Apidoc\Url("api/v1/Volunteerservicecorps/get_volunteerservicecorp_list")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_volunteerservicecorp_list(Request $request)
|
|
||||||
{
|
|
||||||
$tmp = Volunteerservicecorp::all();
|
|
||||||
$res = [];
|
|
||||||
foreach ($tmp as $k => $v) {
|
|
||||||
$tmp2 = Volunteerservicecorpsdetailed::where('groupid', $v->id)->get();
|
|
||||||
$number = Volunteerservicecorpsdetailed::where('groupid', $v->id)->count();
|
|
||||||
$leader = Users::where('id', $v->leaderid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
foreach ($tmp2 as $key => $value) {
|
|
||||||
$member[] = Users::where('id', $value->userid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
}
|
|
||||||
$res['group'][] = array('groupname' => $v->groupname, 'leaderid' => $v->leaderid, 'groupid' => $v->id, "category" => $v->category, 'img' => $v->img, 'number' => $number, 'leader' => $leader, 'member' => $member);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 获取志愿队伍详细信息根据id")
|
|
||||||
* @Apidoc\Url("api/v1/Volunteerservicecorps/get_volunteerservicecorp_details")
|
|
||||||
* @Apidoc\Param("volunteerservicecorp_id", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function get_volunteerservicecorp_details(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$volunteerservicecorp_id = $data['volunteerservicecorp_id'];
|
|
||||||
$tmp = Volunteerservicecorp::where('id', $volunteerservicecorp_id)->get();
|
|
||||||
$res = [];
|
|
||||||
foreach ($tmp as $k => $v) {
|
|
||||||
$tmp2 = Volunteerservicecorpsdetailed::where('groupid', $v->id)->get();
|
|
||||||
$number = Volunteerservicecorpsdetailed::where('groupid', $v->id)->count();
|
|
||||||
$leader = Users::where('id', $v->leaderid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
foreach ($tmp2 as $key => $value) {
|
|
||||||
$member[] = Users::where('id', $value->userid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
}
|
|
||||||
$res['group'] = array('groupname' => $v->groupname, 'leaderid' => $v->leaderid, "category" => $v->category, 'briefly' => $v->briefly, 'created_at' => $v->created_at, 'img' => $v->img, 'number' => $number, 'leader' => $leader, 'member' => $member);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 志愿队伍报名接口")
|
|
||||||
* @Apidoc\Url("api/v1/Volunteerservicecorps/join")
|
|
||||||
* @Apidoc\Param("groupid", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function join(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$groupid = $data['groupid'];
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
//志愿者队伍
|
|
||||||
$isjoin = Volunteerservicecorpsdetailed::where('groupid', $groupid)->where('userid', $userid)->count();
|
|
||||||
//志愿者申请
|
|
||||||
$filed = Volunteerjoinrequest::where('groupid', $groupid)->where('userid', $userid)->count();
|
|
||||||
if ($isjoin > 0) {
|
|
||||||
return ApiResponse::success(402, [], "您已经报名过了");
|
|
||||||
}
|
|
||||||
if ($filed > 0) {
|
|
||||||
return ApiResponse::success(402, [], "申请已提交,待审核");
|
|
||||||
}
|
|
||||||
$tmp = Volunteerservicecorp::where('id', $groupid)->first();
|
|
||||||
$volunteerjoinrequest = new volunteerjoinrequest();
|
|
||||||
$volunteerjoinrequest->userid = $userid;
|
|
||||||
$volunteerjoinrequest->groupid = $groupid;
|
|
||||||
$volunteerjoinrequest->status = 0;
|
|
||||||
$volunteerjoinrequest->remark = "";
|
|
||||||
$volunteerjoinrequest->save();
|
|
||||||
MessageDao::SendMessage($userid,"系统通知","$tmp->groupname 申请已提交 等待队长审批");
|
|
||||||
//TODO这里没写队长通知 时间来不及
|
|
||||||
// Unset($Message);
|
|
||||||
// $Message = new Message();
|
|
||||||
// $Message->content = "您有一条待审批消息";
|
|
||||||
// $Message->title = "系统通知";
|
|
||||||
$user = User::where('id', $userid)->first();
|
|
||||||
$json['nickname'] = $user->nickname;
|
|
||||||
$json['userid'] = $user->id;
|
|
||||||
$json['groupid'] = $groupid;
|
|
||||||
// $Message->parameters = json_encode($json);
|
|
||||||
// $Message->userid = $tmp->leaderid;
|
|
||||||
// $Message->save();
|
|
||||||
MessageDao::SendMessage($tmp->leaderid,"系统通知","您有一条待审批消息",json_encode($json));
|
|
||||||
return ApiResponse::success(200, []);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 志愿队伍搜索接口")
|
|
||||||
* @Apidoc\Url("api/v1/Volunteerservicecorps/search")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="0是按照类型搜索1是按照名称")
|
|
||||||
* @Apidoc\Param("key", type="string",require=true, desc="key")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function search(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$type = $data['type'];
|
|
||||||
$key = $data['key'];
|
|
||||||
var_dump($type);
|
|
||||||
if ($type == 1) {
|
|
||||||
$Volunteerservicecorp = Volunteerservicecorp::where('groupname', 'like', '%' . $key . '%')->get();
|
|
||||||
} else {
|
|
||||||
$Volunteerservicecorp = Volunteerservicecorp::where('category', 'like', '%' . $key . '%')->get();
|
|
||||||
}
|
|
||||||
$tmp = $Volunteerservicecorp;
|
|
||||||
$res = [];
|
|
||||||
foreach ($tmp as $k => $v) {
|
|
||||||
$tmp2 = Volunteerservicecorpsdetailed::where('groupid', $v->id)->get();
|
|
||||||
$number = Volunteerservicecorpsdetailed::where('groupid', $v->id)->count();
|
|
||||||
$leader = Users::where('id', $v->leaderid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
foreach ($tmp2 as $key => $value) {
|
|
||||||
$member[] = Users::where('id', $value->userid)->first(['nickname', 'phone', 'avatar']);
|
|
||||||
}
|
|
||||||
$res['group'][] = array('groupname' => $v->groupname, 'leaderid' => $v->leaderid, 'groupid' => $v->id, "category" => $v->category, 'img' => $v->img, 'number' => $number, 'leader' => $leader, 'member' => $member);
|
|
||||||
}
|
|
||||||
return ApiResponse::success(200, $res);
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @Apidoc\Title("1.0 志愿队伍审批接口")
|
|
||||||
* @Apidoc\Url("api/v1/Volunteerservicecorps/approval")
|
|
||||||
* @Apidoc\Param("type", type="int",require=true, desc="0同意1不同意")
|
|
||||||
* @Apidoc\Param("groupid", type="int",require=true, desc="队伍id")
|
|
||||||
* @Apidoc\Param("userid", type="int",require=true, desc="userid")
|
|
||||||
* @Apidoc\Method("POST")
|
|
||||||
*/
|
|
||||||
public function approval(Request $request)
|
|
||||||
{
|
|
||||||
$data = $request->post();
|
|
||||||
$user = $request->data;
|
|
||||||
$userid = $user['id'];
|
|
||||||
$Volunteerservicecorp = Volunteerservicecorp::where('id', $data['groupid'])->first();
|
|
||||||
if ($userid != $Volunteerservicecorp->leaderid) {
|
|
||||||
return ApiResponse::success(402, [], '不是队长没有审核权限');
|
|
||||||
}
|
|
||||||
if ($user['type'] == 0) {
|
|
||||||
$volunteerservicecorpsdetailed = new Volunteerservicecorpsdetailed();
|
|
||||||
$volunteerservicecorpsdetailed->userid = $data['userid'];
|
|
||||||
$volunteerservicecorpsdetailed->groupid = $data['groupid'];
|
|
||||||
$volunteerservicecorpsdetailed->save();
|
|
||||||
$volunteerjoinrequest = volunteerjoinrequest::where('groupid', $data['groupid'])->where('userid', $data['userid'])->first();
|
|
||||||
$volunteerjoinrequest->status = 2;
|
|
||||||
$volunteerjoinrequest->save();
|
|
||||||
$Volunteerservicecorp = Volunteerservicecorp::where('id', $data['groupid'])->first();
|
|
||||||
MessageDao::SendMessage($data['userid'],"系统通知","您加入的志愿队 $Volunteerservicecorp->groupname 已同意申请");
|
|
||||||
return ApiResponse::success(200, [], '成功');
|
|
||||||
}
|
|
||||||
$volunteerjoinrequest = volunteerjoinrequest::where('groupid', $data['groupid'])->where('userid', $data['userid'])->first();
|
|
||||||
$volunteerjoinrequest->status = 1;
|
|
||||||
MessageDao::SendMessage($data['userid'],"系统通知","您加入的志愿队 $Volunteerservicecorp->groupname 已拒绝您的申请");
|
|
||||||
$volunteerjoinrequest->save();
|
|
||||||
return ApiResponse::success(200, [], '成功');
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,110 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\model\app;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id ID (主键)
|
||||||
|
* @property string $title 标题
|
||||||
|
* @property string $content 内容 (包含 HTML)
|
||||||
|
* @property integer $status 状态 0禁用 1启用
|
||||||
|
* @property string $status_text 状态文本
|
||||||
|
* @property integer $createtime 创建时间
|
||||||
|
* @property integer $updatetime 更新时间
|
||||||
|
*/
|
||||||
|
class Announcement extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'announcements'; // 表名
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id'; // 主键
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true; // 不使用自动时间戳
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可以赋值字段
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'title',
|
||||||
|
'content',
|
||||||
|
'status',
|
||||||
|
'status_text',
|
||||||
|
'createtime',
|
||||||
|
'updatetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 字段类型
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'createtime' => 'integer',
|
||||||
|
'updatetime' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取创建时间的格式化值
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCreatetimeAttribute($value)
|
||||||
|
{
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取更新时间的格式化值
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUpdatetimeAttribute($value)
|
||||||
|
{
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取状态文本
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getStatusTextAttribute($value)
|
||||||
|
{
|
||||||
|
return $value ?? '未设置';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* CREATE TABLE `announcements` (
|
||||||
|
`id` INT(11) UNSIGNED AUTO_INCREMENT PRIMARY KEY COMMENT 'ID (主键)',
|
||||||
|
`title` VARCHAR(255) NOT NULL COMMENT '标题',
|
||||||
|
`content` TEXT NOT NULL COMMENT '内容 (包含 HTML)',
|
||||||
|
`status` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '状态 0禁用 1启用',
|
||||||
|
`status_text` VARCHAR(255) DEFAULT NULL COMMENT '状态文本',
|
||||||
|
`createtime` INT(11) UNSIGNED NOT NULL COMMENT '创建时间',
|
||||||
|
`updatetime` INT(11) UNSIGNED DEFAULT NULL COMMENT '更新时间',
|
||||||
|
KEY `status` (`status`),
|
||||||
|
KEY `createtime` (`createtime`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='公告表';
|
||||||
|
|
||||||
|
*/
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace app\model\app;
|
||||||
|
|
||||||
|
use support\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @property integer $id ID (主键)
|
||||||
|
* @property string $username 用户名
|
||||||
|
* @property string $invite_code 邀请码
|
||||||
|
* @property integer $is_active 是否激活
|
||||||
|
* @property string $login_ip 登录 IP
|
||||||
|
* @property string $join_ip 加入 IP
|
||||||
|
* @property integer $login_time 登录时间
|
||||||
|
* @property integer $prev_time 上次登录时间
|
||||||
|
* @property integer $status 状态 0正常 1禁用
|
||||||
|
* @property float $money 账户余额
|
||||||
|
* @property float $admin_money 管理员余额
|
||||||
|
* @property float $all_team_money 总团队余额
|
||||||
|
* @property float $task_income_money 任务收入
|
||||||
|
* @property integer $task_status 任务状态
|
||||||
|
* @property float $today_task_income 今日任务收入
|
||||||
|
* @property float $today_team_income 今日团队收入
|
||||||
|
* @property integer $growth_value 成长值
|
||||||
|
* @property integer $vip_id VIP ID
|
||||||
|
* @property float $withdraw_money 提现金额
|
||||||
|
* @property integer $f_id 上级ID
|
||||||
|
* @property integer $ff_id 二级上级ID
|
||||||
|
* @property integer $fff_id 三级上级ID
|
||||||
|
* @property integer $top_id 顶级ID
|
||||||
|
* @property string $path 路径
|
||||||
|
* @property string $remark 备注
|
||||||
|
* @property integer $createtime 创建时间
|
||||||
|
* @property integer $updatetime 更新时间
|
||||||
|
*/
|
||||||
|
class User extends Model
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The table associated with the model.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $table = 'user_info'; // 表名
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key associated with the table.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $primaryKey = 'id'; // 主键
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Indicates if the model should be timestamped.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $timestamps = true; // 如果不需要自动维护创建和更新时间,可以将此设置为 false
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that are mass assignable.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $fillable = [
|
||||||
|
'username',
|
||||||
|
'invite_code',
|
||||||
|
'is_active',
|
||||||
|
'login_ip',
|
||||||
|
'join_ip',
|
||||||
|
'login_time',
|
||||||
|
'prev_time',
|
||||||
|
'status',
|
||||||
|
'money',
|
||||||
|
'admin_money',
|
||||||
|
'all_team_money',
|
||||||
|
'task_income_money',
|
||||||
|
'task_status',
|
||||||
|
'today_task_income',
|
||||||
|
'today_team_income',
|
||||||
|
'growth_value',
|
||||||
|
'vip_id',
|
||||||
|
'withdraw_money',
|
||||||
|
'f_id',
|
||||||
|
'ff_id',
|
||||||
|
'fff_id',
|
||||||
|
'top_id',
|
||||||
|
'path',
|
||||||
|
'remark',
|
||||||
|
'createtime',
|
||||||
|
'updatetime',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attributes that should be cast to native types.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $casts = [
|
||||||
|
'money' => 'float',
|
||||||
|
'admin_money' => 'float',
|
||||||
|
'all_team_money' => 'float',
|
||||||
|
'task_income_money' => 'float',
|
||||||
|
'today_task_income' => 'float',
|
||||||
|
'today_team_income' => 'float',
|
||||||
|
'growth_value' => 'integer',
|
||||||
|
'withdraw_money' => 'float',
|
||||||
|
'createtime' => 'integer',
|
||||||
|
'updatetime' => 'integer',
|
||||||
|
'status' => 'integer',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取登录时间的格式化值
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getLoginTimeAttribute($value)
|
||||||
|
{
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取创建时间的格式化值
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getCreatetimeAttribute($value)
|
||||||
|
{
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取更新时间的格式化值
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getUpdatetimeAttribute($value)
|
||||||
|
{
|
||||||
|
return date('Y-m-d H:i:s', $value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CREATE TABLE `users` (
|
||||||
|
`id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||||
|
`username` VARCHAR(255) NOT NULL COMMENT '用户名',
|
||||||
|
`invite_code` VARCHAR(255) NOT NULL COMMENT '邀请码',
|
||||||
|
`is_active` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '是否激活 (0:未激活, 1:已激活)',
|
||||||
|
`login_ip` VARCHAR(45) NOT NULL COMMENT '最后登录IP',
|
||||||
|
`join_ip` VARCHAR(45) NOT NULL COMMENT '注册IP',
|
||||||
|
`login_time` INT(11) NOT NULL COMMENT '最后登录时间 (Unix时间戳)',
|
||||||
|
`prev_time` INT(11) NOT NULL COMMENT '上次活动时间 (Unix时间戳)',
|
||||||
|
`status` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '状态 (1: 正常, 0: 禁用)',
|
||||||
|
`money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '账户余额',
|
||||||
|
`admin_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '管理员账户余额',
|
||||||
|
`all_team_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '团队总金额',
|
||||||
|
`task_income_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '任务收入金额',
|
||||||
|
`task_status` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '任务状态 (0: 未完成, 1: 完成)',
|
||||||
|
`today_task_income` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '今天的任务收入',
|
||||||
|
`today_team_income` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '今天的团队收入',
|
||||||
|
`growth_value` INT(11) NOT NULL DEFAULT 0 COMMENT '成长值',
|
||||||
|
`vip_id` INT(11) NOT NULL DEFAULT 0 COMMENT 'VIP等级ID',
|
||||||
|
`withdraw_money` DECIMAL(10,2) NOT NULL DEFAULT 0.00 COMMENT '可提现金额',
|
||||||
|
`f_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上一级用户ID',
|
||||||
|
`ff_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上上级用户ID',
|
||||||
|
`fff_id` INT(11) NOT NULL DEFAULT 0 COMMENT '上上上级用户ID',
|
||||||
|
`top_id` INT(11) NOT NULL DEFAULT 0 COMMENT '最高层级ID',
|
||||||
|
`path` TEXT NOT NULL COMMENT '用户路径',
|
||||||
|
`remark` TEXT DEFAULT NULL COMMENT '备注',
|
||||||
|
`createtime` INT(11) NOT NULL COMMENT '创建时间 (Unix时间戳)',
|
||||||
|
`updatetime` INT(11) NOT NULL DEFAULT 0 COMMENT '更新时间 (Unix时间戳)',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `invite_code` (`invite_code`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户信息表';
|
||||||
|
|
||||||
|
*/
|
Binary file not shown.
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue