初始化仓库

This commit is contained in:
wangxiaowei
2025-04-22 14:09:52 +08:00
commit 8b100110bb
5155 changed files with 664201 additions and 0 deletions

View File

@ -0,0 +1,93 @@
<?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\lists;
use app\common\enum\user\AccountLogEnum;
use app\common\model\user\UserAccountLog;
/**
* 账户流水列表
* Class AccountLogLists
* @package app\shopapi\lists
*/
class AccountLogLists extends BaseApiDataLists
{
/**
* @notes 搜索条件
* @return array
* @author 段誉
* @date 2023/2/24 14:43
*/
public function queryWhere()
{
// 指定用户
$where[] = ['user_id', '=', $this->userId];
// 用户月明细
if (isset($this->params['type']) && $this->params['type'] == 'um') {
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
}
// 变动类型
if (!empty($this->params['action'])) {
$where[] = ['action', '=', $this->params['action']];
}
return $where;
}
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/24 14:43
*/
public function lists(): array
{
$field = 'change_type,change_amount,action,create_time,remark';
$lists = UserAccountLog::field($field)
->where($this->queryWhere())
->order('id', 'desc')
->limit($this->limitOffset, $this->limitLength)
->select()
->toArray();
foreach ($lists as &$item) {
$item['type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
$symbol = $item['action'] == AccountLogEnum::DEC ? '-' : '+';
$item['change_amount_desc'] = $symbol . $item['change_amount'];
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/2/24 14:44
*/
public function count(): int
{
return UserAccountLog::where($this->queryWhere())->count();
}
}

View File

@ -0,0 +1,37 @@
<?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\lists;
use app\common\lists\BaseDataLists;
abstract class BaseApiDataLists extends BaseDataLists
{
protected array $userInfo = [];
protected int $userId = 0;
public string $export;
public function __construct()
{
parent::__construct();
if (isset($this->request->userInfo) && $this->request->userInfo) {
$this->userInfo = $this->request->userInfo;
$this->userId = $this->request->userId;
}
$this->export = $this->request->get('export', '');
}
}

View File

@ -0,0 +1,79 @@
<?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\lists\article;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\model\article\Article;
/**
* 文章收藏列表
* Class ArticleCollectLists
* @package app\api\lists\article
*/
class ArticleCollectLists extends BaseApiDataLists
{
/**
* @notes 获取收藏列表
* @return array
* @author 段誉
* @date 2022/9/20 16:29
*/
public function lists(): array
{
$field = "c.id,c.article_id,a.title,a.image,a.desc,a.is_show,
a.click_virtual, a.click_actual,a.create_time, c.create_time as collect_time";
$lists = (new Article())->alias('a')
->join('article_collect c', 'c.article_id = a.id')
->field($field)
->where([
'c.user_id' => $this->userId,
'c.status' => YesNoEnum::YES,
'a.is_show' => YesNoEnum::YES,
])
->order(['sort' => 'desc', 'c.id' => 'desc'])
->limit($this->limitOffset, $this->limitLength)
->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->select()->toArray();
foreach ($lists as &$item) {
$item['collect_time'] = date('Y-m-d H:i', $item['collect_time']);
}
return $lists;
}
/**
* @notes 获取收藏数量
* @return int
* @author 段誉
* @date 2022/9/20 16:29
*/
public function count(): int
{
return (new Article())->alias('a')
->join('article_collect c', 'c.article_id = a.id')
->where([
'c.user_id' => $this->userId,
'c.status' => YesNoEnum::YES,
'a.is_show' => YesNoEnum::YES,
])
->count();
}
}

View File

@ -0,0 +1,120 @@
<?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\lists\article;
use app\api\lists\BaseApiDataLists;
use app\common\enum\YesNoEnum;
use app\common\lists\ListsSearchInterface;
use app\common\model\article\Article;
use app\common\model\article\ArticleCollect;
/**
* 文章列表
* Class ArticleLists
* @package app\api\lists\article
*/
class ArticleLists extends BaseApiDataLists implements ListsSearchInterface
{
/**
* @notes 搜索条件
* @return \string[][]
* @author 段誉
* @date 2022/9/16 18:54
*/
public function setSearch(): array
{
return [
'=' => ['cid']
];
}
/**
* @notes 自定查询条件
* @return array
* @author 段誉
* @date 2022/10/25 16:53
*/
public function queryWhere()
{
$where[] = ['is_show', '=', 1];
if (!empty($this->params['keyword'])) {
$where[] = ['title', 'like', '%' . $this->params['keyword'] . '%'];
}
return $where;
}
/**
* @notes 获取文章列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2022/9/16 18:55
*/
public function lists(): array
{
$orderRaw = 'sort desc, id desc';
$sortType = $this->params['sort'] ?? 'default';
// 最新排序
if ($sortType == 'new') {
$orderRaw = 'id desc';
}
// 最热排序
if ($sortType == 'hot') {
$orderRaw = 'click_actual + click_virtual desc, id desc';
}
$field = 'id,cid,title,desc,image,click_virtual,click_actual,create_time';
$result = Article::field($field)
->where($this->queryWhere())
->where($this->searchWhere)
->orderRaw($orderRaw)
->append(['click'])
->hidden(['click_virtual', 'click_actual'])
->limit($this->limitOffset, $this->limitLength)
->select()->toArray();
$articleIds = array_column($result, 'id');
$collectIds = ArticleCollect::where(['user_id' => $this->userId, 'status' => YesNoEnum::YES])
->whereIn('article_id', $articleIds)
->column('article_id');
foreach ($result as &$item) {
$item['collect'] = in_array($item['id'], $collectIds);
}
return $result;
}
/**
* @notes 获取文章数量
* @return int
* @author 段誉
* @date 2022/9/16 18:55
*/
public function count(): int
{
return Article::where($this->searchWhere)
->where($this->queryWhere())
->count();
}
}

View File

@ -0,0 +1,72 @@
<?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\lists\recharge;
use app\api\lists\BaseApiDataLists;
use app\common\enum\PayEnum;
use app\common\model\recharge\RechargeOrder;
/**
* 充值记录列表
* Class RechargeLists
* @package app\api\lists\recharge
*/
class RechargeLists extends BaseApiDataLists
{
/**
* @notes 获取列表
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author 段誉
* @date 2023/2/23 18:43
*/
public function lists(): array
{
$lists = RechargeOrder::field('order_amount,create_time')
->where([
'user_id' => $this->userId,
'pay_status' => PayEnum::ISPAID
])
->order('id', 'desc')
->select()
->toArray();
foreach($lists as &$item) {
$item['tips'] = '充值' . format_amount($item['order_amount']) . '元';
}
return $lists;
}
/**
* @notes 获取数量
* @return int
* @author 段誉
* @date 2023/2/23 18:43
*/
public function count(): int
{
return RechargeOrder::where([
'user_id' => $this->userId,
'pay_status' => PayEnum::ISPAID
])
->count();
}
}