FastMovieAI AI短剧创作平台 二开基线
- 源码: xhadmincn/FastMovieAI (Apache 2.0) - 二开: Docker部署, Swoole改Select, route.php修复, 补update/VERSION - vendor/示例资源已gitignore
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use app\expose\helper\Uploads;
|
||||
use app\expose\utils\Password;
|
||||
use loong\oauth\facade\Auth;
|
||||
|
||||
class Admin extends Basic
|
||||
{
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'type' => [
|
||||
// 设置JSON字段的类型
|
||||
'allow_week' => 'json'
|
||||
]
|
||||
];
|
||||
}
|
||||
public function getHeadimgAttr($value)
|
||||
{
|
||||
return Uploads::url($value);
|
||||
}
|
||||
public function setHeadimgAttr($value)
|
||||
{
|
||||
return Uploads::path($value);
|
||||
}
|
||||
public function getNicknameAttr($value)
|
||||
{
|
||||
return base64_decode($value);
|
||||
}
|
||||
public function setNicknameAttr($value)
|
||||
{
|
||||
return base64_encode($value);
|
||||
}
|
||||
public function setPasswordAttr($value)
|
||||
{
|
||||
return Password::encrypt($value);
|
||||
}
|
||||
public static function getTokenInfo(Admin $Admin)
|
||||
{
|
||||
/* 重组用户信息 */
|
||||
$AdminUser = new \stdClass;
|
||||
$AdminUser->nickname = $Admin->nickname;
|
||||
$AdminUser->headimg = $Admin->headimg;
|
||||
$AdminUser->username = $Admin->username;
|
||||
/* 生成token */
|
||||
$data = new \stdClass;
|
||||
$data->uid = $Admin->id;
|
||||
$data->role_id = $Admin->role_id;
|
||||
$data->username = $Admin->username;
|
||||
$data->mobile = $Admin->mobile;
|
||||
$data->email = $Admin->email;
|
||||
$data->allow_time_start = $Admin->allow_time_start;
|
||||
$data->allow_time_end = $Admin->allow_time_end;
|
||||
$data->allow_week = $Admin->allow_week;
|
||||
$AdminRole = AdminRole::where(['id' => $Admin->role_id])->find();
|
||||
$data->is_system = $AdminRole->is_system;
|
||||
$data->permissions = $AdminRole->rule;
|
||||
$AdminUser->role_name = $AdminRole['name'];
|
||||
$AdminUser->is_system = $AdminRole->is_system;
|
||||
$AdminUser->permissions = $AdminRole->rule;
|
||||
$AdminUser->token = Auth::setPrefix('ADMIN')->encrypt($data);
|
||||
return $AdminUser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class AdminRole extends Basic
|
||||
{
|
||||
public $json = ['rule'];
|
||||
public $jsonAssoc = true;
|
||||
public static function options($pid = null, $where = [])
|
||||
{
|
||||
if ($pid) {
|
||||
$data = self::where($where)->where(['pid' => $pid])->select();
|
||||
} else {
|
||||
$data = self::where($where)->whereNull('pid')->select();
|
||||
}
|
||||
$options = [];
|
||||
if ($data->isEmpty()) {
|
||||
return $options;
|
||||
}
|
||||
foreach ($data as $item) {
|
||||
$temp = [
|
||||
'value' => $item->id,
|
||||
'label' => $item['name']
|
||||
];
|
||||
$children = self::options($item->id, $where);
|
||||
if (!empty($children)) {
|
||||
$temp['children'] = $children;
|
||||
}
|
||||
$options[] = $temp;
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
public static function systemRole($column = '*')
|
||||
{
|
||||
return self::where('is_system', 1)->column($column);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\Model;
|
||||
|
||||
class Basic extends Model
|
||||
{
|
||||
public $autoWriteTimestamp = 'datetime';
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class Config extends Basic
|
||||
{
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'type' => [
|
||||
// 设置JSON字段的类型
|
||||
'value' => 'json'
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class PaymentConfig extends Basic
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
|
||||
class PaymentNotifyWechat extends Basic
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use app\expose\enum\PaymentChannels;
|
||||
use app\expose\enum\State;
|
||||
|
||||
class PaymentTemplate extends Basic
|
||||
{
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'type' => [
|
||||
// 设置JSON字段的类型
|
||||
'value' => 'json'
|
||||
]
|
||||
];
|
||||
}
|
||||
public static function options($where = [])
|
||||
{
|
||||
$options = [];
|
||||
$where[] = ['state', '=', State::YES['value']];
|
||||
$templates = self::where($where)->select();
|
||||
foreach ($templates as $template) {
|
||||
$channel = PaymentChannels::getText($template->channels);
|
||||
$options[] = [
|
||||
'label' => "{$channel} - {$template->title}",
|
||||
'value' => $template->id,
|
||||
'extra' => [
|
||||
'where' => [
|
||||
['channels', '=', $template->channels]
|
||||
]
|
||||
],
|
||||
];
|
||||
}
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class Uploads extends Basic
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
class UploadsClassify extends Basic
|
||||
{
|
||||
}
|
||||
Reference in New Issue
Block a user