增加前端对接api
This commit is contained in:
parent
c016641044
commit
b9ed2860c3
|
@ -7,21 +7,23 @@ namespace App\Utils;
|
|||
*/
|
||||
class ApiResponseApp
|
||||
{
|
||||
public static function success($code = 1, $data = [], $message = '请求成功')
|
||||
public static function success($data = [], $message = '请求成功')
|
||||
{
|
||||
$code = 1;
|
||||
return json([
|
||||
'code' => $code,
|
||||
'data' => $data,
|
||||
'message' => $message,
|
||||
'msg' => $message,
|
||||
'time' => time()
|
||||
]);
|
||||
}
|
||||
|
||||
public static function error($code = 400, $data = [], $message = '操作失败')
|
||||
public static function error($data = [], $message = '操作失败')
|
||||
{
|
||||
$code = 0;
|
||||
return json([
|
||||
'code' => $code,
|
||||
'message' => $message,
|
||||
'msg' => $message,
|
||||
'data' => $data,
|
||||
'time' => time()
|
||||
]);
|
||||
|
|
|
@ -0,0 +1,70 @@
|
|||
<?php
|
||||
namespace App\Utils;
|
||||
/**
|
||||
* 随机生成类
|
||||
*/
|
||||
class Random
|
||||
{
|
||||
/**
|
||||
* 生成随机字符串,数字,大小写字母随机组合
|
||||
*
|
||||
* @param int $length 长度
|
||||
* @param int $type 类型,1 纯数字,2 纯小写字母,3 纯大写字母,4 数字和小写字母,5 数字和大写字母,6 大小写字母,7 数字和大小写字母
|
||||
*/
|
||||
public static function str_random($length = 6, $type = 1)
|
||||
{
|
||||
// 取字符集数组
|
||||
$number = range(0, 9);
|
||||
$lowerLetter = range('a', 'z');
|
||||
$upperLetter = range('A', 'Z');
|
||||
// 根据type合并字符集
|
||||
if ($type == 1) {
|
||||
$charset = $number;
|
||||
} elseif ($type == 2) {
|
||||
$charset = $lowerLetter;
|
||||
} elseif ($type == 3) {
|
||||
$charset = $upperLetter;
|
||||
} elseif ($type == 4) {
|
||||
$charset = array_merge($number, $lowerLetter);
|
||||
} elseif ($type == 5) {
|
||||
$charset = array_merge($number, $upperLetter);
|
||||
} elseif ($type == 6) {
|
||||
$charset = array_merge($lowerLetter, $upperLetter);
|
||||
} elseif ($type == 7) {
|
||||
$charset = array_merge($number, $lowerLetter, $upperLetter);
|
||||
} else {
|
||||
$charset = $number;
|
||||
}
|
||||
$str = '';
|
||||
// 生成字符串
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$str .= $charset[mt_rand(0, count($charset) - 1)];
|
||||
// 验证规则
|
||||
if ($type == 4 && strlen($str) >= 2) {
|
||||
if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str)) {
|
||||
$str = substr($str, 0, -1);
|
||||
$i = $i - 1;
|
||||
}
|
||||
}
|
||||
if ($type == 5 && strlen($str) >= 2) {
|
||||
if (!preg_match('/\d+/', $str) || !preg_match('/[A-Z]+/', $str)) {
|
||||
$str = substr($str, 0, -1);
|
||||
$i = $i - 1;
|
||||
}
|
||||
}
|
||||
if ($type == 6 && strlen($str) >= 2) {
|
||||
if (!preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) {
|
||||
$str = substr($str, 0, -1);
|
||||
$i = $i - 1;
|
||||
}
|
||||
}
|
||||
if ($type == 7 && strlen($str) >= 3) {
|
||||
if (!preg_match('/\d+/', $str) || !preg_match('/[a-z]+/', $str) || !preg_match('/[A-Z]+/', $str)) {
|
||||
$str = substr($str, 0, -2);
|
||||
$i = $i - 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
|
@ -1,153 +0,0 @@
|
|||
<?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("基础控制器")
|
||||
*/
|
||||
|
||||
class Apiv1Controller
|
||||
{
|
||||
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 get_carousel(Request $request)
|
||||
{
|
||||
// return json(['code' => 0, 'msg' => 'ok']);
|
||||
$res['carousel'] = Carousel::all();
|
||||
$res['carouselad'] = Carouselad::all();
|
||||
return ApiResponse::success(200, $res);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取所有项目")
|
||||
* @Apidoc\Url("Apiv1/get_project")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function get_project(Request $request)
|
||||
{
|
||||
//志愿者人数
|
||||
// $tmp=Project::all();
|
||||
// foreach($tmp as $k=>$v){
|
||||
// $res_volunteer=ProjectRegister::where('projectid',$v->id)->where('type',0)->count();
|
||||
// //被服务者人数
|
||||
// $res_servants=ProjectRegister::where('projectid',$v->id)->where('type',1)->count();
|
||||
// $ProjectDetailed = ProjectDetailed::where('projectid',$v->id)->first();
|
||||
// $data = array(
|
||||
// "id" => $v->id,
|
||||
// "created_at" => $v->created_at,
|
||||
// "updated_at" => $v->updated_at,
|
||||
// "img" => $v->img,
|
||||
// "start_time" => $v->start_time,
|
||||
// "end_time" => $v->end_time,
|
||||
// "address" => $v->address,
|
||||
// "title" => $v->title,
|
||||
// "type" => $v->type,
|
||||
// "volunteer_max"=>$ProjectDetailed->recruitingpersonnel,
|
||||
// "servants_max"=>$ProjectDetailed->registerserve,
|
||||
// "volunteer"=>$res_volunteer,
|
||||
// "servants"=>$res_servants
|
||||
// );
|
||||
// $res[]=$data;
|
||||
// }
|
||||
/**
|
||||
* ?优化
|
||||
*/
|
||||
$res = Db::table('project')
|
||||
->leftJoin('project_register as pr', 'project.id', '=', 'pr.projectid')
|
||||
->leftJoin('project_detailed as pd', 'project.id', '=', 'pd.projectid')
|
||||
->select(
|
||||
'project.*',
|
||||
'pd.recruitingpersonnel',
|
||||
'pd.registerserve',
|
||||
Db::raw('COUNT(CASE WHEN pr.type = 0 THEN 1 END) as volunteer'),
|
||||
Db::raw('COUNT(CASE WHEN pr.type = 1 THEN 1 END) as servants')
|
||||
)
|
||||
->groupBy('project.id')
|
||||
->orderBy('project.id', 'DESC')
|
||||
->get();
|
||||
|
||||
// 转换为期望的数据结构
|
||||
foreach ($res as &$v) {
|
||||
$v->volunteer_max = $v->recruitingpersonnel;
|
||||
$v->servants_max = $v->registerserve;
|
||||
unset($v->recruitingpersonnel, $v->registerserve); // 清理不需要的字段
|
||||
}
|
||||
return ApiResponse::success(200, $res);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取项目详细信息根据id")
|
||||
* @Apidoc\Url("Apiv1/get_projectdetailed")
|
||||
* @Apidoc\Method("POST")
|
||||
* @Apidoc\Query("projectid", type="int",require=true, desc="项目id",default="1")
|
||||
* @Apidoc\Returned("projectdetailed", type="string", desc="项目详细信息")
|
||||
*/
|
||||
public function get_projectdetailed(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$res['project'] = Project::where('id', $data['projectid'])->first();
|
||||
$res['projectdetailed'] = ProjectDetailed::where('projectid', $data['projectid'])->first();
|
||||
//志愿者人数
|
||||
$res_volunteer = ProjectRegister::where('projectid', $data['projectid'])->where('type', 0)->count();
|
||||
//被服务者人数
|
||||
$res_servants = ProjectRegister::where('projectid', $data['projectid'])->where('type', 1)->count();
|
||||
$res['projectRegister'] = ProjectRegister::where('projectid', $data['projectid'])->get();
|
||||
$res['volunteer'] = $res_volunteer;
|
||||
$res['servants'] = $res_servants;
|
||||
$res['volunteer_max'] = $res['projectdetailed']->recruitingpersonnel;
|
||||
$res['servants_max'] = $res['projectdetailed']->registerserve;
|
||||
return ApiResponse::success(200, $res);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取所有养老机构")
|
||||
* @Apidoc\Url("Apiv1/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("Apiv1/get_mechanism")
|
||||
* @Apidoc\Query("mechanism", type="int",require=true, desc="养老机构id",default="1")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function get_mechanism(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$res = Mechanism::where('id', $data['id'])->get();
|
||||
return ApiResponse::success(200, $res);
|
||||
}
|
||||
}
|
|
@ -4,7 +4,7 @@ namespace app\controller;
|
|||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponse;
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
use App\model\Carousel;
|
||||
use App\model\Project;
|
||||
|
@ -34,9 +34,7 @@ class TaskController
|
|||
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);
|
||||
return ApiResponseApp::success(1, $request->header('token'));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponse;
|
||||
|
||||
|
||||
use Tinywan\Jwt\JwtToken;
|
||||
use App\model\Users;
|
||||
|
||||
class UserController
|
||||
{
|
||||
|
||||
/**
|
||||
* 不需要登录的方法
|
||||
*/
|
||||
protected $noNeedLogin = ['login','register'];
|
||||
|
||||
/**
|
||||
* Undocumented function
|
||||
* 登录
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
// 获取请求数据
|
||||
$data = $request->post();
|
||||
|
||||
// 根据手机号查询用户
|
||||
$db = Users::where('phone', '=', $data['phone'])->first();
|
||||
|
||||
// 如果未找到用户,返回错误
|
||||
if (!$db) {
|
||||
return ApiResponse::error(402,[] ,'用户未注册');
|
||||
}
|
||||
|
||||
// 获取用户输入的密码
|
||||
$password = $data['password'];
|
||||
|
||||
// 验证密码是否正确
|
||||
if (password_verify($password, $db->password)) {
|
||||
$user = [
|
||||
'id' => $db->id,
|
||||
'nickname' => $db->nickname,
|
||||
'phone' => $db->phone
|
||||
];
|
||||
// 如果密码正确,生成 JWT 令牌
|
||||
$token = JwtToken::generateToken($user);
|
||||
|
||||
// 返回成功响应和用户信息(可以将 token 添加到响应中)
|
||||
return ApiResponse::success(200, [
|
||||
'user' => $user, // 返回用户信息
|
||||
'token' => $token // 返回生成的 token
|
||||
]);
|
||||
} else {
|
||||
// 密码错误,返回错误响应
|
||||
return ApiResponse::error(402,[], '用户或密码错误');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$res = [];
|
||||
return ApiResponse::success(200, $res);
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ use support\exception\BusinessException;
|
|||
use Tinywan\Jwt\JwtToken;
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("用户控制器")
|
||||
* @Apidoc\Title("admin用户控制器")
|
||||
*/
|
||||
class AccountController
|
||||
{
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller\api;
|
||||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
|
||||
use App\model\Dictionary;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
use support\Db;
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("公共控制器?")
|
||||
*/
|
||||
|
||||
class CommonController
|
||||
{
|
||||
protected $noNeedLogin = ['config', 'get_project', 'get_projectdetailed', 'get_mechanism_list'];
|
||||
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取全局配置")
|
||||
* @Apidoc\Url("api/common/config")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function config(Request $request)
|
||||
{
|
||||
|
||||
$Dictionary=Dictionary::all();
|
||||
$res=[];
|
||||
$res = [
|
||||
"account_notice" => "Log in to link account and get 300 to 3,000 random points a day",
|
||||
"vi_rate" => "2.49",
|
||||
"trx_rate" => "0.00",
|
||||
"nrly_rate" => "30",
|
||||
"trx_rate1" => "",
|
||||
"inr_rate" => "1.62",
|
||||
"php_rate" => null,
|
||||
"brl_rate" => "0.10",
|
||||
"brl_fee" => "300",
|
||||
"pkr_fee" => "300",
|
||||
"pkr_rate" => "5",
|
||||
"pkr_min" => "2000",
|
||||
"brl_min" => "5000"
|
||||
];
|
||||
$col=['service_1','service_2','service_3','service_url','service_user_url','points'];
|
||||
foreach($Dictionary as $key=>$value){
|
||||
$res[$value->key]=$value->value;
|
||||
}
|
||||
return ApiResponseApp::success($res);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 消息根据type 判断类型")
|
||||
* @Apidoc\Url("api/common/messageList")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function messageList(Request $request){
|
||||
$type=$request->get('type');
|
||||
/**
|
||||
* 返回轮播图
|
||||
*/
|
||||
if($type==5){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller\api;
|
||||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
|
||||
use App\model\Reward;
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
use support\Db;
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("公共控制器?")
|
||||
*/
|
||||
|
||||
class TurntableController
|
||||
{
|
||||
protected $noNeedLogin = ['lists', 'get_project', 'get_projectdetailed', 'get_mechanism_list'];
|
||||
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 返回抽奖配置")
|
||||
* @Apidoc\Url("api/Tturntable/lists")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function lists(Request $request)
|
||||
{
|
||||
|
||||
$res=Reward::all();
|
||||
return ApiResponseApp::success($res);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 抽奖点击后暂时不知道有什么用")
|
||||
* @Apidoc\Url("api/Tturntable/lottery")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function lottery(Request $request)
|
||||
{
|
||||
|
||||
$res=Reward::all();
|
||||
return ApiResponseApp::success($res);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller\api;
|
||||
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponse;
|
||||
use App\Utils\Random;
|
||||
|
||||
use Tinywan\Jwt\JwtToken;
|
||||
use App\model\User;
|
||||
use App\Utils\ApiResponseApp;
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("用户控制器")
|
||||
*/
|
||||
|
||||
class UserController
|
||||
{
|
||||
|
||||
/**
|
||||
* 不需要登录的方法
|
||||
*/
|
||||
protected $noNeedLogin = ['login', 'register'];
|
||||
|
||||
/**
|
||||
* 登录
|
||||
* @param Request $request
|
||||
* @return void
|
||||
*/
|
||||
public function login(Request $request)
|
||||
{
|
||||
// 获取请求数据
|
||||
$username = $request->post('username');
|
||||
$password = $request->post('password');
|
||||
// 根据手机号查询用户
|
||||
$user = User::where('username', '=', $username)->first();
|
||||
|
||||
// // 如果未找到用户,返回错误
|
||||
if (!$user) {
|
||||
return ApiResponseApp::error('账号或密码错误');
|
||||
}
|
||||
|
||||
// 验证密码是否正确
|
||||
if (!password_verify($password, $user->password)) {
|
||||
return ApiResponseApp::error('账号或密码错误');
|
||||
}
|
||||
$user->login_ip = $request->getRealIp($safe_mode = true);
|
||||
$user->login_time = time();
|
||||
$user->save();
|
||||
$tmp = [
|
||||
'id' => $user->id,
|
||||
'username' => $user->username,
|
||||
'access_exp' => 2592000,
|
||||
];
|
||||
// 如果密码正确,生成 JWT 令牌
|
||||
$token = JwtToken::generateToken($tmp);
|
||||
$createtime=time();
|
||||
// 返回成功响应和用户信息(可以将 token 添加到响应中)
|
||||
$res = array('userinfo' => array('createtime' => $createtime, 'expires_in' => $tmp['access_exp'], 'expiretime' => $createtime+$tmp['access_exp'], 'id' => $user->id, 'money' => $user->money, 'token' => $token['access_token'], 'user_id' => $user->id, 'username' => $user->username));
|
||||
return ApiResponseApp::success($res,'登录成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册
|
||||
*/
|
||||
public function register(Request $request)
|
||||
{
|
||||
$username = $request->post('username');
|
||||
$password = $request->post('password');
|
||||
$invitation = $request->post('invitation');
|
||||
|
||||
if (User::where('username', $username)->count() > 0) {
|
||||
return ApiResponseApp::error([], "账号已存在");
|
||||
}
|
||||
$f_id = 0;
|
||||
if (!empty($invitation)) {
|
||||
if (User::where('invite_code', $invitation)->count() == 0) {
|
||||
return ApiResponseApp::error([], "代理不存在");
|
||||
} else {
|
||||
$f_id = User::where('invite_code', $invitation)->first('id');
|
||||
}
|
||||
}
|
||||
$user = new User();
|
||||
$col = ['username'];
|
||||
foreach ($col as $v) {
|
||||
$user->$v = $request->post($v);
|
||||
}
|
||||
$user->join_ip = $request->getRealIp($safe_mode = true);
|
||||
$user->f_id = $f_id;
|
||||
$user->invite_code = Random::str_random(5);
|
||||
$user->password = password_hash($password, PASSWORD_DEFAULT);
|
||||
$user->save();
|
||||
return ApiResponseApp::success([], '注册成功');
|
||||
}
|
||||
public function userInfo(Request $request) {
|
||||
$user_id= $request->data['id'];
|
||||
$user=User::find($user_id);
|
||||
return ApiResponseApp::success($user);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace app\controller;
|
||||
namespace app\controller\api;
|
||||
|
||||
use app\model\User;
|
||||
use support\Request;
|
||||
|
||||
use App\Utils\ApiResponse;
|
||||
|
@ -11,7 +12,8 @@ use App\model\Project;
|
|||
use App\model\ProjectDetailed;
|
||||
use App\model\ProjectRegister;
|
||||
use App\model\Carouselad;
|
||||
use App\model\Mechanism;
|
||||
use App\model\VipLevel;
|
||||
use App\Utils\ApiResponseApp;
|
||||
use Tinywan\Jwt\JwtToken;
|
||||
|
||||
use hg\apidoc\annotation as Apidoc;
|
||||
|
@ -23,31 +25,29 @@ use support\Db;
|
|||
|
||||
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']);
|
||||
}
|
||||
protected $noNeedLogin = [ 'get_project', 'get_projectdetailed', 'get_mechanism_list'];
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取首页轮播图")
|
||||
* @Apidoc\Url("Apiv1/get_carousel")
|
||||
* @Apidoc\Url("api/vip_salary/product")
|
||||
* @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);
|
||||
$user_id=$request->data['id'];
|
||||
var_dump($user_id);
|
||||
$user=User::find($user_id);
|
||||
return ApiResponseApp::success(['user_count'=>$user->vip_id]);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取vip等级赠送积分")
|
||||
* @Apidoc\Url("api/vip_salary/product")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function product(Request $request)
|
||||
{
|
||||
$res = VipLevel::all();
|
||||
return ApiResponseApp::success($res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ use App\model\Jobuser;
|
|||
* @Apidoc\Title("JOB用户控制器")
|
||||
*/
|
||||
class JobuserController
|
||||
{
|
||||
{
|
||||
/**
|
||||
* @Apidoc\Title("获取JOB用户列表")
|
||||
* @Apidoc\Url("/api/v1/jobuser/lists")
|
||||
|
@ -24,7 +24,7 @@ class JobuserController
|
|||
*/
|
||||
public function lists(Request $request)
|
||||
{
|
||||
// 获取请求体中的参数
|
||||
// 获取请求体中的参数
|
||||
$params = $request->all();
|
||||
|
||||
// 初始化查询构造器
|
||||
|
@ -43,10 +43,10 @@ class JobuserController
|
|||
$query->where('username', 'like', '%' . $params['username'] . '%');
|
||||
});
|
||||
$db = $query->get();
|
||||
return ApiResponse::success (200, $db);
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Apidoc\Title("拉黑账户")
|
||||
* @Apidoc\Url("/api/v1/jobuser/getBlack")
|
||||
* @Apidoc\Method("POST")
|
||||
|
@ -56,15 +56,15 @@ class JobuserController
|
|||
{
|
||||
$data = $request->post();
|
||||
//根据id更改数据black字段的值
|
||||
$db = Jobuser::where('id', $data['id'])->update(['black'=>1]);
|
||||
$db = Jobuser::where('id', $data['id'])->update(['black' => 1]);
|
||||
//操作不成功
|
||||
if (!$db) {
|
||||
return ApiResponse::error (402, '操作失败');
|
||||
return ApiResponse::error(402, '操作失败');
|
||||
}
|
||||
return ApiResponse::success (200, $db );
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Apidoc\Title("洗白账户")
|
||||
* @Apidoc\Url("/api/v1/jobuser/getOutBlack")
|
||||
* @Apidoc\Method("POST")
|
||||
|
@ -74,15 +74,15 @@ class JobuserController
|
|||
{
|
||||
$data = $request->post();
|
||||
//根据id更改数据black字段的值
|
||||
$db = Jobuser::where('id', $data['id'])->update(['black'=>null]);
|
||||
$db = Jobuser::where('id', $data['id'])->update(['black' => null]);
|
||||
//操作不成功
|
||||
if (!$db) {
|
||||
return ApiResponse::error (402, '操作失败');
|
||||
return ApiResponse::error(402, '操作失败');
|
||||
}
|
||||
return ApiResponse::success (200, $db );
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Apidoc\Title("根据id找账户")
|
||||
* @Apidoc\Url("/api/v1/jobuser/getUserById")
|
||||
* @Apidoc\Method("POST")
|
||||
|
@ -95,172 +95,8 @@ class JobuserController
|
|||
$db = Jobuser::where('user_id', $data['id'])->first();
|
||||
//操作不成功
|
||||
if (!$db) {
|
||||
return ApiResponse::error (402, '操作失败');
|
||||
return ApiResponse::error(402, '操作失败');
|
||||
}
|
||||
return ApiResponse::success (200, $db );
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 登录")
|
||||
// * @Apidoc\Url("api/v1/user/login")
|
||||
// * @Apidoc\Method("POST")
|
||||
// * @Apidoc\Param("phone", type="string",require=true, desc="用户名|手机号")
|
||||
// * @Apidoc\Param("password", type="string",require=true, desc="密码")
|
||||
// * @Apidoc\Returned("user", type="object", desc="用户信息")
|
||||
// * @Apidoc\Returned("token", type="object", desc="令牌")
|
||||
// */
|
||||
// public function login(Request $request)
|
||||
// {
|
||||
// // 获取请求数据
|
||||
// $data = $request->post();
|
||||
|
||||
// // 根据手机号查询用户
|
||||
// $db = Users::where('phone', '=', $data['phone'])->first();
|
||||
|
||||
// // 如果未找到用户,返回错误
|
||||
// if (!$db) {
|
||||
// return ApiResponse::error(402, '用户未注册');
|
||||
// }
|
||||
|
||||
// // 获取用户输入的密码
|
||||
// $password = $data['password'];
|
||||
|
||||
// // 验证密码是否正确
|
||||
// if (password_verify($password, $db->password)) {
|
||||
// $user = [
|
||||
// 'id' => $db->id,
|
||||
// 'nickname' => $db->nickname,
|
||||
// 'phone' => $db->phone
|
||||
// ];
|
||||
// // 如果密码正确,生成 JWT 令牌
|
||||
// $token = JwtToken::generateToken($user);
|
||||
|
||||
// // 返回成功响应和用户信息(可以将 token 添加到响应中)
|
||||
// return ApiResponse::success(200, [
|
||||
// 'user' => $user, // 返回用户信息
|
||||
// 'token' => $token // 返回生成的 token
|
||||
// ]);
|
||||
// } else {
|
||||
// // 密码错误,返回错误响应
|
||||
// return ApiResponse::error(402, '密码错误');
|
||||
// }
|
||||
// }
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 注册")
|
||||
// * @Apidoc\Url("api/v1/user/register")
|
||||
// * @Apidoc\Method("POST")
|
||||
// * @Apidoc\Param("phone", type="string",require=true, desc="用户名|手机号")
|
||||
// * @Apidoc\Param("password", type="string",require=true, desc="密码")
|
||||
// * @Apidoc\Param("idcard", type="string",require=true, desc="身份证号")
|
||||
// * @Apidoc\Returned("token", type="object", desc="令牌")
|
||||
// */
|
||||
// public function register(Request $request)
|
||||
// {
|
||||
// $data = $request->post();
|
||||
// $user = UserDao::register($data['phone'], $data['password'], $data['idcard']);
|
||||
// if ($user['code'] != 200) {
|
||||
// return ApiResponse::error(402, [], $user['message']);
|
||||
// }
|
||||
// $db = Users::where('phone', '=', $data['phone'])->first();
|
||||
// $user = [
|
||||
// 'id' => $db->id,
|
||||
// 'nickname' => $db->nickname,
|
||||
// 'phone' => $db->phone
|
||||
// ];
|
||||
// // 如果密码正确,生成 JWT 令牌
|
||||
// $token = JwtToken::generateToken($user);
|
||||
// $msg = new Message();
|
||||
// $msg->title ="系统提醒";
|
||||
// $msg->content = "您已注册成功";
|
||||
// $msg->type =0;
|
||||
// $msg->userid =$db->id;
|
||||
// $msg->parameters="";
|
||||
// // 返回成功响应和用户信息(可以将 token 添加到响应中)
|
||||
// return ApiResponse::success(200, [
|
||||
// 'user' => $user, // 返回用户信息
|
||||
// 'token' => $token // 返回生成的 token
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 修改用户信息")
|
||||
// * @Apidoc\Url("api/v1/user/edi")
|
||||
// * @Apidoc\Method("POST")
|
||||
// * @Apidoc\Param("nickname", type="string",require=true, desc="昵称")
|
||||
// * @Apidoc\Param("oldpassword", type="string",require=true, desc="旧密码")
|
||||
// * @Apidoc\Param("password", type="string",require=true, desc="密码")
|
||||
// */
|
||||
// public function edi(Request $request)
|
||||
// {
|
||||
// $data = $request->post();
|
||||
// $user = $request->data;
|
||||
// $userid = $user['id'];
|
||||
// $db = Users::where('id', '=', $userid)->first();
|
||||
// if (isset($data['password']) && $data['password'] != '') {
|
||||
// if (password_verify($data['oldpassword'], $db->password)) {
|
||||
// UserDao::chang_passwd($userid, $data['password']);
|
||||
// return ApiResponse::success(200, [], "修改密码成功");
|
||||
// }
|
||||
// return ApiResponse::success(402, [], "旧密码错误");
|
||||
// }
|
||||
// if (isset($data['nickname']) && $data['nickname'] != '') {
|
||||
// UserDao::chang_nickname($userid, $data['nickname']);
|
||||
|
||||
// $user = [
|
||||
// 'id' => $db->id,
|
||||
// 'nickname' => $data['nickname'],
|
||||
// ];
|
||||
// // 返回成功响应和用户信息(可以将 token 添加到响应中)
|
||||
// return ApiResponse::success(200, [
|
||||
// 'user' => $user, // 返回用户信息
|
||||
// ]);
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 获取用户信息")
|
||||
// * @Apidoc\Url("api/v1/user/get_info")
|
||||
// * @Apidoc\Method("POST")
|
||||
// */
|
||||
// public function get_info(Request $request)
|
||||
// {
|
||||
// $data = $request->post();
|
||||
// $user = $request->data;
|
||||
// $userid = $user['id'];
|
||||
// $db = Users::where('id', '=', $userid)->first(['phone', 'nickname']);
|
||||
// return ApiResponse::success(200, $db);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 设置用户短信是否接受")
|
||||
// * @Apidoc\Url("api/v1/user/set_msg_setting")
|
||||
// * @Apidoc\Param("acceptmessages", type="int",require=true, desc="1接受0不接受")
|
||||
// * @Apidoc\Method("POST")
|
||||
// */
|
||||
// public function set_msg_setting(Request $request)
|
||||
// {
|
||||
// $data = $request->post();
|
||||
// $user = $request->data;
|
||||
// $userid = $user['id'];
|
||||
// $db = Users::where('id', '=', $userid)->first();
|
||||
// $db->acceptmessages=$data['acceptmessages'];
|
||||
// $db->save();
|
||||
// return ApiResponse::success(200, $db);
|
||||
// }
|
||||
// /**
|
||||
// * @Apidoc\Title("1.0 获取用户短信设置")
|
||||
// * @Apidoc\Url("api/v1/user/get_msg_setting")
|
||||
// * @Apidoc\Method("POST")
|
||||
// */
|
||||
// public function get_msg_setting(Request $request)
|
||||
// {
|
||||
// $data = $request->post();
|
||||
// $user = $request->data;
|
||||
// $userid = $user['id'];
|
||||
// $db = Users::where('id', '=', $userid)->first(['acceptmessages']);
|
||||
// return ApiResponse::success(200, $db);
|
||||
// }
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ use App\Utils\ApiResponse;
|
|||
use hg\apidoc\annotation as Apidoc;
|
||||
|
||||
use Tinywan\Jwt\JwtToken;
|
||||
use App\model\Users;
|
||||
use App\model\User;
|
||||
use App\model\Message;
|
||||
use App\dao\UserDao;
|
||||
|
||||
|
@ -38,7 +38,7 @@ class UserController
|
|||
$data = $request->post();
|
||||
|
||||
// 根据手机号查询用户
|
||||
$db = Users::where('phone', '=', $data['phone'])->first();
|
||||
$db = User::where('phone', '=', $data['phone'])->first();
|
||||
|
||||
// 如果未找到用户,返回错误
|
||||
if (!$db) {
|
||||
|
@ -84,7 +84,7 @@ class UserController
|
|||
if ($user['code'] != 200) {
|
||||
return ApiResponse::error(402, [], $user['message']);
|
||||
}
|
||||
$db = Users::where('phone', '=', $data['phone'])->first();
|
||||
$db = User::where('phone', '=', $data['phone'])->first();
|
||||
$user = [
|
||||
'id' => $db->id,
|
||||
'nickname' => $db->nickname,
|
||||
|
@ -118,7 +118,7 @@ class UserController
|
|||
$data = $request->post();
|
||||
$user = $request->data;
|
||||
$userid = $user['id'];
|
||||
$db = Users::where('id', '=', $userid)->first();
|
||||
$db = User::where('id', '=', $userid)->first();
|
||||
if (isset($data['password']) && $data['password'] != '') {
|
||||
if (password_verify($data['oldpassword'], $db->password)) {
|
||||
UserDao::chang_passwd($userid, $data['password']);
|
||||
|
@ -140,47 +140,6 @@ class UserController
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取用户信息")
|
||||
* @Apidoc\Url("api/v1/user/get_info")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function get_info(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$user = $request->data;
|
||||
$userid = $user['id'];
|
||||
$db = Users::where('id', '=', $userid)->first(['phone', 'nickname']);
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
/**
|
||||
* @Apidoc\Title("1.0 设置用户短信是否接受")
|
||||
* @Apidoc\Url("api/v1/user/set_msg_setting")
|
||||
* @Apidoc\Param("acceptmessages", type="int",require=true, desc="1接受0不接受")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function set_msg_setting(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$user = $request->data;
|
||||
$userid = $user['id'];
|
||||
$db = Users::where('id', '=', $userid)->first();
|
||||
$db->acceptmessages=$data['acceptmessages'];
|
||||
$db->save();
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
/**
|
||||
* @Apidoc\Title("1.0 获取用户短信设置")
|
||||
* @Apidoc\Url("api/v1/user/get_msg_setting")
|
||||
* @Apidoc\Method("POST")
|
||||
*/
|
||||
public function get_msg_setting(Request $request)
|
||||
{
|
||||
$data = $request->post();
|
||||
$user = $request->data;
|
||||
$userid = $user['id'];
|
||||
$db = Users::where('id', '=', $userid)->first(['acceptmessages']);
|
||||
return ApiResponse::success(200, $db);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -39,12 +39,20 @@ class JwtAuthMiddleware implements MiddlewareInterface
|
|||
}
|
||||
|
||||
// 获取 Authorization 头部中的 token,通常格式为 "Bearer <token>"
|
||||
$token = $request->header('Authorization') ?? '';
|
||||
|
||||
$token1 = $request->header('Authorization');
|
||||
$token2 =$request->header('Token');
|
||||
$token_tmp = !empty($token1) ? $token1 : $token2;
|
||||
|
||||
if (strpos($token_tmp,"Bearer ") === false) {
|
||||
$token= 'Bearer '.$token_tmp;
|
||||
}else{
|
||||
$token= $token_tmp;
|
||||
}
|
||||
// 检查 token 是否为空
|
||||
if (empty($token)) {
|
||||
return ApiResponse::error(401, ['error' => '缺少令牌'], '未授权');
|
||||
}
|
||||
// var_dump($token);
|
||||
|
||||
// 移除 Bearer 前缀并获取纯 token
|
||||
// if (strpos($token, 'Bearer ') === 0) {
|
||||
|
@ -56,8 +64,9 @@ class JwtAuthMiddleware implements MiddlewareInterface
|
|||
$decoded = JwtToken::getExtend($token);
|
||||
// var_dump($decoded);
|
||||
} catch (\Exception $e) {
|
||||
var_dump($e);
|
||||
// 解码失败,返回无效令牌错误
|
||||
return ApiResponse::error(401, ['error' => '无效的令牌'], '未授权');
|
||||
return ApiResponse::error(401, ['error' => '无效的令牌'], '无效的令牌');
|
||||
}
|
||||
|
||||
// 将解码后的用户信息存储到请求对象的 user 属性中
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* @property int $id 唯一标识符
|
||||
* @property string $title 标题,可能是类别或编号
|
||||
* @property float $amount 金额或价值
|
||||
* @property float $probability 概率,0 到 1 之间的小数
|
||||
* @property int $stock_num 库存数量
|
||||
* @property int $createtime 创建时间(Unix 时间戳)
|
||||
* @property int $updatetime 最后更新时间(Unix 时间戳)
|
||||
*/
|
||||
class Reward extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'turntable';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
public $timestamps = false; // 如果不需要自动维护创建和更新时间,可以将此设置为 false
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
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 integer $money 账户余额
|
||||
* @property integer $admin_money 管理员余额
|
||||
* @property integer $all_team_money 总团队余额
|
||||
* @property integer $task_income_money 任务收入
|
||||
* @property integer $task_status 任务状态
|
||||
* @property integer $today_task_income 今日任务收入
|
||||
* @property integer $today_team_income 今日团队收入
|
||||
* @property integer $growth_value 成长值
|
||||
* @property integer $vip_id VIP ID
|
||||
* @property integer $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 = 'users'; // 表名
|
||||
|
||||
/**
|
||||
* 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' => 'integer',
|
||||
'admin_money' => 'integer',
|
||||
'all_team_money' => 'integer',
|
||||
'task_income_money' => 'integer',
|
||||
'today_task_income' => 'integer',
|
||||
'today_team_income' => 'integer',
|
||||
'growth_value' => 'integer',
|
||||
'withdraw_money' => 'integer',
|
||||
'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);
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id 主键(主键)
|
||||
* @property string $created_at 创建时间
|
||||
* @property string $updated_at 更新时间
|
||||
* @property string $cardid 身份证号码
|
||||
* @property integer $phone 手机号码
|
||||
* @property string $nickname 昵称
|
||||
* @property integer $timecoin 时间币
|
||||
* @property integer $gender 性别1男性0女性
|
||||
* @property integer $status 1是启用0是禁止
|
||||
* @property string $birthday 出生日期
|
||||
* @property string $avatar 头像url地址
|
||||
* @property string $password 密码
|
||||
*/
|
||||
class Users extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'users';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use support\Model;
|
||||
|
||||
/**
|
||||
* @property integer $id VIP级别的唯一标识符
|
||||
* @property string $name VIP级别的名称
|
||||
* @property integer $user_count VIP级别的用户数量
|
||||
* @property integer $first_amount 首次充值积分
|
||||
* @property integer $gift_amount 赠送积分
|
||||
* @property integer $createtime 创建时间(时间戳)
|
||||
*/
|
||||
class VipLevel extends Model
|
||||
{
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'vip_levels';
|
||||
|
||||
/**
|
||||
* The primary key associated with the table.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
public $timestamps = false; // 如果不需要自动维护创建和更新时间,可以将此设置为 false
|
||||
}
|
|
@ -33,8 +33,8 @@ return [
|
|||
'host' => '127.0.0.1',
|
||||
'port' => '3306',
|
||||
'database' => 'app_hd',
|
||||
'username' => 'root',
|
||||
'password' => '123456',
|
||||
'username' => 'app_hd',
|
||||
'password' => 'fmW4NwwXMxN8ShSM',
|
||||
'charset' => 'utf8mb4',
|
||||
'collation' => 'utf8mb4_general_ci',
|
||||
'prefix' => '',
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
use Webman\Route;
|
||||
use App\Middleware\JwtAuthMiddleware;
|
||||
Route::any('/login', [app\controller\UserController::class, 'login'])->middleware([JwtAuthMiddleware::class]);
|
||||
Route::any('/signup', [app\controller\ProjectRegisterController::class, 'signup'])->middleware([JwtAuthMiddleware::class]);
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue