提交其他文件

This commit is contained in:
2026-03-14 16:20:49 +08:00
parent a227deaecd
commit 0a19b334f8
1385 changed files with 73568 additions and 0 deletions

View 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\adminapi\logic;
use app\common\model\UserMember;
use app\common\logic\BaseLogic;
use app\common\service\FileService;
use think\facade\Db;
/**
* UserMember逻辑
* Class UserMemberLogic
* @package app\adminapi\logic
*/
class UserMemberLogic extends BaseLogic
{
public static function lists($data){
// 如果 $data 是 Json 响应对象,先获取其数据
if ($data instanceof \think\response\Json) {
$data = $data->getData();
}
foreach($data['data']['lists'] as $key=>$value){
$data['data']['lists'][$key]['avatar'] = FileService::getImgUrl($value['avatar']);
}
return $data;
}
/**
* @notes 添加
* @param array $params
* @return bool
* @author likeadmin
* @date 2026/02/05 14:34
*/
public static function add(array $params): bool
{
Db::startTrans();
try {
UserMember::create([
'user_id' => $params['user_id'],
'expiration_time' => strtotime($params['expiration_time']),
'dtime' => strtotime($params['dtime']),
'update_dtime' => $params['update_dtime'],
'status' => $params['status']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 编辑
* @param array $params
* @return bool
* @author likeadmin
* @date 2026/02/05 14:34
*/
public static function edit(array $params): bool
{
Db::startTrans();
try {
UserMember::where('id', $params['id'])->update([
'user_id' => $params['user_id'],
'expiration_time' => strtotime($params['expiration_time']),
'dtime' => strtotime($params['dtime']),
'update_dtime' => $params['update_dtime'],
'status' => $params['status']
]);
Db::commit();
return true;
} catch (\Exception $e) {
Db::rollback();
self::setError($e->getMessage());
return false;
}
}
/**
* @notes 删除
* @param array $params
* @return bool
* @author likeadmin
* @date 2026/02/05 14:34
*/
public static function delete(array $params): bool
{
return UserMember::destroy($params['id']);
}
/**
* @notes 获取详情
* @param $params
* @return array
* @author likeadmin
* @date 2026/02/05 14:34
*/
public static function detail($params): array
{
return UserMember::findOrEmpty($params['id'])->toArray();
}
}