代码功能更新
This commit is contained in:
Executable
+46
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
/**
|
||||
* 地区管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Area extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'area';
|
||||
|
||||
//附加属性
|
||||
protected $append = [];
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function parent(){
|
||||
return $this->belongsTo('app\model\Area','pid','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+60
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
/**
|
||||
* 会员管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Bot extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'admin_bot';
|
||||
|
||||
//附加属性
|
||||
protected $append = ['create_time_int','update_time_int','delete_time_int'];
|
||||
|
||||
//时间戳字段转换
|
||||
protected $type = [
|
||||
'create_time_int' => 'timestamp:Y-m-d H:i:s',
|
||||
'update_time_int' => 'timestamp:Y-m-d H:i:s',
|
||||
'delete_time_int' => 'timestamp:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function avatarPicFile(){
|
||||
return $this->belongsTo('app\model\Files','avatar_pic','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getVipTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['vip_time']) ? $data['vip_time'] : 0;
|
||||
}
|
||||
|
||||
public function getLoginTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['login_time']) ? strtotime($data['login_time']) : 0;
|
||||
}
|
||||
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 系统配置模型
|
||||
*/
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Conf extends BaseModel
|
||||
{
|
||||
protected $name = 'conf';
|
||||
}
|
||||
Executable
+57
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* 附件管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
use laytp\library\UploadDomain;
|
||||
|
||||
class Files extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'files';
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function category(){
|
||||
return $this->belongsTo('app\model\files\Category','category_id','id');
|
||||
}
|
||||
|
||||
public function createAdminUser(){
|
||||
return $this->belongsTo('app\model\admin\User','create_admin_user_id','id');
|
||||
}
|
||||
|
||||
public function updateAdminUser(){
|
||||
return $this->belongsTo('app\model\admin\User','update_admin_user_id','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getPathAttr($value, $data)
|
||||
{
|
||||
return $value ? UploadDomain::singleAddUploadDomain($data) : '';
|
||||
}
|
||||
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
/**
|
||||
* 会员管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Member extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'member';
|
||||
|
||||
//附加属性
|
||||
protected $append = ['vip_time_int','login_time_int','create_time_int','update_time_int','delete_time_int'];
|
||||
|
||||
//时间戳字段转换
|
||||
protected $type = [
|
||||
'vip_time' => 'timestamp:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function avatarPicFile(){
|
||||
return $this->belongsTo('app\model\Files','avatar_pic','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getVipTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['vip_time']) ? $data['vip_time'] : 0;
|
||||
}
|
||||
|
||||
public function getLoginTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['login_time']) ? strtotime($data['login_time']) : 0;
|
||||
}
|
||||
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 数据库迁移模型
|
||||
*/
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Migrations extends BaseModel
|
||||
{
|
||||
protected $name = 'migrations';
|
||||
}
|
||||
Executable
+38
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* 会员管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Order extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'order';
|
||||
|
||||
//附加属性
|
||||
protected $append = ['create_time','end_time'];
|
||||
|
||||
//时间戳字段转换
|
||||
protected $type = [
|
||||
'end_time' => 'timestamp:Y-m-d H:i:s',
|
||||
'create_time' => 'timestamp:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
//表名
|
||||
//关联模型
|
||||
public function avatarPicFile(){
|
||||
return $this->belongsTo('app\model\Files','avatar_pic','id');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
Executable
+94
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
namespace app\model;
|
||||
|
||||
use think\facade\Db;
|
||||
use think\facade\Cache;
|
||||
use think\facade\Log;
|
||||
|
||||
|
||||
class TronSdk
|
||||
{
|
||||
|
||||
private $domain;
|
||||
private $username;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->domain = "http://tron.konline.top:888/";
|
||||
$this->username= "kaihekaiyuan";
|
||||
$this->token= "a782a1f489d32687fd9f67f42f35e9e1";
|
||||
}
|
||||
//setwebhook
|
||||
public function setwebhook2($webhookurl, $trcadd){
|
||||
$func= $this->domain."custom/webhook";
|
||||
// $webhookurl='http://' . env('proxyDomain', 'false') . '/customer/PayApi/pay?type='.$mode;
|
||||
$data=['username'=>$this->username,'address'=>$trcadd,"url"=>$webhookurl];
|
||||
$sing= md5($this->username.$trcadd.$webhookurl.$this->token);
|
||||
$data['sign']=$sing;
|
||||
return json_decode(curl_post($func,http_build_query($data)),true);
|
||||
}
|
||||
public function setwebhook($mode, $trcadd) //模块 订阅地址
|
||||
{ $func= $this->domain."custom/webhook";
|
||||
$webhookurl='http://' . env('proxyDomain', 'false') . '/customer/PayApi/pay?type='.$mode;
|
||||
$data=['username'=>$this->username,'address'=>$trcadd,"url"=>$webhookurl];
|
||||
$sing= md5($this->username.$trcadd.$webhookurl.$this->token);
|
||||
$data['sign']=$sing;
|
||||
return json_decode(curl_post($func,http_build_query($data)),true);
|
||||
|
||||
}
|
||||
//delete_webhook
|
||||
public function delete_webhook($address){ //删除订阅
|
||||
$func= $this->domain."custom/delete_webhook";
|
||||
|
||||
$data=['username'=>$this->username,'address'=>$address];
|
||||
$sing= md5($this->username.$address.$this->token);
|
||||
$data['sign']=$sing;
|
||||
return json_decode(curl_post($func,http_build_query($data)),true);
|
||||
}
|
||||
public function up_webhook($address,$weburl){ //更新订阅
|
||||
$func= $this->domain."custom/up_webhook";
|
||||
|
||||
$data=['username'=>$this->username,'url'=>$weburl,'address'=>$address];
|
||||
$sing= md5($this->username.$address.$weburl.$this->token);
|
||||
$data['sign']=$sing;
|
||||
return json_decode(curl_post($func,http_build_query($data)),true);
|
||||
}
|
||||
|
||||
public function queryhook($address,$cache=null) //查询订阅
|
||||
{ $func= $this->domain."custom/query";
|
||||
|
||||
$data=['username'=>$this->username,'address'=>$address];
|
||||
$sing= md5($this->username.$address.$this->token);
|
||||
$data['sign']=$sing;
|
||||
if(empty($cache)){
|
||||
$cache= cache::get("custom/query".$address);
|
||||
if(!empty($cache)){
|
||||
// var_dump("99999");
|
||||
return $cache;
|
||||
}else{
|
||||
$cache=json_decode(curl_post($func,http_build_query($data)),true);
|
||||
cache::set("custom/query".$address,$cache,1600);
|
||||
return $cache;
|
||||
}
|
||||
}else{
|
||||
$cache=json_decode(curl_post($func,http_build_query($data)),true);
|
||||
cache::set("custom/query".$address,$cache,1600);
|
||||
return $cache;
|
||||
}
|
||||
|
||||
}
|
||||
//查询地址是否合规
|
||||
public function checkaddress($address){
|
||||
$url="https://apilist.tronscanapi.com/api/multiple/chain/query?address=".$address;//
|
||||
$data=json_decode(curl_get($url),true);
|
||||
$publicTag=isset($data['publicTag'])?$data['publicTag']:"";
|
||||
//var_dump($data);
|
||||
if(empty($publicTag)){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Executable
+63
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/**
|
||||
* 会员管理模型
|
||||
*/
|
||||
namespace app\model;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class User extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'user';
|
||||
|
||||
//附加属性
|
||||
protected $append = ['create_time','update_time','delete_time','vip_time','login_time'];
|
||||
|
||||
//时间戳字段转换
|
||||
protected $type = [
|
||||
// 'create_time' => 'timestamp:Y-m-d H:i:s',
|
||||
// 'update_time' => 'timestamp:Y-m-d H:i:s',
|
||||
// 'delete_time' => 'timestamp:Y-m-d H:i:s',
|
||||
// 'vip_time' => 'timestamp:Y-m-d H:i:s',
|
||||
// 'login_time' => 'timestamp:Y-m-d H:i:s',
|
||||
|
||||
];
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function avatarPicFile(){
|
||||
return $this->belongsTo('app\model\Files','avatar_pic','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getVipTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['vip_time']) ? $data['vip_time'] : 0;
|
||||
}
|
||||
|
||||
public function getLoginTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['login_time']) ? strtotime($data['login_time']) : 0;
|
||||
}
|
||||
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台菜单模型
|
||||
*/
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Menu extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'admin_menu';
|
||||
|
||||
protected $append = [];
|
||||
}
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* 角色模型
|
||||
*/
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Role extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
protected $name = 'admin_role';
|
||||
}
|
||||
Executable
+52
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台管理员表模型
|
||||
*/
|
||||
|
||||
namespace app\model\admin;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use laytp\library\UploadDomain;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class User extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'admin_user';
|
||||
|
||||
//数组常量
|
||||
public $const = [
|
||||
'is_super_manager' => [
|
||||
'2' => '否'
|
||||
, '1' => '是',
|
||||
],
|
||||
'status' => [
|
||||
'2' => '禁用'
|
||||
, '1' => '正常',
|
||||
],
|
||||
];
|
||||
|
||||
public function avatarFile(){
|
||||
return $this->belongsTo('app\model\Files','avatar','id');
|
||||
}
|
||||
|
||||
// 定义默认头像
|
||||
public function getAvatarFileAttr($value){
|
||||
if(!$value){
|
||||
return [
|
||||
'id' => "",
|
||||
'filename' => '默认头像',
|
||||
'path' => UploadDomain::getDefaultAvatar(),
|
||||
];
|
||||
}else{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
public function roleIds()
|
||||
{
|
||||
return $this->hasMany(\app\model\admin\role\User::class, 'admin_user_id');
|
||||
}
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台操作日志模型
|
||||
*/
|
||||
namespace app\model\admin\action;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Log extends BaseModel
|
||||
{
|
||||
|
||||
//模型名
|
||||
protected $name = 'admin_action_log';
|
||||
|
||||
//附加属性
|
||||
protected $append = [];
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function adminUser(){
|
||||
return $this->belongsTo('app\model\admin\User','admin_id','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* Api请求日志模型
|
||||
*/
|
||||
namespace app\model\admin\balance;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Log extends BaseModel
|
||||
{
|
||||
|
||||
//模型名
|
||||
protected $name = 'balance';
|
||||
|
||||
//附加属性
|
||||
protected $append = [];
|
||||
|
||||
//时间戳字段转换
|
||||
protected $type = [
|
||||
'time' => 'timestamp:Y-m-d H:i:s',
|
||||
];
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/**
|
||||
* 后台登录日志模型
|
||||
*/
|
||||
namespace app\model\admin\login;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Log extends BaseModel
|
||||
{
|
||||
|
||||
//模型名
|
||||
protected $name = 'admin_login_log';
|
||||
|
||||
//附加属性
|
||||
protected $append = [];
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function adminUser(){
|
||||
return $this->belongsTo('app\model\admin\User','admin_id','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
/**
|
||||
* 菜单与角色关系模型
|
||||
*/
|
||||
|
||||
namespace app\model\admin\menu;
|
||||
|
||||
use think\model\Pivot;
|
||||
|
||||
class Role extends Pivot
|
||||
{
|
||||
protected $name = 'admin_menu_role';
|
||||
}
|
||||
Executable
+14
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
/**
|
||||
* 角色与用户关系
|
||||
*/
|
||||
|
||||
namespace app\model\admin\role;
|
||||
|
||||
use think\model\Pivot;
|
||||
|
||||
class User extends Pivot
|
||||
{
|
||||
protected $name = 'admin_role_user';
|
||||
|
||||
}
|
||||
Executable
+32
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
/**
|
||||
* Api请求日志模型
|
||||
*/
|
||||
namespace app\model\api;
|
||||
|
||||
use laytp\BaseModel;
|
||||
|
||||
class Log extends BaseModel
|
||||
{
|
||||
|
||||
//模型名
|
||||
protected $name = 'api_log';
|
||||
|
||||
//附加属性
|
||||
protected $append = [];
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
}
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* 附件分类管理模型
|
||||
*/
|
||||
namespace app\model\files;
|
||||
|
||||
use laytp\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
class Category extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
|
||||
//模型名
|
||||
protected $name = 'files_category';
|
||||
|
||||
//时间戳字段转换
|
||||
|
||||
|
||||
//表名
|
||||
|
||||
|
||||
//关联模型
|
||||
public function parent(){
|
||||
return $this->belongsTo('app\model\files\Category','pid','id');
|
||||
}
|
||||
|
||||
//新增属性的方法
|
||||
public function getCreateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['create_time']) ? strtotime($data['create_time']) : 0;
|
||||
}
|
||||
|
||||
public function getUpdateTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['update_time']) ? strtotime($data['update_time']) : 0;
|
||||
}
|
||||
|
||||
public function getDeleteTimeIntAttr($value, $data)
|
||||
{
|
||||
return isset($data['delete_time']) ? strtotime($data['delete_time']) : 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user