NEED_LOGIN code add

This commit is contained in:
knowpia
2022-09-08 17:23:45 +08:00
parent 5f982d62ce
commit 4f6026dbff
5 changed files with 23 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ class Address
public function lists(){
$userid = $GLOBALS['data']['userid'];
if (empty($userid)) {
return show("请登录后再发布!");
return show("请登录后再发布!",NEED_LOGIN);
}
$list = Db::name("app_address")->where("userid",$userid)->select()->toArray();
return show("获取成功!",SUCCESS_CODE,$list);
@@ -19,7 +19,7 @@ class Address
public function getaddress(){
$userid = $GLOBALS['data']['userid'];
if (empty($userid)) {
return show("请登录后再发布!");
return show("请登录后再发布!",NEED_LOGIN);
}
$address_id = $GLOBALS['data']['data']['address_id'];
@@ -40,7 +40,7 @@ class Address
$post = $GLOBALS['data']['data'];
$userid = $GLOBALS['data']['userid'];
if (empty($userid)) {
return show("请登录后再发布!");
return show("请登录后再发布!",NEED_LOGIN);
}
if(empty($post['name'])) return show("请输入收货人收件人姓名!");

View File

@@ -10,7 +10,7 @@ class Article
$post = $GLOBALS['data']['data'];
$userid = $GLOBALS['data']['userid'];
if(empty($userid)){
return show("请登录后再发布!");
return show("请登录后再发布!",NEED_LOGIN);
}
if(empty($post['content'])){
return show("内容不能为空!");
@@ -34,7 +34,7 @@ class Article
public function delete(){
$userid = $GLOBALS['data']['userid'];
if(empty($userid)){
return show("请登录后操作!");
return show("请登录后操作!",NEED_LOGIN);
}
$article_id = $GLOBALS['data']['data']["article_id"];
if(empty($article_id)){
@@ -52,7 +52,7 @@ class Article
public function lists(){
$userid = $GLOBALS['data']['userid'];
if(empty($userid)){
return show("请登录后操作!");
return show("请登录后操作!",NEED_LOGIN);
}
$lastIndex = empty($GLOBALS['data']['data']["lastindex"])?0:$GLOBALS['data']['data']["lastindex"];
if($lastIndex == 0){

View File

@@ -10,7 +10,7 @@ class Help
{
$userid = $GLOBALS['data']['userid'];
if(empty($userid)){
return show("请登录后再助力!");
return show("请登录后再助力!",NEED_LOGIN);
}
if(empty($GLOBALS['data']['data']['student_id'])){
return show("请输入要助力的用户id");

12
app/controller/Index.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
namespace app\controller;
use app\BaseController;
class Index extends BaseController
{
public function index()
{
return 'Api is ready!';
}
}

View File

@@ -9,7 +9,7 @@ class User
public function info()
{
if(empty($GLOBALS['data']['userid'])){
return show("请上传TOKEN");
return show("请上传TOKEN",NEED_LOGIN);
}
$userid = $GLOBALS['data']['userid'];
$info = Db::name("app_users")->where("id",$userid)->find();
@@ -21,7 +21,7 @@ class User
//修改头像
public function modify_avatar(){
if(empty($GLOBALS['data']['userid'])){
return show("请上传TOKEN");
return show("请上传TOKEN",NEED_LOGIN);
}
$userid = $GLOBALS['data']['userid'];
@@ -37,7 +37,7 @@ class User
//修改昵称
public function modify_nickname(){
if(empty($GLOBALS['data']['userid'])){
return show("请上传TOKEN");
return show("请上传TOKEN",NEED_LOGIN);
}
$userid = $GLOBALS['data']['userid'];
@@ -53,7 +53,7 @@ class User
//狮友认证
public function verify(){
if(empty($GLOBALS['data']['userid'])){
return show("请上传TOKEN");
return show("请上传TOKEN",NEED_LOGIN);
}
$userid = $GLOBALS['data']['userid'];