first commit
This commit is contained in:
124
app/api/controller/ArticleController.php
Normal file
124
app/api/controller/ArticleController.php
Normal file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\lists\article\ArticleCollectLists;
|
||||
use app\api\lists\article\ArticleLists;
|
||||
use app\api\logic\ArticleLogic;
|
||||
|
||||
/**
|
||||
* 文章管理
|
||||
* Class ArticleController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class ArticleController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['lists', 'cate', 'detail','hintDetail'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 文章列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 15:30
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new ArticleLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 文章分类列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 15:30
|
||||
*/
|
||||
public function cate()
|
||||
{
|
||||
return $this->data(ArticleLogic::cate());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 收藏列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 16:31
|
||||
*/
|
||||
public function collect()
|
||||
{
|
||||
return $this->dataLists(new ArticleCollectLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 提示内容详情
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 17:09
|
||||
*/
|
||||
public function hintDetail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = ArticleLogic::hintDetail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 文章详情
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 17:09
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = ArticleLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 加入收藏
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 17:01
|
||||
*/
|
||||
public function addCollect()
|
||||
{
|
||||
$articleId = $this->request->post('id/d');
|
||||
ArticleLogic::addCollect($articleId, $this->userId);
|
||||
return $this->success('操作成功');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 取消收藏
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 17:01
|
||||
*/
|
||||
public function cancelCollect()
|
||||
{
|
||||
$articleId = $this->request->post('id/d');
|
||||
ArticleLogic::cancelCollect($articleId, $this->userId);
|
||||
return $this->success('操作成功');
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
46
app/api/controller/BaseApiController.php
Normal file
46
app/api/controller/BaseApiController.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\model\user\{User,UserLog};
|
||||
|
||||
class BaseApiController extends BaseLikeAdminController
|
||||
{
|
||||
protected int $userId = 0;
|
||||
protected array $userInfo = [];
|
||||
|
||||
public function initialize()
|
||||
{
|
||||
if (isset($this->request->userInfo) && $this->request->userInfo) {
|
||||
$this->userInfo = $this->request->userInfo;
|
||||
$this->userId = $this->request->userInfo['user_id'];
|
||||
|
||||
//更新最后操作时间,大于5分钟才更新
|
||||
$online_time = time() - 5*60;
|
||||
User::where(['id' => $this->userId])->where("last_time <= $online_time")->update(['last_time' => time()]);
|
||||
|
||||
// //更新用户操作记录 (统计活跃人数)
|
||||
// $start_time = strtotime(date('Y-m-d 00:00:00', time()));//0点
|
||||
// $userLog = UserLog::where("create_time >= $start_time")->where(['user_id' => $this->userId,'type' => 1])->findOrEmpty();
|
||||
// if ($userLog->isEmpty()) {
|
||||
// UserLog::create([
|
||||
// 'user_id' => $this->userId,
|
||||
// 'type' => 1
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
261
app/api/controller/FinanceController.php
Normal file
261
app/api/controller/FinanceController.php
Normal file
@@ -0,0 +1,261 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\FinanceLogic;
|
||||
use app\api\validate\{FinanceValidate};
|
||||
use app\api\lists\finance\{WithdrawRecordLists,RechargeRecordLists,UserFinanceLists,UserTransferRecordLists};
|
||||
|
||||
|
||||
/**
|
||||
* 资金控制器
|
||||
* Class FinanceController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class FinanceController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/21 19:15
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
/**
|
||||
* @notes 获取资金明细
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/23 18:55
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserFinanceLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 资金记录详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取提现方式
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawMethod()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = FinanceLogic::withdrawMethod($lang);
|
||||
if ($result === false) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取提现钱包
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawWallet()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = FinanceLogic::withdrawWallet($lang, $this->userId);
|
||||
if ($result === false) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取提现银行
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawBanks()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = FinanceLogic::withdrawBanks($lang);
|
||||
if ($result === false) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 绑定提现钱包
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawWalletAdd()
|
||||
{
|
||||
$params = (new FinanceValidate())->post()->goCheck('walletAdd', [
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
$result = FinanceLogic::withdrawWalletAdd($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 提现配置
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawConfig()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::withdrawConfig($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 提现
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdraw()
|
||||
{
|
||||
$params = (new FinanceValidate())->post()->goCheck('withdraw', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = FinanceLogic::withdraw($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 提现记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawRecordLists()
|
||||
{
|
||||
return $this->dataLists(new WithdrawRecordLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 提现记录详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function withdrawRecordDetail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::withdrawRecordDetail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function rechargeRecordLists()
|
||||
{
|
||||
return $this->dataLists(new RechargeRecordLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值记录详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function rechargeRecordDetail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::rechargeRecordDetail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 用户转账数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/21 19:15
|
||||
*/
|
||||
public function transferIndex()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = FinanceLogic::transferIndex($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 转账
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function transfer()
|
||||
{
|
||||
$params = (new FinanceValidate())->post()->goCheck('transfer', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = FinanceLogic::transfer($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(FinanceLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 转账记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function transferRecordLists()
|
||||
{
|
||||
return $this->dataLists(new UserTransferRecordLists());
|
||||
}
|
||||
|
||||
}
|
||||
125
app/api/controller/IndexController.php
Normal file
125
app/api/controller/IndexController.php
Normal file
@@ -0,0 +1,125 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\IndexLogic;
|
||||
use think\response\Json;
|
||||
|
||||
|
||||
/**
|
||||
* index
|
||||
* Class IndexController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class IndexController extends BaseApiController
|
||||
{
|
||||
|
||||
|
||||
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'countryCode', 'getKefuLists', 'market'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2023/9/21 19:15
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = IndexLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 全局配置
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2023/9/21 19:41
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = IndexLogic::getConfigData($lang);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 国家区号
|
||||
* @return Json
|
||||
* @author BD
|
||||
* @date 2023/9/21 18:37
|
||||
*/
|
||||
public function countryCode()
|
||||
{
|
||||
$result = IndexLogic::getCountryCode();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 装修信息
|
||||
* @return Json
|
||||
* @author BD
|
||||
* @date 2023/9/21 18:37
|
||||
*/
|
||||
public function decorate()
|
||||
{
|
||||
$id = $this->request->get('id/d');
|
||||
$result = IndexLogic::getDecorate($id);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取所有语言
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2023/10/13 10:54
|
||||
*/
|
||||
public function getKefuLists()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = IndexLogic::getKefuLists($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @notes 政策协议
|
||||
// * @return Json
|
||||
// * @author BD
|
||||
// * @date 2023/9/20 20:00
|
||||
// */
|
||||
// public function policy()
|
||||
// {
|
||||
// $type = $this->request->get('type/s', '');
|
||||
// $result = IndexLogic::getPolicyByType($type);
|
||||
// return $this->data($result);
|
||||
// }
|
||||
|
||||
/**
|
||||
* @notes 行情数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2023/10/13 10:54
|
||||
*/
|
||||
public function market()
|
||||
{
|
||||
$result = IndexLogic::getMarketData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
||||
98
app/api/controller/ItemController.php
Normal file
98
app/api/controller/ItemController.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\ItemLogic;
|
||||
use app\api\validate\{ItemValidate};
|
||||
|
||||
use app\api\lists\item\{ItemRecordLists};
|
||||
|
||||
|
||||
/**
|
||||
* 项目控制器
|
||||
* Class ItemController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class ItemController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = ItemLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 项目详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = ItemLogic::detail($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(ItemLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 合同详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function contract()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = ItemLogic::contract($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(ItemLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 投资
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function invest()
|
||||
{
|
||||
$params = (new ItemValidate())->post()->goCheck('invest', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = ItemLogic::invest($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(ItemLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 投资记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/23 18:55
|
||||
*/
|
||||
public function recordLists()
|
||||
{
|
||||
return $this->dataLists(new ItemRecordLists());
|
||||
}
|
||||
|
||||
}
|
||||
77
app/api/controller/LanguageController.php
Normal file
77
app/api/controller/LanguageController.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\LanguageLogic;
|
||||
use app\api\validate\LanguageValidate;
|
||||
use app\api\validate\LanguagePagValidate;
|
||||
|
||||
/**
|
||||
* 文章管理
|
||||
* Class LanguageController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class LanguageController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['all', 'pagAll', 'detail'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取语言详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/11/30 13:59
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new LanguageValidate())->goCheck('detail');
|
||||
$result = LanguageLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取所有语言
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:54
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$result = LanguageLogic::getAllData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取语言包数据
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/13 10:54
|
||||
*/
|
||||
public function pagAll()
|
||||
{
|
||||
$params = (new LanguagePagValidate())->goCheck('all');
|
||||
$result = LanguageLogic::getPagAllData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
||||
94
app/api/controller/LoginController.php
Normal file
94
app/api/controller/LoginController.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
||||
use app\api\logic\LoginLogic;
|
||||
|
||||
/**
|
||||
* 登录注册
|
||||
* Class LoginController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class LoginController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 注册账号
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/7 15:38
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$params = (new RegisterValidate())->post()->goCheck('register');
|
||||
$result = LoginLogic::register($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 账号密码/手机号密码/手机号验证码登录
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:42
|
||||
*/
|
||||
public function account()
|
||||
{
|
||||
$params = (new LoginAccountValidate())->post()->goCheck();
|
||||
$result = LoginLogic::login($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 退出登录
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/16 10:42
|
||||
*/
|
||||
public function logout()
|
||||
{
|
||||
LoginLogic::logout($this->userInfo);
|
||||
return $this->success();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 更新用户头像昵称
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/22 11:15
|
||||
*/
|
||||
public function updateUser()
|
||||
{
|
||||
$params = (new WechatLoginValidate())->post()->goCheck("updateUser");
|
||||
LoginLogic::updateUser($params, $this->userId);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
97
app/api/controller/MallController.php
Normal file
97
app/api/controller/MallController.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\MallLogic;
|
||||
use app\api\validate\{MallValidate};
|
||||
use app\api\lists\mall\{MallGoodsRecordLists};
|
||||
|
||||
|
||||
/**
|
||||
* 积分商城控制器
|
||||
* Class MallController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class MallController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = MallLogic::index($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 兑换
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function buy()
|
||||
{
|
||||
$params = (new MallValidate())->post()->goCheck('buy', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = MallLogic::buy($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(MallLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 抽奖数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function drawIndex()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = MallLogic::drawIndex($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 抽奖
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function draw()
|
||||
{
|
||||
$params = (new MallValidate())->post()->goCheck('draw', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = MallLogic::draw($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(MallLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 抽奖记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function drawLists()
|
||||
{
|
||||
return $this->dataLists(new MallGoodsRecordLists());
|
||||
}
|
||||
}
|
||||
95
app/api/controller/PcController.php
Normal file
95
app/api/controller/PcController.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\PcLogic;
|
||||
use think\response\Json;
|
||||
|
||||
|
||||
/**
|
||||
* PC
|
||||
* Class PcController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class PcController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['index', 'config', 'infoCenter', 'articleDetail'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/21 19:15
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$result = PcLogic::getIndexData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 全局配置
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/9/21 19:41
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$result = PcLogic::getConfigData();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 资讯中心
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2022/10/19 16:55
|
||||
*/
|
||||
public function infoCenter()
|
||||
{
|
||||
$result = PcLogic::getInfoCenter();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取文章详情
|
||||
* @return Json
|
||||
* @author 段誉
|
||||
* @date 2022/10/20 15:18
|
||||
*/
|
||||
public function articleDetail()
|
||||
{
|
||||
$id = $this->request->get('id/d', 0);
|
||||
$source = $this->request->get('source/s', 'default');
|
||||
$result = PcLogic::getArticleDetail($this->userId, $id, $source);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
||||
164
app/api/controller/RechargeController.php
Normal file
164
app/api/controller/RechargeController.php
Normal file
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\lists\recharge\RechargeLists;
|
||||
use app\api\logic\RechargeLogic;
|
||||
use app\api\validate\{RechargeValidate};
|
||||
|
||||
|
||||
/**
|
||||
* 充值控制器
|
||||
* Class RechargeController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class RechargeController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取充值列表
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/23 18:55
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new RechargeLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 充值
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/23 18:56
|
||||
*/
|
||||
public function recharge()
|
||||
{
|
||||
$params = (new RechargeValidate())->post()->goCheck('recharge', [
|
||||
'user_id' => $this->userId,
|
||||
'terminal' => $this->userInfo['terminal'],
|
||||
]);
|
||||
$result = RechargeLogic::recharge($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 充值配置
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/24 16:56
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
return $this->data(RechargeLogic::config($this->userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取充值方式
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/4/13 10:54
|
||||
*/
|
||||
public function method()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RechargeLogic::getAllMethod($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值方式详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/4/20 17:09
|
||||
*/
|
||||
public function methodDetail()
|
||||
{
|
||||
$id = $this->request->get('id/d');
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = RechargeLogic::methodDetail($id,$lang);
|
||||
if ($result === false) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
/**
|
||||
* @notes 充值方式详情-优盾
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/4/20 17:09
|
||||
*/
|
||||
public function methodDetailUdun()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RechargeLogic::methodDetailUdun($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值方式详情-波场
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/4/20 17:09
|
||||
*/
|
||||
public function methodDetailTron()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RechargeLogic::methodDetailTron($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 充值方式详情-自定义地址
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/4/20 17:09
|
||||
*/
|
||||
public function methodDetailAddress()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RechargeLogic::methodDetailAddress($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(RechargeLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取常用充值金额
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/4/13 10:54
|
||||
*/
|
||||
public function commonMoney()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = RechargeLogic::getCommonMoney($lang);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
122
app/api/controller/RobotController.php
Normal file
122
app/api/controller/RobotController.php
Normal file
@@ -0,0 +1,122 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\RobotLogic;
|
||||
use app\api\validate\{RobotValidate};
|
||||
use app\api\lists\lh\{LhRecordLists};
|
||||
|
||||
/**
|
||||
* 抢单控制器
|
||||
* Class RobotController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class RobotController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RobotLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 量化
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function buy()
|
||||
{
|
||||
$params = (new RobotValidate())->post()->goCheck('buy', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = RobotLogic::buy($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 抢单记录
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function recordLists()
|
||||
{
|
||||
return $this->dataLists(new LhRecordLists());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @notes 抢单
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grab()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = RobotLogic::grab($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取进行中订单
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grabIngRecord()
|
||||
{
|
||||
$result = RobotLogic::grabIngRecord([
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 订单支付
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function grabPay()
|
||||
{
|
||||
$params = (new RobotValidate())->post()->goCheck('grabPay', [
|
||||
'user_id' => $this->userId,
|
||||
]);
|
||||
$result = RobotLogic::grabPay($params);
|
||||
if (false === $result) {
|
||||
return $this->fail(RobotLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
70
app/api/controller/SmsController.php
Normal file
70
app/api/controller/SmsController.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\api\validate\SendSmsValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 短信
|
||||
* Class SmsController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class SmsController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['sendCode','sendEmailNoLogin'];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 发送短信验证码
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function sendCode()
|
||||
{
|
||||
$params = (new SendSmsValidate())->post()->goCheck();
|
||||
$result = SmsLogic::sendCode($params);
|
||||
if (true === $result) {
|
||||
return $this->success('captcha.sendSuccessfully');//发送成功
|
||||
}
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 发送邮件
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function sendEmail()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = SmsLogic::sendEmail($params);
|
||||
if (true === $result) {
|
||||
return $this->success('captcha.sendSuccessfully');//发送成功
|
||||
}
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 发送邮件
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function sendEmailNoLogin()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$result = SmsLogic::sendEmailNoLogin($params);
|
||||
if (true === $result) {
|
||||
return $this->success('captcha.sendSuccessfully');//发送成功
|
||||
}
|
||||
return $this->fail(SmsLogic::getError());
|
||||
}
|
||||
|
||||
}
|
||||
61
app/api/controller/TeamController.php
Normal file
61
app/api/controller/TeamController.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\TeamLogic;
|
||||
use app\api\lists\team\{TeamUserLists};
|
||||
use think\facade\Request;
|
||||
|
||||
/**
|
||||
* 团队控制器
|
||||
* Class TeamController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class TeamController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 团队列表
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/2/23 18:55
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new TeamUserLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 团队首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$params['host'] = Request::header('origin');
|
||||
$result = TeamLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 团队首页数据2
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function indexReport()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = TeamLogic::getIndexReport($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
}
|
||||
48
app/api/controller/UploadController.php
Normal file
48
app/api/controller/UploadController.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\enum\FileEnum;
|
||||
use app\common\service\UploadService;
|
||||
use Exception;
|
||||
use think\response\Json;
|
||||
|
||||
|
||||
/** 上传文件
|
||||
* Class UploadController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class UploadController extends BaseApiController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 上传图片
|
||||
* @return Json
|
||||
* @author 段誉
|
||||
* @date 2022/9/20 18:11
|
||||
*/
|
||||
public function image()
|
||||
{
|
||||
try {
|
||||
$result = UploadService::image(0, $this->userId,FileEnum::SOURCE_USER);
|
||||
return $this->success('上传成功', $result);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
454
app/api/controller/UserController.php
Normal file
454
app/api/controller/UserController.php
Normal file
@@ -0,0 +1,454 @@
|
||||
<?php
|
||||
namespace app\api\controller;
|
||||
|
||||
|
||||
use app\api\logic\UserLogic;
|
||||
use app\api\validate\PasswordValidate;
|
||||
use app\api\validate\SetUserInfoValidate;
|
||||
use app\api\validate\UserValidate;
|
||||
use app\api\lists\user\{UserNoticeLists,UserMineRecordLists};
|
||||
use think\facade\Request;
|
||||
|
||||
/**
|
||||
* 用户控制器
|
||||
* Class UserController
|
||||
* @package app\api\controller
|
||||
*/
|
||||
class UserController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['resetPassword'];
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/21 19:15
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$lang = $this->request->get('lang/s');
|
||||
$result = UserLogic::getIndexData([
|
||||
'lang' => $lang,
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 分享 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/21 19:15
|
||||
*/
|
||||
public function shareIndex()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
// $params['host'] = Request::header('origin');
|
||||
$result = UserLogic::getShareIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取个人中心
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/16 18:19
|
||||
*/
|
||||
public function center()
|
||||
{
|
||||
$data = UserLogic::center($this->userInfo);
|
||||
return $this->success('', $data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取个人信息
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:46
|
||||
*/
|
||||
public function info()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['host'] = Request::header('origin');
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::info($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 重置密码
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/16 18:06
|
||||
*/
|
||||
public function resetPassword()
|
||||
{
|
||||
$params = (new PasswordValidate())->post()->goCheck('resetPassword');
|
||||
$result = UserLogic::resetPassword($params);
|
||||
if (true === $result) {
|
||||
return $this->success('network.modifySuccessfully', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 修改密码
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:16
|
||||
*/
|
||||
public function changePassword()
|
||||
{
|
||||
$params = (new PasswordValidate())->post()->goCheck('changePassword');
|
||||
$result = UserLogic::changePassword($params, $this->userId);
|
||||
if (true === $result) {
|
||||
return $this->success('network.modifySuccessfully', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 修改支付密码
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:16
|
||||
*/
|
||||
public function changePayPassword()
|
||||
{
|
||||
$params = (new PasswordValidate())->post()->goCheck('changePayPassword');
|
||||
$result = UserLogic::changePayPassword($params, $this->userId);
|
||||
if (true === $result) {
|
||||
return $this->success('network.modifySuccessfully', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 设置支付密码
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:16
|
||||
*/
|
||||
public function setPayPwd()
|
||||
{
|
||||
$params = (new PasswordValidate())->post()->goCheck('setPayPassword');
|
||||
$result = UserLogic::setPayPassword($params, $this->userId);
|
||||
if (true === $result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑用户信息
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:01
|
||||
*/
|
||||
public function setInfo()
|
||||
{
|
||||
$params = (new SetUserInfoValidate())->post()->goCheck(null, ['id' => $this->userId]);
|
||||
$result = UserLogic::setInfo($this->userId, $params);
|
||||
if (false === $result) {
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
return $this->success('network.modifySuccessfully', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 绑定/变更 手机号
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function bindMobile()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('bindMobile');
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::bindMobile($params);
|
||||
if($result) {
|
||||
return $this->success('network.modifySuccessfully', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取用户消息
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:46
|
||||
*/
|
||||
public function notice()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::notice($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 用户消息列表
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function noticeLists()
|
||||
{
|
||||
return $this->dataLists(new UserNoticeLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 用户消息详情
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function noticeDetail()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::noticeDetail($params);
|
||||
if ($result === false) {
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 奖励活动数据
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:46
|
||||
*/
|
||||
public function activityIndex()
|
||||
{
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::activityIndex($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 任务中心数据
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:46
|
||||
*/
|
||||
public function missionIndex()
|
||||
{
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::missionIndex($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 领取任务奖励
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:16
|
||||
*/
|
||||
public function missionReward()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::missionReward($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 意见反馈类型
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:46
|
||||
*/
|
||||
public function feedbackCate()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$result = UserLogic::feedbackCate($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 意见反馈
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/20 19:16
|
||||
*/
|
||||
public function feedback()
|
||||
{
|
||||
$params = $this->request->post();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::feedback($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes Google Authenticator校验
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function verifyGoogle()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('verifyGoogle');
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::verifyGoogle($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 邮箱校验
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function verifyEmail()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('verifyEmail');
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::verifyEmail($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 实名认证
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function verifyRealname()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('verifyRealname', [
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
$result = UserLogic::verifyRealname($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 签到数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function signinConfig()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::signinConfig($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 签到
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function signin()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('signin', [
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
$result = UserLogic::signin($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 挖矿 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function mineIndex()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserLogic::getMineIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 挖矿记录列表
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function mineLists()
|
||||
{
|
||||
return $this->dataLists(new UserMineRecordLists());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 矿机 启动
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function mineStart()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('mineStart', [
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
$result = UserLogic::mineStart($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 矿机 收益
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/9/21 17:29
|
||||
*/
|
||||
public function mineReceive()
|
||||
{
|
||||
$params = (new UserValidate())->post()->goCheck('mineReceive', [
|
||||
'user_id' => $this->userId
|
||||
]);
|
||||
$result = UserLogic::mineReceive($params);
|
||||
if($result) {
|
||||
return $this->success('', [], 1, 1);
|
||||
}
|
||||
return $this->fail(UserLogic::getError());
|
||||
}
|
||||
}
|
||||
74
app/api/controller/UserMemberController.php
Normal file
74
app/api/controller/UserMemberController.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\api\logic\UserMemberLogic;
|
||||
use app\api\validate\{UserMemberValidate};
|
||||
|
||||
/**
|
||||
* 会员控制器
|
||||
* Class UserMemberController
|
||||
* @package app\shopapi\controller
|
||||
*/
|
||||
class UserMemberController extends BaseApiController
|
||||
{
|
||||
/**
|
||||
* @notes 首页数据
|
||||
* @return Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author BD
|
||||
* @date 2024/9/21 19:15
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserMemberLogic::getIndexData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 会员列表
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
public function all()
|
||||
{
|
||||
$params = $this->request->get();
|
||||
$params['user_id'] = $this->userId;
|
||||
$result = UserMemberLogic::getAllData($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 加入会员
|
||||
* @return \think\response\Json
|
||||
* @author BD
|
||||
* @date 2024/02/22 10:54
|
||||
*/
|
||||
// public function join(){
|
||||
// $params = (new UserMemberValidate())->post()->goCheck('join', [
|
||||
// 'user_id' => $this->userId,
|
||||
// ]);
|
||||
// $result = UserMemberLogic::join($params);
|
||||
// if (false === $result) {
|
||||
// return $this->fail(UserMemberLogic::getError());
|
||||
// }
|
||||
// return $this->data($result);
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user