初始化
This commit is contained in:
78
addons/webman/model/Activity.php
Normal file
78
addons/webman/model/Activity.php
Normal file
@@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class activity
|
||||
* @property int id 主键
|
||||
* @property int status 状态
|
||||
* @property int is_show 状态
|
||||
* @property int department_id 渠道id
|
||||
* @property int sort 排序
|
||||
* @property string link 链接
|
||||
* @property int recharge_id 充值配置id
|
||||
* @property string start_time 开始时间
|
||||
* @property string end_time 结束时间
|
||||
* @property int type 类型
|
||||
* @property int cycle_type 周期类型
|
||||
* @property string cycle_data 周期数据
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @property Channel channel 渠道
|
||||
* @property ActivityContent activity_content 活动内容
|
||||
* @property ChannelRechargeSetting channelRechargeSetting 活动内容
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Activity extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const TYPE_CYCLE = 1; // 周期模式
|
||||
const TYPE_CUSTOM = 2; // 自定义模式
|
||||
|
||||
//数据权限字段
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.activity_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动内容
|
||||
* @return hasMany
|
||||
*/
|
||||
public function activity_content(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.activity_content_model'), 'activity_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值配置
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channelRechargeSetting(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_recharge_setting_model'), 'recharge_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
42
addons/webman/model/ActivityContent.php
Normal file
42
addons/webman/model/ActivityContent.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class ActivityContent
|
||||
* @property int id 主键
|
||||
* @property string name 活动名称
|
||||
* @property int activity_id 活动id
|
||||
* @property string lang 语言标识
|
||||
* @property string link 链接
|
||||
* @property string picture 活动主图
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Activity activity 活动
|
||||
* @property ActivityContent activity_content 活动内容
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ActivityContent extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
//数据权限字段
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.activity_content_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 活动
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function activity(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.activity_model'), 'activity_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
19
addons/webman/model/AdminConfig.php
Normal file
19
addons/webman/model/AdminConfig.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminConfig extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
protected $fillable = ['name', 'value'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.config_table'));
|
||||
}
|
||||
}
|
||||
66
addons/webman/model/AdminDepartment.php
Normal file
66
addons/webman/model/AdminDepartment.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class AdminDepartment
|
||||
* @property int id 主键
|
||||
* @property string pid 上级部门
|
||||
* @property string name 部門名稱
|
||||
* @property string leader 負責人
|
||||
* @property string phone 手机号
|
||||
* @property int status 狀態
|
||||
* @property int type 1 部门 2渠道
|
||||
* @property int sort 排序
|
||||
* @property string path 层级
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Channel channel 渠道信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AdminDepartment extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
const TYPE_DEPARTMENT = 1; // 部门
|
||||
const TYPE_CHANNEL = 2; // 渠道
|
||||
|
||||
const ADMIN_ID = 1;// 总站id
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.department_table'));
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
//创建时间倒序
|
||||
static::addGlobalScope('sort', function (Builder $builder) {
|
||||
$builder->latest();
|
||||
});
|
||||
}
|
||||
|
||||
protected function getPidAttribute($value)
|
||||
{
|
||||
return (int)$value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return HasOne
|
||||
*/
|
||||
public function channel(): HasOne
|
||||
{
|
||||
return $this->hasOne(plugin()->webman->config('database.channel_model'), 'department_id');
|
||||
}
|
||||
}
|
||||
21
addons/webman/model/AdminFileAttachment.php
Normal file
21
addons/webman/model/AdminFileAttachment.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class AdminFileAttachment extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
protected $fillable = ['cate_id', 'uploader_id', 'type', 'file_type', 'name', 'real_name', 'path', 'url', 'ext', 'disk', 'size'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.attachment_table'));
|
||||
}
|
||||
}
|
||||
15
addons/webman/model/AdminFileAttachmentCate.php
Normal file
15
addons/webman/model/AdminFileAttachmentCate.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminFileAttachmentCate extends Model
|
||||
{
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.attachment_cate_table'));
|
||||
}
|
||||
}
|
||||
23
addons/webman/model/AdminMenu.php
Normal file
23
addons/webman/model/AdminMenu.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminMenu extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
protected $fillable = ['name', 'icon', 'url', 'plugin', 'pid', 'sort', 'status', 'open'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.menu_table'));
|
||||
}
|
||||
|
||||
protected function getNameAttribute($value)
|
||||
{
|
||||
return admin_trans('menu.titles.' . $value, $value);
|
||||
}
|
||||
}
|
||||
43
addons/webman/model/AdminPost.php
Normal file
43
addons/webman/model/AdminPost.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class AdminPost
|
||||
* @property int id 主键
|
||||
* @property string name 权限角色名称
|
||||
* @property int status 备注说明
|
||||
* @property int sort 排序
|
||||
* @property int department_id 渠道id
|
||||
* @property int type 1 总后台 2渠道后台
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AdminPost extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.post_table'));
|
||||
}
|
||||
protected static function booted()
|
||||
{
|
||||
//创建时间倒序
|
||||
static::addGlobalScope('sort', function (Builder $builder) {
|
||||
$builder->latest();
|
||||
});
|
||||
}
|
||||
}
|
||||
50
addons/webman/model/AdminRole.php
Normal file
50
addons/webman/model/AdminRole.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AdminRole
|
||||
* @property int id 主键
|
||||
* @property string name 权限角色名称
|
||||
* @property string desc 备注说明
|
||||
* @property string sort 排序
|
||||
* @property string data_type 数据权限类型:0=全部数据权限,1=自定义数据权限,2=本部门及以下数据权限,3=本部门数据权限,4=本人数据权限
|
||||
* @property int type 1 总后台 2渠道后台
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AdminRole extends Model
|
||||
{
|
||||
CONST ROLE_CHANNEL = 3; // 渠道管理员角色
|
||||
|
||||
CONST DATA_TYPE_ALL = 0; // 全部数据权限
|
||||
CONST DATA_TYPE_CUSTOM = 1; // 自定义数据权限
|
||||
CONST DATA_TYPE_DEPARTMENT_BELOW = 2; // 本部门及以下数据权限
|
||||
CONST DATA_TYPE_DEPARTMENT = 3; // 本部门数据权限
|
||||
CONST DATA_TYPE_SELF = 4; // 本人数据权限
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.role_table'));
|
||||
}
|
||||
/**
|
||||
* 部门
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function department(){
|
||||
return $this->belongsToMany(plugin()->webman->config('database.department_model'),plugin()->webman->config('database.role_department_model'), 'role_id', 'department_id');
|
||||
}
|
||||
protected function setCheckStrictlyAttribute($value)
|
||||
{
|
||||
$this->attributes['check_strictly'] = (int)$value;
|
||||
}
|
||||
protected function getCheckStrictlyAttribute($value)
|
||||
{
|
||||
return (boolean)$value;
|
||||
}
|
||||
}
|
||||
14
addons/webman/model/AdminRoleDepartment.php
Normal file
14
addons/webman/model/AdminRoleDepartment.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminRoleDepartment extends Model
|
||||
{
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.role_department_table'));
|
||||
}
|
||||
}
|
||||
14
addons/webman/model/AdminRoleMenu.php
Normal file
14
addons/webman/model/AdminRoleMenu.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminRoleMenu extends Model
|
||||
{
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.role_menu_table'));
|
||||
}
|
||||
}
|
||||
14
addons/webman/model/AdminRolePermission.php
Normal file
14
addons/webman/model/AdminRolePermission.php
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class AdminRolePermission extends Model
|
||||
{
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.role_permission_table'));
|
||||
}
|
||||
}
|
||||
25
addons/webman/model/AdminRoleUsers.php
Normal file
25
addons/webman/model/AdminRoleUsers.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class AdminRoleUsers
|
||||
* @property int id 主键
|
||||
* @property int role_id 角色id
|
||||
* @property int user_id 用户id
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AdminRoleUsers extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.role_user_table'));
|
||||
}
|
||||
}
|
||||
75
addons/webman/model/AdminUser.php
Normal file
75
addons/webman/model/AdminUser.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class AdminUser
|
||||
* @property int id 主键
|
||||
* @property string username 用户账号
|
||||
* @property string password 密码
|
||||
* @property string nickname 姓名
|
||||
* @property string avatar 头像
|
||||
* @property string email 邮箱
|
||||
* @property string phone 手机号
|
||||
* @property int status 状态(0:禁用,1:启用)
|
||||
* @property int type 1 部门 2渠道
|
||||
* @property string remember_token 排序
|
||||
* @property int department_id 部门
|
||||
* @property int is_super 是否渠道超管
|
||||
* @property int post 岗位
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminDepartment department 部门/渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AdminUser extends Model
|
||||
{
|
||||
protected $casts = ['post'=>'array'];
|
||||
protected $fillable = ['username', 'password', 'nickname', 'avatar'];
|
||||
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.user_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 角色
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
|
||||
*/
|
||||
public function roles(){
|
||||
return $this->belongsToMany(plugin()->webman->config('database.role_model'),plugin()->webman->config('database.role_user_model'), 'user_id', 'role_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function department(){
|
||||
return $this->belongsTo(plugin()->webman->config('database.department_model'), 'department_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
|
||||
*/
|
||||
public function permission()
|
||||
{
|
||||
return $this->hasManyThrough(plugin()->webman->config('database.role_permission_model'), plugin()->webman->config('database.role_user_model'), 'user_id', 'role_id','id','role_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码哈希加密
|
||||
* @param $value
|
||||
*/
|
||||
public function setPasswordAttribute($value){
|
||||
$this->attributes['password'] = password_hash($value,PASSWORD_DEFAULT);
|
||||
}
|
||||
}
|
||||
79
addons/webman/model/Announcement.php
Normal file
79
addons/webman/model/Announcement.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Announcement
|
||||
* @property int id 主键
|
||||
* @property string valid_time 有效时间
|
||||
* @property string push_time 发布时间
|
||||
* @property int sort 排序
|
||||
* @property int status 状态
|
||||
* @property int type 类型
|
||||
* @property int priority 优先级
|
||||
* @property int admin_id 管理员id
|
||||
* @property int department_id 渠道id
|
||||
* @property string admin_name 管理员名称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @property AdminUser adminUser 管理员
|
||||
* @property Channel channel 渠道
|
||||
* @property Channel content 内容
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Announcement extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const PRIORITY_ORDINARY = 1; // 普通
|
||||
const PRIORITY_SENIOR = 2; // 高级
|
||||
const PRIORITY_EMERGENT = 3; // 紧急
|
||||
|
||||
const TYPE_BULLETIN = 1; // 公告
|
||||
const TYPE_EVEBT = 2; // 事件
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.announcement_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏类别
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function adminUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'admin_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return hasMany
|
||||
*/
|
||||
public function content(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.announcement_content_model'), 'announcement_id');
|
||||
}
|
||||
}
|
||||
60
addons/webman/model/AnnouncementContent.php
Normal file
60
addons/webman/model/AnnouncementContent.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class AnnouncementContent
|
||||
* @property int id 主键
|
||||
* @property int department_id 渠道id
|
||||
* @property int announcement_id 公告id
|
||||
* @property string title 标题
|
||||
* @property string lang 语言标识
|
||||
* @property string content 内容
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Channel channel 渠道
|
||||
* @property Announcement announcement 公告
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AnnouncementContent extends Model
|
||||
{
|
||||
use DataPermissions, HasDateTimeFormatter;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
protected $fillable = [
|
||||
'content', 'title', 'lang', 'announcement_id', 'department_id',
|
||||
];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.announcement_content_table'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function announcement(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.announcement_model'), 'announcement_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
28
addons/webman/model/ApiErrorLog.php
Normal file
28
addons/webman/model/ApiErrorLog.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class ApiErrorLog
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int target
|
||||
* @property int target_id
|
||||
* @property string url 地址
|
||||
* @property string params 参数
|
||||
* @property string content 内容
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ApiErrorLog extends Model
|
||||
{
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.api_error_log_table'));
|
||||
}
|
||||
}
|
||||
53
addons/webman/model/AppVersion.php
Normal file
53
addons/webman/model/AppVersion.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class AppVersion
|
||||
* @property int id 主键
|
||||
* @property int department_id 所属部门/渠道
|
||||
* @property string system_key 系统标识
|
||||
* @property string app_version 版本号
|
||||
* @property string app_version_key 版本标识
|
||||
* @property string apk_url 安装包地址
|
||||
* @property string force_update 强制更新 1强制 0不强制
|
||||
* @property string hot_update 热更新 0 热更新 1 整包更新
|
||||
* @property string regular_update 定时更新
|
||||
* @property string update_content 更新内容
|
||||
* @property string notes 操作备注
|
||||
* @property int status 状态
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员名称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminDepartment department
|
||||
* @property AdminUser user
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class AppVersion extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
const SYSTEM_KEY_ANDROID = 'android'; // 安卓
|
||||
const SYSTEM_KEY_IOS = 'ios'; // 苹果
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.app_version_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
30
addons/webman/model/BankList.php
Normal file
30
addons/webman/model/BankList.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class PlayerBank
|
||||
* @property int id 主键
|
||||
* @property string bank_name 银行名称
|
||||
* @property string bank_code 银行代码
|
||||
* @property int pay_type 支付渠道
|
||||
* @property int type 类型
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class BankList extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.bank_list_table'));
|
||||
}
|
||||
|
||||
}
|
||||
55
addons/webman/model/Broadcast.php
Normal file
55
addons/webman/model/Broadcast.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property int department_id 渠道id
|
||||
* @property string title 任务名
|
||||
* @property int num 数据量
|
||||
* @property int copy_num 重复次数
|
||||
* @property int type 播报类型
|
||||
* @property int retry_seconds 间隔时间
|
||||
* @property int min_money 展示最小金额
|
||||
* @property int max_money 展示最大金额
|
||||
* @property string start_time 开始时间
|
||||
* @property int repeat 是否循环
|
||||
* @property int status 状态
|
||||
* @property int creator_id 创建者id
|
||||
* @property string shield_id 屏蔽类型id
|
||||
* @property string latest_date 上次投递日期
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
* @property string date 展示日期
|
||||
* @property string phone 手机号
|
||||
*
|
||||
* @property Broadcast broadcasts
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Broadcast extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
}
|
||||
|
||||
}
|
||||
126
addons/webman/model/Channel.php
Normal file
126
addons/webman/model/Channel.php
Normal file
@@ -0,0 +1,126 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use support\Cache;
|
||||
|
||||
/**
|
||||
* Class Channel
|
||||
* @property int id 主键
|
||||
* @property string name 渠道名称
|
||||
* @property string domain 渠道域名
|
||||
* @property string lang 语言
|
||||
* @property string currency 币别代码
|
||||
* @property int department_id 所属部门
|
||||
* @property int user_id 管理员id
|
||||
* @property int site_id 渠道编号
|
||||
* @property int status 状态(0:禁用,1:启用)
|
||||
* @property string telegram_url telegram地址
|
||||
* @property string package_url 安装包地址
|
||||
* @property int recharge_status 平台充值(0:禁用,1:启用)
|
||||
* @property int withdraw_status 提现(0:禁用,1:启用)
|
||||
* @property int web_login_status web登录状态(0:禁用,1:启用)
|
||||
* @property int wallet_action_status 钱包操作功能(0:禁用,1:启用)
|
||||
* @property float recharge_amount 总充值点数
|
||||
* @property float withdraw_amount 总提现点数
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property int promotion_status 推广员功能(0:禁用,1:启用)
|
||||
* @property int pay_type 支付方式
|
||||
* @property int game_id 游戏id
|
||||
* @property int create_id 创建人id
|
||||
*
|
||||
* @property AdminDepartment department
|
||||
* @property AdminUser user
|
||||
* @property Player player
|
||||
* @property PlayerPlatformCash wallet
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Channel extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, SoftDeletes;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.channel_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function department(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.department_model'), 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return hasMany
|
||||
*/
|
||||
public function player(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.player_model'), 'department_id', 'department_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return hasManyThrough
|
||||
*/
|
||||
public function wallet(): hasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(plugin()->webman->config('database.player_platform_cash_model'), plugin()->webman->config('database.player_model'), 'department_id', 'player_id', 'department_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::created(function (Channel $channel) {
|
||||
$cacheKey = "channel_" . $channel->site_id;
|
||||
Cache::set($cacheKey, $channel->toArray());
|
||||
// 创建渠道系统配置
|
||||
SystemSetting::insert([
|
||||
[
|
||||
'department_id' => $channel->department_id,
|
||||
'feature' => 'marquee',
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
],
|
||||
[
|
||||
'department_id' => $channel->department_id,
|
||||
'feature' => 'machine_marquee',
|
||||
'created_at' => date('Y-m-d H:i:s'),
|
||||
]
|
||||
]);
|
||||
});
|
||||
static::deleted(function (Channel $channel) {
|
||||
$cacheKey = "channel_" . $channel->site_id;
|
||||
Cache::delete($cacheKey);
|
||||
});
|
||||
static::updated(function (Channel $channel) {
|
||||
$cacheKey = "channel_" . $channel->site_id;
|
||||
Cache::set($cacheKey, $channel->toArray());
|
||||
});
|
||||
}
|
||||
}
|
||||
58
addons/webman/model/ChannelFinancialRecord.php
Normal file
58
addons/webman/model/ChannelFinancialRecord.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class ChannelFinancialRecord
|
||||
* @property int id 主键
|
||||
* @property int department_id 类型
|
||||
* @property int player_id 玩家id
|
||||
* @property string target 资料表
|
||||
* @property int target_id 资料表记录id
|
||||
* @property int action 操作
|
||||
* @property string tradeno 单号
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员名
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
|
||||
* @property Player player 玩家信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ChannelFinancialRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
CONST ACTION_RECHARGE_PASS = 1; // 充值审核通过
|
||||
CONST ACTION_RECHARGE_REJECT = 2; // 充值审核拒绝
|
||||
CONST ACTION_WITHDRAW_PASS = 3; // 提现审核通过
|
||||
CONST ACTION_WITHDRAW_REJECT = 4; // 提现审核拒绝
|
||||
CONST ACTION_WITHDRAW_PAYMENT = 5; // 提现打款
|
||||
CONST ACTION_RECHARGE_SETTING_ADD = 6; // 添加充值配置
|
||||
CONST ACTION_RECHARGE_SETTING_STOP = 7; // 停用充值配置
|
||||
CONST ACTION_RECHARGE_SETTING_ENABLE = 8; // 启用充值配置
|
||||
CONST ACTION_RECHARGE_SETTING_EDIT = 9; // 修改充值配置
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.channel_financial_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'),'player_id');
|
||||
}
|
||||
}
|
||||
84
addons/webman/model/ChannelRechargeMethod.php
Normal file
84
addons/webman/model/ChannelRechargeMethod.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class ChannelRechargeMethod
|
||||
* @property int id 主键
|
||||
* @property int department_id 所属部门/渠道
|
||||
* @property string account 银行账户
|
||||
* @property string currency 货币
|
||||
* @property string wallet_address 钱包地址
|
||||
* @property string qr_code 二维码
|
||||
* @property float rate 汇率
|
||||
* @property int type 支付类型
|
||||
* @property int user_id 管理员id
|
||||
* @property int user_name 管理员名称
|
||||
* @property int status 状态(0:禁用,1:启用)
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminDepartment department
|
||||
* @property AdminUser user
|
||||
* @property ChannelRechargeMethodLang methodLang
|
||||
* @property ChannelRechargeSetting channelRechargeSetting
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ChannelRechargeMethod extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, SoftDeletes, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.channel_recharge_method_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function department(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.department_model'), 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 多语言
|
||||
* @return hasMany
|
||||
*/
|
||||
public function methodLang(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.channel_recharge_method_lang_model'), 'method_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值配置
|
||||
* @return hasMany
|
||||
*/
|
||||
public function channelRechargeSetting(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.channel_recharge_setting_model'), 'method_id');
|
||||
}
|
||||
}
|
||||
40
addons/webman/model/ChannelRechargeMethodLang.php
Normal file
40
addons/webman/model/ChannelRechargeMethodLang.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class ChannelRechargeMethodLang
|
||||
* @property int id 主键
|
||||
* @property string lang 语言标识
|
||||
* @property string name 姓名
|
||||
* @property int method_id 充值方式
|
||||
* @property string bank_name 银行
|
||||
* @property string sub_bank 支行
|
||||
* @property string owner 户名
|
||||
*
|
||||
* @property ChannelRechargeMethod rechargeMethod
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ChannelRechargeMethodLang extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['lang', 'name', 'method_id', 'bank_name', 'sub_bank', 'owner'];
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.channel_recharge_method_lang_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值方式
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function rechargeMethod(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_recharge_method_model'), 'method_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
76
addons/webman/model/ChannelRechargeSetting.php
Normal file
76
addons/webman/model/ChannelRechargeSetting.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class ChannelRechargeSetting
|
||||
* @property int id 主键
|
||||
* @property int department_id 所属部门
|
||||
* @property int method_id 充值方式id
|
||||
* @property int user_id 管理员id
|
||||
* @property int user_name 管理员名称
|
||||
* @property int title 标题
|
||||
* @property int status 状态(0:禁用,1:启用)
|
||||
* @property int type 充值类型
|
||||
* @property float chip_multiple 打码倍数
|
||||
* @property float coins_num coins数量
|
||||
* @property float gift_coins 赠送coins
|
||||
* @property float money 充值金额
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminDepartment department
|
||||
* @property AdminUser user
|
||||
* @property ChannelRechargeMethod channel_recharge_method
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ChannelRechargeSetting extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, SoftDeletes, DataPermissions;
|
||||
|
||||
const TYPE_REGULAR = 1; // 普通充值
|
||||
const TYPE_ACTIVITY = 2; // 活动充值
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.channel_recharge_setting_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 部门
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function department(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.department_model'), 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值账户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel_recharge_method(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_recharge_method_model'), 'method_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
72
addons/webman/model/CommissionRecord.php
Normal file
72
addons/webman/model/CommissionRecord.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class SignIns
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 渠道id
|
||||
* @property int parent_player_id 推广玩家
|
||||
* @property float recharge_amount 充值金额
|
||||
* @property float chip_amount 打码量
|
||||
* @property float total_amount 总佣金
|
||||
* @property float damage_amount 客损金额
|
||||
* @property float amount 佣金
|
||||
* @property float ratio 佣金比例
|
||||
* @property string date 日期
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Player parentPlayer 分润玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class CommissionRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected
|
||||
$dataAuth = ['department_id' => 'department_id'];
|
||||
//简写省略id,默认后台用户表的id
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.commission_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 分润玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function parentPlayer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'parent_player_id');
|
||||
}
|
||||
}
|
||||
52
addons/webman/model/Currency.php
Normal file
52
addons/webman/model/Currency.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Currency
|
||||
* @property int id 主键
|
||||
* @property string name 货币名称
|
||||
* @property string identifying 货币标识
|
||||
* @property float ratio 1货币-点数
|
||||
* @property int status 状态
|
||||
* @property int admin_id 管理员id
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Currency extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.currency_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏类别
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function admin_user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'admin_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 比值
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getRatioAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
}
|
||||
71
addons/webman/model/DrawRecord.php
Normal file
71
addons/webman/model/DrawRecord.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class Game
|
||||
* @property int id 主键
|
||||
* @property int department_id 渠道ID
|
||||
* @property int uid 玩家id
|
||||
* @property int prize_id 奖品id
|
||||
* @property int prize_type 奖品类型
|
||||
* @property string prize_name 奖品名称
|
||||
* @property string prize_pic 奖品图片
|
||||
* @property int game_id 游戏id
|
||||
* @property int game_type 游戏类型
|
||||
* @property string draw_time 抽奖时间
|
||||
* @property string ip 用户ip
|
||||
* @property float consume 抽奖消耗
|
||||
* @property string remove_status 是否标记
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property GamePlatform gamePlatform 游戏平台信息
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
|
||||
class DrawRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
protected $table = 'draw_records';
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['uid', 'prize_id', 'prize_type', 'prize_name', 'prize_pic', 'game_id', 'game_type', 'department_id', 'draw_time', 'ip', 'consume'];
|
||||
|
||||
/**
|
||||
* 奖品信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function prize(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.prize_model'), 'prize_id', 'id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'uid')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
34
addons/webman/model/ExternalApp.php
Normal file
34
addons/webman/model/ExternalApp.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* 外部应用
|
||||
* Class ExternalApp
|
||||
* @property int id 主键
|
||||
* @property string name 应用名
|
||||
* @property string white_ip 百化IP
|
||||
* @property string app_id app_id
|
||||
* @property string app_secret app_secret
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员名称
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class ExternalApp extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.external_app_table'));
|
||||
}
|
||||
}
|
||||
62
addons/webman/model/Game.php
Normal file
62
addons/webman/model/Game.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Game
|
||||
* @property int id 主键
|
||||
* @property int platform_id 平台id
|
||||
* @property int game_code 游戏编号
|
||||
* @property float consume 抽奖消耗
|
||||
* @property int platform_game_type 平台游戏类型
|
||||
* @property int game_type 游戏类型
|
||||
* @property int prize_num 奖品数量
|
||||
* @property string name 游戏名
|
||||
* @property string player_num_range 玩家数量范围
|
||||
* @property int status 状态
|
||||
* @property int is_hot 是否热门
|
||||
* @property int is_online 是否上线
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string test_url 测试地址
|
||||
* @property string game_url 游戏地址
|
||||
*
|
||||
* @property GamePlatform gamePlatform 游戏平台信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Game extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
protected $fillable = ['platform_id', 'game_code', 'platform_game_type', 'game_image', 'name', 'game_data', 'game_type', 'prize_num'];
|
||||
|
||||
const GAME_TYPE_EGG = 1; // 砸金蛋
|
||||
const GAME_TYPE_TURNTABLE = 2; // 转盘
|
||||
const GAME_TYPE_BLINDBOX = 3; // 盲盒
|
||||
const GAME_TYPE_TICKET = 4; // 刮刮乐
|
||||
const GAME_TYPE_LOTTERY = 5; // 抽奖
|
||||
const GAME_TYPE_DICE = 6; // 摇色子
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.game_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function gamePlatform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.game_platform_model'), 'platform_id')->withTrashed();
|
||||
}
|
||||
|
||||
}
|
||||
32
addons/webman/model/GamePlatform.php
Normal file
32
addons/webman/model/GamePlatform.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class GamePlatform
|
||||
* @property int id 主键
|
||||
* @property string name 游戏平台code
|
||||
* @property string title 游戏
|
||||
* @property string config 配置
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @property float service_ratio 供应商分润比例
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class GamePlatform extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.game_platform_table'));
|
||||
}
|
||||
}
|
||||
36
addons/webman/model/GameType.php
Normal file
36
addons/webman/model/GameType.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
|
||||
/**
|
||||
* Class Game
|
||||
* @property int id 主键
|
||||
* @property int game_type 游戏类型
|
||||
* @property int radio 返佣比例
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class GameType extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
const GAME_TYPE_SLOT = 1; // slot游戏
|
||||
const GAME_TYPE_CASINO = 2; // 赌场
|
||||
const GAME_TYPE_ARCADE = 3; // 游乐中心
|
||||
const GAME_TYPE_FISHING = 4; // 捕鱼
|
||||
const GAME_TYPE_REAL = 5; // 真人视讯
|
||||
const GAME_TYPE_BALL = 6; // 赌球
|
||||
const GAME_TYPE_CHICKEN = 7; // 斗鸡
|
||||
const GAME_TYPE_BINGO = 8; // 宾果
|
||||
const GAME_TYPE_Lotto = 9; // 彩票
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.game_type_table'));
|
||||
}
|
||||
|
||||
}
|
||||
116
addons/webman/model/Notice.php
Normal file
116
addons/webman/model/Notice.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Notice
|
||||
* @property int id 主键
|
||||
* @property int department_id 渠道id
|
||||
* @property int player_id 玩家id
|
||||
* @property int source_id 来源id
|
||||
* @property int type 类型
|
||||
* @property string title 标题
|
||||
* @property string content 内容
|
||||
* @property int status 状态
|
||||
* @property int receiver 接受方,1=玩家, 2=总后台, 2=子站
|
||||
* @property int is_private 是否私人消息
|
||||
* @property int admin_id 管理员id
|
||||
* @property string admin_name 管理员名称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @property AdminUser adminUser 管理员
|
||||
* @property Channel channel 渠道
|
||||
* @property Player player 玩家
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Notice extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const TYPE_SYSTEM = 1; // 系统
|
||||
const TYPE_EXAMINE_RECHARGE = 2; // 充值审核
|
||||
const TYPE_EXAMINE_WITHDRAW = 3; // 提现审核
|
||||
const TYPE_PAY = 4; // 三方充值
|
||||
const TYPE_WITHDRAW = 5; // 三方提现
|
||||
|
||||
const RECEIVER_PLAYER = 1; // 玩家
|
||||
const RECEIVER_ADMIN = 2; // 总站
|
||||
const RECEIVER_DEPARTMENT = 3; // 子站
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.notice_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏类别
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function adminUser(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'admin_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::created(function (Notice $notice) {
|
||||
if ($notice->is_private == 1) {
|
||||
sendSocketMessage('player-' . $notice->player_id, [
|
||||
'msg_type' => 'player_notice_num',
|
||||
'notice_num' => Notice::query()
|
||||
->where('player_id', $notice->player_id)
|
||||
->where('receiver', Notice::RECEIVER_PLAYER)
|
||||
->where('is_private', 1)
|
||||
->where('status', 0)
|
||||
->count('*'),
|
||||
]);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
46
addons/webman/model/PhoneSmsLog.php
Normal file
46
addons/webman/model/PhoneSmsLog.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PhoneSmsLog
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property string phone 手机
|
||||
* @property string code 验证码
|
||||
* @property int type 验证码类型
|
||||
* @property string expire_time 过期时间
|
||||
* @property int status 状态
|
||||
* @property int send_times 发送次数
|
||||
* @property string uid 编码
|
||||
* @property string response 返回消息
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package app\model
|
||||
*/
|
||||
class PhoneSmsLog extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
CONST TYPE_LOGIN = 1; // 登录
|
||||
CONST TYPE_REGISTER = 2; // 注册
|
||||
CONST TYPE_CHANGE_PASSWORD = 3; // 修改密码
|
||||
CONST TYPE_CHANGE_PAY_PASSWORD = 4; // 修改支付密码
|
||||
CONST TYPE_CHANGE_PHONE = 5; // 修改手机号
|
||||
CONST TYPE_BIND_NEW_PHONE = 6; // 绑定新手机号
|
||||
CONST TYPE_TALK_BIND = 7; // QTalk绑定账号
|
||||
|
||||
CONST COUNTRY_CODE_JP = 81; // 日本
|
||||
CONST COUNTRY_CODE_TW = 886; // 中国台湾
|
||||
CONST COUNTRY_CODE_CH = 86; // 中国大陆
|
||||
CONST COUNTRY_CODE_MY = 60; // 马来西亚
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.phone_sms_log_table'));
|
||||
}
|
||||
}
|
||||
75
addons/webman/model/PlayGameRecord.php
Normal file
75
addons/webman/model/PlayGameRecord.php
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayGameRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int parent_player_id 上级玩家id
|
||||
* @property int platform_id 平台id
|
||||
* @property int game_code 游戏编号
|
||||
* @property int department_id 渠道id
|
||||
* @property int status 状态
|
||||
* @property float bet 押注
|
||||
* @property float win 输赢
|
||||
* @property float reward 奖金(不计入输赢)
|
||||
* @property string order_no 单号
|
||||
* @property string original_data 原始数据
|
||||
* @property string action_at 结算时间
|
||||
* @property string platform_action_at 结算时间(游戏平台)
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property float deficit 亏损
|
||||
*
|
||||
* @property Channel channel 渠道
|
||||
* @property Player player 玩家
|
||||
* @property GamePlatform gamePlatform 平台信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayGameRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
const STATUS_UNSETTLED = 0; // 未结算
|
||||
const STATUS_SETTLED = 1; // 已结算
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.play_game_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function gamePlatform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.game_platform_model'), 'platform_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
282
addons/webman/model/Player.php
Normal file
282
addons/webman/model/Player.php
Normal file
@@ -0,0 +1,282 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\Admin;
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use support\Cache;
|
||||
|
||||
/**
|
||||
* Class Player
|
||||
* @property int id 主键
|
||||
* @property int recommend_id 推荐id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string device_number 设备号
|
||||
* @property string facebook_id facebook id
|
||||
* @property string uuid uuid
|
||||
* @property int type 类型
|
||||
* @property int level 玩家等级
|
||||
* @property int status 状态
|
||||
* @property int status_withdraw 帐号状态 1啟用 0停用
|
||||
* @property float chip_amount 当前打码量
|
||||
* @property float must_chip_amount 达成条件
|
||||
* @property float bet_rebate_amount 当期返水打码量
|
||||
* @property float sign_reward 签到获得
|
||||
* @property string phone 手机号
|
||||
* @property string name 姓名
|
||||
* @property string country_code 手机号国家编号
|
||||
* @property string recommended_code 输入推荐吗
|
||||
* @property string recommend_code 玩家推荐码
|
||||
* @property string password 密码
|
||||
* @property string play_password 支付密码
|
||||
* @property string player_tag 玩家标签
|
||||
* @property string currency 币种
|
||||
* @property string flag 标签
|
||||
* @property string avatar 头像
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @property string last_login 最后登录时间
|
||||
*
|
||||
* @property PlayerExtend player_extend
|
||||
* @property PlayerPlatformCash wallet
|
||||
* @property Player recommend_player
|
||||
* @property PlayerLevel player_level
|
||||
* @property PlayerLoginRecord the_last_player_login_record
|
||||
* @property PlayerRegisterRecord player_register_record
|
||||
* @property Channel channel 渠道
|
||||
* @property PlayerRechargeRecord player_recharge_record 充值
|
||||
* @property PlayerWithdrawRecord player_withdraw_record 提现
|
||||
* @property PlayerGamePlatform playerGamePlatform 玩家平台账号
|
||||
* @property PlayerPromoter player_promoter 推广员
|
||||
* @property PlayerPromoter recommend_promoter 所属推广员
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Player extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
const STATUS_ENABLE = 1; // 启用状态
|
||||
const STATUS_STOP = 0; // 停用状态
|
||||
|
||||
const TYPE_PLAYER = 1; // 普通玩家
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
//简写省略id,默认后台用户表的id
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_table'));
|
||||
}
|
||||
|
||||
public function wallet(): HasOne
|
||||
{
|
||||
return $this->hasOne(plugin()->webman->config('database.player_platform_cash_model'))->where('platform_id', PlayerPlatformCash::PLATFORM_SELF);
|
||||
}
|
||||
|
||||
public function player_level(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_level_model'), 'level', 'level');
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家扩展信息
|
||||
* @return HasOne
|
||||
*/
|
||||
public function player_extend(): HasOne
|
||||
{
|
||||
return $this->hasOne(plugin()->webman->config('database.player_extend_model'), 'player_id');
|
||||
}
|
||||
|
||||
public function player_promoter(): HasOne
|
||||
{
|
||||
return $this->hasOne(PlayerPromoter::class, 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现信息
|
||||
* @return hasMany
|
||||
*/
|
||||
public function player_withdraw_record(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.player_withdraw_record_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现信息
|
||||
* @return hasMany
|
||||
*/
|
||||
public function player_recharge_record(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.player_recharge_record_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 推荐玩家
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function recommend_player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'recommend_id');
|
||||
}
|
||||
|
||||
public function the_last_player_login_record(): HasOne
|
||||
{
|
||||
return $this->hasOne(PlayerLoginRecord::class, 'player_id')->latest();
|
||||
}
|
||||
|
||||
public function player_register_record(): HasOne
|
||||
{
|
||||
return $this->hasOne(PlayerRegisterRecord::class, 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 密码哈希加密
|
||||
* @param $value
|
||||
*/
|
||||
public function setPasswordAttribute($value)
|
||||
{
|
||||
$this->attributes['password'] = password_hash($value, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付密码哈希加密
|
||||
* @param $value
|
||||
*/
|
||||
public function setPlayPasswordAttribute($value)
|
||||
{
|
||||
$this->attributes['play_password'] = password_hash($value, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取器 - 标签id
|
||||
* @param $value
|
||||
* @return false|string[]
|
||||
*/
|
||||
public function getPlayerTagAttribute($value)
|
||||
{
|
||||
return array_filter(explode(',', $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改器 - 标签id
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
public function setPlayerTagAttribute($value): string
|
||||
{
|
||||
$idsStr = json_encode($value);
|
||||
$cacheKey = md5("player_tag_options_ids_$idsStr");
|
||||
Cache::delete($cacheKey);
|
||||
|
||||
return $this->attributes['player_tag'] = implode(',', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取器 - 玩家头像
|
||||
* @param $value
|
||||
* @return false|string[]
|
||||
*/
|
||||
public function getAvatarAttribute($value)
|
||||
{
|
||||
return is_numeric($value) ? config('def_avatar.' . $value) : $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家平台账号
|
||||
* @return hasMany
|
||||
*/
|
||||
public function playerGamePlatform(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.player_game_platform_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 所属推广员
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function recommend_promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_promoter_model'), 'recommend_id', 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::updated(function (Player $player) {
|
||||
$columns = [
|
||||
'type',
|
||||
'status',
|
||||
'status_withdraw',
|
||||
'status_open_coins',
|
||||
'status_open_coins',
|
||||
'name',
|
||||
'phone',
|
||||
'country_code',
|
||||
'play_password',
|
||||
'password',
|
||||
'flag',
|
||||
'avatar',
|
||||
'player_tag',
|
||||
];
|
||||
if ($player->wasChanged($columns) && !empty(Admin::user())) {
|
||||
$orData = $player->getOriginal();
|
||||
$changeData = $player->getChanges();
|
||||
$orDataArr = [];
|
||||
$newDataArr = [];
|
||||
foreach ($changeData as $key => $item) {
|
||||
if (empty($item) == empty($orData[$key])) {
|
||||
continue;
|
||||
}
|
||||
if ($key == 'updated_at') {
|
||||
$orData[$key] = date('Y-m-d H:i:s', strtotime($orData[$key]));
|
||||
}
|
||||
$orDataArr[$key] = $orData[$key];
|
||||
$newDataArr[$key] = $item;
|
||||
}
|
||||
if (!empty($newDataArr)) {
|
||||
$playerEditLog = new PlayerEditLog();
|
||||
$playerEditLog->player_id = $player->id;
|
||||
$playerEditLog->department_id = $player->department_id;
|
||||
$playerEditLog->origin_data = json_encode($orDataArr);
|
||||
$playerEditLog->new_data = json_encode($newDataArr);
|
||||
$playerEditLog->user_id = Admin::id() ?? 0;
|
||||
$playerEditLog->user_name = !empty(Admin::user()) ? Admin::user()->username : '';
|
||||
$playerEditLog->save();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
88
addons/webman/model/PlayerBank.php
Normal file
88
addons/webman/model/PlayerBank.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class PlayerBank
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property string bank_name 开户行
|
||||
* @property string bank_code 银行代码
|
||||
* @property string account 银行卡号
|
||||
* @property string account_name 户名
|
||||
* @property string wallet_address 钱包地址
|
||||
* @property string qr_code 钱包二维码
|
||||
* @property int status 状态
|
||||
* @property int pay_type 支付渠道 1-espay,2-onepay,3-sklpay,4-usdt
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
* @property Player player 玩家信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerBank extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_bank_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型事件 - 删除前
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::deleting(function (PlayerBank $playerBank) {
|
||||
if (!empty($playerBank->qr_code)) {
|
||||
$imagePath = self::extractImagePathFromUrl($playerBank->qr_code);
|
||||
|
||||
if ($imagePath) {
|
||||
deleteToGCS($imagePath);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 从 URL 中提取图片路径
|
||||
*/
|
||||
private static function extractImagePathFromUrl($url): string
|
||||
{
|
||||
if (filter_var($url, FILTER_VALIDATE_URL)) {
|
||||
$parsedUrl = parse_url($url);
|
||||
if (isset($parsedUrl['path'])) {
|
||||
$path = $parsedUrl['path'];
|
||||
|
||||
// 移除可能的存储桶名称
|
||||
$bucketName = env('GOOGLE_CLOUD_STORAGE_BUCKET', 'yjbfile');
|
||||
$bucketPrefix = '/' . $bucketName . '/';
|
||||
|
||||
if (str_starts_with($path, $bucketPrefix)) {
|
||||
return substr($path, strlen($bucketPrefix));
|
||||
}
|
||||
|
||||
return ltrim($path, '/');
|
||||
}
|
||||
}
|
||||
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
48
addons/webman/model/PlayerBankruptcyRecord.php
Normal file
48
addons/webman/model/PlayerBankruptcyRecord.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerBankruptcyRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 渠道id
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerBankruptcyRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_bankruptcy_record_table'));
|
||||
} // 減少
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
84
addons/webman/model/PlayerChipRecord.php
Normal file
84
addons/webman/model/PlayerChipRecord.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
/**
|
||||
* Class PlayerBank
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 渠道id
|
||||
* @property int type 類型
|
||||
* @property int record_type 记录类型
|
||||
* @property float amount 金额
|
||||
* @property float chip_amount 打碼量
|
||||
* @property float before_chip_amount 調整前打碼量
|
||||
* @property float after_chip_amount 調整後打碼量
|
||||
* @property float must_chip_amount gift打碼量
|
||||
* @property float before_must_chip_amount 調整前gift打碼量
|
||||
* @property float after_must_chip_amount 調整後gift打碼量
|
||||
* @property string source_type 來源
|
||||
* @property int source_id 來源id
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerChipRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
const TYPE_INC = 1; // 增加
|
||||
const TYPE_DEC = 2; // 减少
|
||||
|
||||
const RECORD_TYPE_SIGN = 1; // 签到
|
||||
const RECORD_TYPE_RECHARGE = 2; // 充值
|
||||
const RECORD_TYPE_ACTIVITY = 3; // 活动
|
||||
const RECORD_TYPE_GAME = 4; // 游戏
|
||||
const RECORD_TYPE_COMMISSION = 5; // 分润
|
||||
const RECORD_TYPE_BANKRUPTCY = 6; // 破产
|
||||
const RECORD_TYPE_BET_REBATE = 7; // 打码返水
|
||||
const RECORD_TYPE_FIRST_RECHARGE_REWARD = 8; // 首充奖励
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_chip_record_table'));
|
||||
} // 減少
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 来源
|
||||
* @return MorphTo
|
||||
*/
|
||||
public function source(): MorphTo
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
}
|
||||
133
addons/webman/model/PlayerDeliveryRecord.php
Normal file
133
addons/webman/model/PlayerDeliveryRecord.php
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerDeliveryRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property string target 质料表
|
||||
* @property int target_id 质料id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int user_id 管理员id
|
||||
* @property int user_name 管理员名称
|
||||
* @property int type 类型
|
||||
* @property string source 来源
|
||||
* @property float amount 点数
|
||||
* @property float amount_before 異動前金額
|
||||
* @property float amount_after 異動后金額
|
||||
* @property string tradeno 单号
|
||||
* @property string remark 备注
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerDeliveryRecord extends Model
|
||||
{
|
||||
use HasFactory, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const TYPE_MODIFIED_AMOUNT_ADD = 1; // (管理后台)加点
|
||||
const TYPE_RECHARGE = 2; // 充值
|
||||
const TYPE_WITHDRAWAL = 3; // 提现
|
||||
const TYPE_MODIFIED_AMOUNT_DEDUCT = 4; // (管理后台)扣点
|
||||
const TYPE_WITHDRAWAL_BACK = 5; // 提现失败返还
|
||||
const TYPE_REGISTER_PRESENT = 6; // 注册赠送
|
||||
const TYPE_COMMISSION = 7; // 返佣
|
||||
const TYPE_SIGN = 8; // 签到
|
||||
const TYPE_GAME_OUT = 9; // 游戏转出
|
||||
const TYPE_GAME_IN = 10; // 游戏转入
|
||||
const TYPE_BET_REBATE = 11; // 打码量返水
|
||||
const TYPE_DAMAGE_REBATE = 12; // 客损返水
|
||||
const TYPE_RECHARGE_REWARD = 13; // 首充值奖励
|
||||
const TYPE_PROFIT = 14; // 推广员分润
|
||||
const TYPE_CANCELTRANSFER = 15; // 管理员取消转账
|
||||
|
||||
protected $fillable = [
|
||||
'player_id',
|
||||
'target',
|
||||
'target_id',
|
||||
'department_id',
|
||||
'type',
|
||||
'source',
|
||||
'amount',
|
||||
'amount_after',
|
||||
'amount_before',
|
||||
'amount_platform_before',
|
||||
'amount_platform_after',
|
||||
'tradeno',
|
||||
'remark',
|
||||
'operator_audit',
|
||||
'operator_withdraw',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
];
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_delivery_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 異動前金額
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountBeforeAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 異動后金額
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountAfterAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
}
|
||||
67
addons/webman/model/PlayerEditLog.php
Normal file
67
addons/webman/model/PlayerEditLog.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 玩家信息编辑日志
|
||||
* Class PlayerEditLog
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string origin_data 原数据
|
||||
* @property string new_data 新数据
|
||||
* @property int user_id 操作管理员
|
||||
* @property string user_name 管理员名
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminUser $user 管理员
|
||||
* @property Player $player 玩家
|
||||
* @property Channel $channel 部门/渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerEditLog extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_edit_log_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
186
addons/webman/model/PlayerExtend.php
Normal file
186
addons/webman/model/PlayerExtend.php
Normal file
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\Admin;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class PlayerExtends
|
||||
* @property int id 主键
|
||||
* @property int player_id 推荐id
|
||||
* @property int sex 性别
|
||||
* @property string email email
|
||||
* @property string ip ip
|
||||
* @property string qq qq账号
|
||||
* @property string telegram
|
||||
* @property string birthday 生日
|
||||
* @property string id_number 身份证
|
||||
* @property string address 地址
|
||||
* @property string wechat 微信
|
||||
* @property string whatsapp 海外微信
|
||||
* @property string facebook
|
||||
* @property string line
|
||||
* @property string remark 备注
|
||||
* @property float recharge_amount 总充值点数
|
||||
* @property float withdraw_amount 总提现点数
|
||||
* @property float commission_amount 总佣金点数
|
||||
* @property float unsettled_commission_amount 未结算佣金
|
||||
* @property float present_out_amount 总转出点数
|
||||
* @property float present_in_amount 总转入点数
|
||||
* @property float third_recharge_amount 第三方总充值点数
|
||||
* @property float third_withdraw_amount 第三方总提现点数
|
||||
* @property float coin_recharge_amount 币商充值总点数
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player $player 玩家
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerExtend extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
protected $fillable = ['remark', 'player_id', 'sex', 'email', 'ip', 'qq', 'telegram', 'birthday', 'id_number', 'address', 'wechat', 'whatsapp', 'facebook', 'line', 'remark'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_extend_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 总充值点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getRechargeAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总提现金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getWithdrawAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总提转入金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getPresentInAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 总提转出金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getPresentOutAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方总充值点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getThirdRechargeAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 第三方总提现金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getThirdWithdrawAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 币商充值总金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getCoinRechargeAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
protected static function booted()
|
||||
{
|
||||
static::updated(function (PlayerExtend $playerExtend) {
|
||||
$columns = [
|
||||
'sex',
|
||||
'email',
|
||||
'qq',
|
||||
'telegram',
|
||||
'birthday',
|
||||
'id_number',
|
||||
'address',
|
||||
'wechat',
|
||||
'whatsapp',
|
||||
'facebook',
|
||||
'line',
|
||||
'remark',
|
||||
];
|
||||
if ($playerExtend->wasChanged($columns) && !empty(Admin::user())) {
|
||||
$orData = $playerExtend->getOriginal();
|
||||
$changeData = $playerExtend->getChanges();
|
||||
$orDataArr = [];
|
||||
$newDataArr = [];
|
||||
foreach ($changeData as $key => $item) {
|
||||
if (empty($item) == empty($orData[$key])) {
|
||||
continue;
|
||||
}
|
||||
if ($key == 'updated_at') {
|
||||
$orData[$key] = date('Y-m-d H:i:s', strtotime($orData[$key]));
|
||||
}
|
||||
$orDataArr[$key] = $orData[$key];
|
||||
$newDataArr[$key] = $item;
|
||||
}
|
||||
if (!empty($newDataArr)) {
|
||||
$playerEditLog = new PlayerEditLog();
|
||||
$playerEditLog->player_id = $playerExtend->player_id;
|
||||
$playerEditLog->department_id = $playerExtend->player->department_id;
|
||||
$playerEditLog->origin_data = json_encode($orDataArr);
|
||||
$playerEditLog->new_data = json_encode($newDataArr);
|
||||
$playerEditLog->user_id = Admin::id() ?? 0;
|
||||
$playerEditLog->user_name = !empty(Admin::user()) ? Admin::user()->username : '';
|
||||
$playerEditLog->save();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
53
addons/webman/model/PlayerGamePlatform.php
Normal file
53
addons/webman/model/PlayerGamePlatform.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class PlayerGamePlatform
|
||||
* @property int id 主键
|
||||
* @property int platform_id 平台id
|
||||
* @property int player_id 游戏编号
|
||||
* @property string player_name 平台游戏类型
|
||||
* @property string player_code 游戏类型
|
||||
* @property string player_password 玩家密码
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @property Player player 玩家信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerGamePlatform extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_game_platform_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏平台
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function gamePlatform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.game_platform_model'), 'platform_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
|
||||
}
|
||||
}
|
||||
121
addons/webman/model/PlayerGameRecord.php
Normal file
121
addons/webman/model/PlayerGameRecord.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* Class PlayerGameRecord
|
||||
* @property int id 主键
|
||||
* @property int game_id 游戏id
|
||||
* @property int machine_id 机台id
|
||||
* @property int player_id 玩家id
|
||||
* @property int type 类型
|
||||
* @property float open_point 游戏上点
|
||||
* @property float wash_point 游戏下点
|
||||
* @property float open_amount 机台上分
|
||||
* @property float wash_amount 机台下分
|
||||
* @property float after_game_amount 余点数
|
||||
* @property float give_amount 开分赠点:赠送点数
|
||||
* @property string code 機台編號
|
||||
* @property string odds 比值
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Machine machine 机台
|
||||
* @property Player player 玩家
|
||||
* @property PlayerGameLog last_player_game_log 最新游戏记录
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerGameRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
CONST STATUS_START = 1; // 进行中
|
||||
CONST STATUS_END = 2; // 结束
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_game_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上分
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getOpenPointAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下分
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getWashPointAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 余点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getAfterGameAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 机台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.machine_model'), 'machine_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
if (config('app.profit', 'task') == 'event') {
|
||||
static::updated(function (PlayerGameRecord $playerGameRecord) {
|
||||
$oldStatus = $playerGameRecord->getOriginal('status'); // 原始值
|
||||
$newStatus = $playerGameRecord->status;
|
||||
// 游戏结束并且产生盈亏后计算分润
|
||||
if ($oldStatus != $newStatus && $newStatus == PlayerGameRecord::STATUS_END && $playerGameRecord->open_point != $playerGameRecord->wash_point) {
|
||||
Event::emit('promotion.playerGame', $playerGameRecord);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function last_player_game_log(): HasOne
|
||||
{
|
||||
return $this->hasOne(PlayerGameLog::class, 'game_record_id')->latest();
|
||||
}
|
||||
}
|
||||
31
addons/webman/model/PlayerLevel.php
Normal file
31
addons/webman/model/PlayerLevel.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PlayerLevel
|
||||
* @property int id 主键
|
||||
* @property int level 等级
|
||||
* @property int content 内容
|
||||
* @property float recharge_amount 充值金额
|
||||
* @property float chip_multiple 打码量倍数
|
||||
* @property float bet_rebate_amount 返水所需打码量额度
|
||||
* @property float bet_rebate_ratio 打码量返水比值
|
||||
* @property float damage_rebate_ratio 客损返水比值
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerLevel extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_level_table'));
|
||||
}
|
||||
}
|
||||
56
addons/webman/model/PlayerLoginRecord.php
Normal file
56
addons/webman/model/PlayerLoginRecord.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerLoginRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 推荐id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string login_domain 登錄域名
|
||||
* @property string ip ip
|
||||
* @property string country_name 國家名稱
|
||||
* @property string city_name 地區名稱
|
||||
* @property string remark 备注
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerLoginRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
protected $fillable = [
|
||||
'player_id',
|
||||
'login_domain',
|
||||
'ip',
|
||||
'country_name',
|
||||
'city_name',
|
||||
'remark',
|
||||
'department_id',
|
||||
];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_login_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
144
addons/webman/model/PlayerLotteryRecord.php
Normal file
144
addons/webman/model/PlayerLotteryRecord.php
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerLotteryRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property string uuid 玩家uuid
|
||||
* @property string player_phone 玩家手机号
|
||||
* @property string player_name 玩家昵称
|
||||
* @property int department_id 渠道id
|
||||
* @property int machine_id 机台id
|
||||
* @property string machine_name 机台名
|
||||
* @property string machine_code 机台code
|
||||
* @property int game_type 机台类型
|
||||
* @property string odds 比值
|
||||
* @property float amount 派彩
|
||||
* @property int is_max 是否最高
|
||||
* @property int lottery_id 彩金id
|
||||
* @property string lottery_name 彩金名
|
||||
* @property float lottery_pool_amount 彩金池金额
|
||||
* @property float lottery_rate 金额比例
|
||||
* @property int lottery_type 彩金类型
|
||||
* @property int lottery_multiple 彩金倍数
|
||||
* @property int lottery_sort 排序
|
||||
* @property float cate_rate 派彩系数
|
||||
* @property int user_id 管理员id
|
||||
* @property int user_name 管理员名称
|
||||
* @property string reject_reason 拒绝原因
|
||||
* @property int status 状态
|
||||
* @property string audit_at 审核时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
*
|
||||
* @property Player player 玩家信息
|
||||
* @property Machine machine 机台信息
|
||||
* @property Lottery lottery 彩金信息
|
||||
* @property Channel channel 渠道信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerLotteryRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const STATUS_UNREVIEWED = 0; // 未审核
|
||||
const STATUS_REJECT = 1; // 未通过
|
||||
const STATUS_PASS = 2; // 通过
|
||||
const STATUS_COMPLETE = 3; // 已完成
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_lottery_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 机台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.machine_model'), 'machine_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 彩金信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function lottery(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.lottery_model'), 'lottery_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 派彩金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额比例
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getLotteryRateAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 派彩系数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getCateRateAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 派彩系数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getLotteryPoolAmountAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
}
|
||||
88
addons/webman/model/PlayerMoneyEditLog.php
Normal file
88
addons/webman/model/PlayerMoneyEditLog.php
Normal file
@@ -0,0 +1,88 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class PlayerMoneyEditLog
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int type 类型
|
||||
* @property string action 操作
|
||||
* @property string tradeno 单号
|
||||
* @property string currency 币种
|
||||
* @property float money 金额
|
||||
* @property float origin_money 原始金额
|
||||
* @property float after_money 異動後金額
|
||||
* @property float inmoney 实际金额
|
||||
* @property float subsidy_money 辅助金额
|
||||
* @property float bet_multiple 流水倍数
|
||||
* @property float bet_num 流水
|
||||
* @property string remark 备注
|
||||
* @property int user_id 審核人員ID
|
||||
* @property string user_name 審核人員名稱
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 最后一次修改时间
|
||||
*
|
||||
* @property AdminUser $user 管理员
|
||||
* @property Player $player 玩家
|
||||
* @property Channel $channel 部门/渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerMoneyEditLog extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const TYPE_DEDUCT = 0; // 扣点
|
||||
const TYPE_INCREASE = 1; // 加点
|
||||
|
||||
const RECHARGE = 0; // 充值
|
||||
const VIP_RECHARGE = 1; // vip充值
|
||||
const OTHER = 2; // 其他
|
||||
const ACTIVITY_GIVE = 3; // 活動外贈
|
||||
const ADMIN_DEDUCT = 4; // 管理员扣点
|
||||
const ADMIN_INCREASE = 5; // 管理员加点
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_money_edit_log_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->BelongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
45
addons/webman/model/PlayerPlatformCash.php
Normal file
45
addons/webman/model/PlayerPlatformCash.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class PlayerPlatformCash
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property string player_account 玩家账户
|
||||
* @property int platform_id 平台id
|
||||
* @property string platform_name 平台名称
|
||||
* @property float money 点数
|
||||
* @property int status 遊戲平台狀態 0=鎖定 1=正常
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerPlatformCash extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
CONST PLATFORM_SELF = 1; // 实体机平台
|
||||
|
||||
protected $fillable = ['player_id', 'platform_id', 'platform_name', 'money'];
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_platform_cash_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getMoneyAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
}
|
||||
112
addons/webman/model/PlayerPromoter.php
Normal file
112
addons/webman/model/PlayerPromoter.php
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int recommend_id 推荐id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string path 层级
|
||||
* @property int status 状态
|
||||
* @property int player_num 玩家数量
|
||||
* @property int team_num 团队数量
|
||||
* @property float team_withdraw_total_amount 总提现(团队)
|
||||
* @property float team_recharge_total_amount 总充值(团队)
|
||||
* @property float total_profit_amount 总分润(个人)
|
||||
* @property float profit_amount 当前分润(个人)
|
||||
* @property float adjust_amount 当前分润调整金额
|
||||
* @property float player_profit_amount 当期直系玩家提供分润
|
||||
* @property float settlement_amount 已结算金额
|
||||
* @property float last_profit_amount 上次结算分润(个人)
|
||||
* @property float last_settlement_time 上次结算时间
|
||||
* @property float team_total_profit_amount 总分润(团队)
|
||||
* @property float team_profit_amount 当前分润(团队)
|
||||
* @property float team_settlement_amount 团队已结算金额
|
||||
* @property float ratio 分润比例
|
||||
* @property string name 姓名
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player
|
||||
* @property PlayerPromoter parent_promoter
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerPromoter extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_promoter_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 上级推广员
|
||||
* @return hasOne
|
||||
*/
|
||||
public function parent_promoter(): hasOne
|
||||
{
|
||||
return $this->hasOne(plugin()->webman->config('database.player_promoter_model'), 'player_id', 'recommend_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 下级推广员
|
||||
** @return hasMany
|
||||
*/
|
||||
public function sub_promoter()
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.player_promoter_model'), 'recommend_id', 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 下级推广员
|
||||
** @return hasMany
|
||||
*/
|
||||
public function max_sub_promoter()
|
||||
{
|
||||
return $this->hasOne(plugin()->webman->config('database.player_promoter_model'), 'recommend_id', 'player_id')
|
||||
->orderBy('ratio','desc');
|
||||
}
|
||||
|
||||
}
|
||||
174
addons/webman/model/PlayerRechargeRecord.php
Normal file
174
addons/webman/model/PlayerRechargeRecord.php
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* Class PlayerRechargeRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int setting_id 充值账号配置id
|
||||
* @property string tradeno 单号
|
||||
* @property string external_reference 商户订单号
|
||||
* @property int status 状态
|
||||
* @property int type 类型
|
||||
* @property string payment_method 支付方式
|
||||
* @property string player_name 玩家名称
|
||||
* @property float money 金额
|
||||
* @property float inmoney 实际金额
|
||||
* @property float $coins 充值点数
|
||||
* @property float gift_coins 赠送coins
|
||||
* @property float $chip_amount 打码量
|
||||
* @property string currency 币种
|
||||
* @property string player_tag 忘记标注
|
||||
* @property string remark 备注
|
||||
* @property string reject_reason 拒绝原因
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员
|
||||
* @property string notify_result 回调数据
|
||||
* @property string certificate 付款凭证
|
||||
* @property string account 银行账户
|
||||
* @property string bank_name 银行
|
||||
* @property string sub_bank 支行
|
||||
* @property string owner 户名
|
||||
* @property float rate 汇率
|
||||
* @property string finish_time 完成时间
|
||||
* @property string cancel_time 取消时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @property ChannelRechargeMethod channel_recharge_setting 充值账户
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerRechargeRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const STATUS_WAIT = 0; // 充值中
|
||||
const STATUS_RECHARGING = 1; // 待审核
|
||||
const STATUS_RECHARGED_SUCCESS = 2; // 充值成功(管理员通过)
|
||||
const STATUS_RECHARGED_FAIL = 3; // 充值失败
|
||||
const STATUS_RECHARGED_CANCEL = 4; // 充值取消(玩家取消)
|
||||
const STATUS_RECHARGED_REJECT = 5; // 拒绝(管理员拒绝)
|
||||
const STATUS_RECHARGED_SYSTEM_CANCEL = 6; // 已关闭(系统取消)
|
||||
|
||||
const TYPE_REGULAR = 1; // 普通充值
|
||||
const TYPE_ACTIVITY = 2; // 活动充值
|
||||
const TYPE_ARTIFICIAL = 4; // 人工充值
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_recharge_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值配置信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel_recharge_setting(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_recharge_setting_model'), 'setting_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取器 - 标签id
|
||||
* @param $value
|
||||
* @return false|string[]
|
||||
*/
|
||||
public function getPlayerTagAttribute($value)
|
||||
{
|
||||
return array_filter(explode(',', $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改器 - 标签id
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
public function setPlayerTagAttribute($value): string
|
||||
{
|
||||
return $this->attributes['player_tag'] = implode(',', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getMoneyAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getInmoneyAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getCoinsAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
if (config('app.profit', 'task') == 'event') {
|
||||
static::updated(function (PlayerRechargeRecord $playerRechargeRecord) {
|
||||
$oldStatus = $playerRechargeRecord->getOriginal('status'); // 原始值
|
||||
$newStatus = $playerRechargeRecord->status;
|
||||
// 游戏结束并且产生盈亏后计算分润
|
||||
if ($oldStatus != $newStatus && $newStatus == PlayerRechargeRecord::STATUS_RECHARGED_SUCCESS) {
|
||||
Event::emit('promotion.playerRecharge', $playerRechargeRecord);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
58
addons/webman/model/PlayerRegisterRecord.php
Normal file
58
addons/webman/model/PlayerRegisterRecord.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerRegisterRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string register_domain 登錄域名
|
||||
* @property string ip ip
|
||||
* @property string country_name 国家
|
||||
* @property string city_name 地区
|
||||
* @property int type 类型
|
||||
* @property string remark 备注
|
||||
* @property string device 使用設備
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerRegisterRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
CONST TYPE_ADMIN = 1; // 管理后台
|
||||
CONST TYPE_CLIENT = 2; // 客户端
|
||||
|
||||
protected $fillable = [
|
||||
'player_id',
|
||||
'register_domain',
|
||||
'ip',
|
||||
'country_name',
|
||||
'city_name',
|
||||
'type',
|
||||
'device',
|
||||
'department_id',
|
||||
];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_register_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return belongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'),'player_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
65
addons/webman/model/PlayerTag.php
Normal file
65
addons/webman/model/PlayerTag.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use support\Cache;
|
||||
|
||||
/**
|
||||
* Class Player
|
||||
* @property int id 主键
|
||||
* @property int name 标签名称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerTag extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_tag_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
static::created(function () {
|
||||
$cacheKey = "doc_player_tag_options_filter";
|
||||
$data = (new PlayerTag())->select(['name', 'id'])->get()->toArray();
|
||||
$data = $data ? array_column($data, 'name', 'id') : [];
|
||||
Cache::set($cacheKey, $data, 24 * 60 * 60);
|
||||
});
|
||||
static::deleted(function () {
|
||||
$cacheKey = "doc_player_tag_options_filter";
|
||||
$data = (new PlayerTag())->select(['name', 'id'])->get()->toArray();
|
||||
$data = $data ? array_column($data, 'name', 'id') : [];
|
||||
Cache::set($cacheKey, $data, 24 * 60 * 60);
|
||||
});
|
||||
static::updated(function () {
|
||||
$cacheKey = "doc_player_tag_options_filter";
|
||||
$data = (new PlayerTag())->select(['name', 'id'])->get()->toArray();
|
||||
$data = $data ? array_column($data, 'name', 'id') : [];
|
||||
Cache::set($cacheKey, $data, 24 * 60 * 60);
|
||||
});
|
||||
}
|
||||
}
|
||||
68
addons/webman/model/PlayerWalletTransfer.php
Normal file
68
addons/webman/model/PlayerWalletTransfer.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerWalletTransfer
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int platform_id 平台id
|
||||
* @property int department_id 渠道id
|
||||
* @property int type 类型 1转出 2转入
|
||||
* @property int amount 金额
|
||||
* @property int reward 奖金
|
||||
* @property int platform_no 平台单号
|
||||
* @property int tradeno 单号
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Channel channel 渠道
|
||||
* @property Player player 玩家
|
||||
* @property GamePlatform gamePlatform 平台信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerWalletTransfer extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
const TYPE_OUT = 1; // 转出
|
||||
const TYPE_IN = 2; // 转入
|
||||
//数据权限字段
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_wallet_transfer_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 平台信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function gamePlatform(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.game_platform_model'),'platform_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
176
addons/webman/model/PlayerWithdrawRecord.php
Normal file
176
addons/webman/model/PlayerWithdrawRecord.php
Normal file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Webman\Event\Event;
|
||||
|
||||
/**
|
||||
* Class PlayerWithdrawRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int talk_user_id 聊聊账号id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string player_tag 玩家标注
|
||||
* @property string tradeno 单号
|
||||
* @property int status 状态
|
||||
* @property int type 类型
|
||||
* @property string player_name 玩家名称
|
||||
* @property string player_phone 玩家手机号
|
||||
* @property float money 金额
|
||||
* @property float inmoney 实际金额
|
||||
* @property float coins 提出游戏点
|
||||
* @property float after_coins
|
||||
* @property float fee 手续费
|
||||
* @property string bank_name 银行名
|
||||
* @property string bank_code 银行代码
|
||||
* @property string account_name 银行账号所属人
|
||||
* @property string account 银行账号
|
||||
* @property string currency 币种
|
||||
* @property string remark 备注
|
||||
* @property string certificate 打款凭证
|
||||
* @property string reject_reason 拒绝原因
|
||||
* @property string notify_result 異步通知回傳結果
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员
|
||||
* @property string finish_time 完成时间
|
||||
* @property string cancel_time 取消时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PlayerWithdrawRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
const STATUS_WAIT = 1; // 提现中(待审核)
|
||||
const STATUS_SUCCESS = 2; // 成功
|
||||
const STATUS_FAIL = 3; // 提现失败
|
||||
const STATUS_PENDING_PAYMENT = 4; // 待打款(审核通过)
|
||||
const STATUS_PENDING_REJECT = 5; // 审核拒绝
|
||||
const STATUS_CANCEL = 6; // 玩家取消
|
||||
const STATUS_SYSTEM_CANCEL = 7; // 系统取消
|
||||
|
||||
const TYPE_USDT = 1; // usdt
|
||||
const TYPE_SELF = 2; // 渠道提现
|
||||
const TYPE_ARTIFICIAL = 3; // 人工提现
|
||||
const TYPE_ESPAYOUT = 4; // ES代付
|
||||
const TYPE_ONEPAYOUT = 5; // ONE代付
|
||||
const TYPE_SKLPAYOUT = 6; // SKL代付
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.player_withdraw_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取器 - 标签id
|
||||
* @param $value
|
||||
* @return false|string[]
|
||||
*/
|
||||
public function getPlayerTagAttribute($value)
|
||||
{
|
||||
return array_filter(explode(',', $value));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改器 - 标签id
|
||||
* @param $value
|
||||
* @return string
|
||||
*/
|
||||
public function setPlayerTagAttribute($value): string
|
||||
{
|
||||
return $this->attributes['player_tag'] = implode(',', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 实际金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getInmoneyAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 金额
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getMoneyAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 游戏点数
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getCoinsAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 手续费
|
||||
*
|
||||
* @param $value
|
||||
* @return float
|
||||
*/
|
||||
public function getFeeAttribute($value): float
|
||||
{
|
||||
return floatval($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 模型的 "booted" 方法
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function booted()
|
||||
{
|
||||
if (config('app.profit', 'task') == 'event') {
|
||||
static::updated(function (PlayerWithdrawRecord $playerWithdrawRecord) {
|
||||
$oldStatus = $playerWithdrawRecord->getOriginal('status'); // 原始值
|
||||
$newStatus = $playerWithdrawRecord->status;
|
||||
// 游戏结束并且产生盈亏后计算分润
|
||||
if ($oldStatus != $newStatus && $newStatus == PlayerWithdrawRecord::STATUS_SUCCESS) {
|
||||
Event::emit('promotion.playerWithdraw', $playerWithdrawRecord);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
47
addons/webman/model/Prize.php
Normal file
47
addons/webman/model/Prize.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class Game
|
||||
* @property int id 主键
|
||||
* @property int department_id 所属渠道id
|
||||
* @property int game_id 所属游戏id
|
||||
* @property int type 游戏类型
|
||||
* @property string pic 奖品图片
|
||||
* @property string name 奖品名称
|
||||
* @property int probability 权重
|
||||
* @property string description 奖品描述
|
||||
* @property int total_stock 总库存
|
||||
* @property int daily_stock 每日库存
|
||||
* @property int total_remaining 当前总剩余库存
|
||||
* @property int daily_remaining 当前每日剩余库存
|
||||
* @property int status 是否启用
|
||||
* @property int admin_id 管理员id
|
||||
* @property string admin_name 管理员昵称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property GamePlatform gamePlatform 游戏平台信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Prize extends Model
|
||||
{
|
||||
protected $table = 'prizes';
|
||||
public $timestamps = false;
|
||||
protected $fillable = [
|
||||
'department_id', 'game_id', 'pic', 'type',
|
||||
'name', 'total_stock', 'daily_stock',
|
||||
'total_remaining', 'daily_remaining',
|
||||
'probability', 'status', 'admin_id', 'admin_name'
|
||||
];
|
||||
|
||||
const PRIZE_TYPE_PHYSICAL = 1; // 实物
|
||||
const PRIZE_TYPE_VIRTUAL = 2; // 虚拟物品
|
||||
const PRIZE_TYPE_LOSE = 3; // 未中奖
|
||||
public static function findOrFail(int $prizeId)
|
||||
{
|
||||
}
|
||||
}
|
||||
107
addons/webman/model/PromoterProfitRecord.php
Normal file
107
addons/webman/model/PromoterProfitRecord.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 分润报表
|
||||
* Class PromoterProfitRecord
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int promoter_player_id 推广玩家id
|
||||
* @property int source_player_id 来源推广玩家id
|
||||
* @property int status 状态
|
||||
* @property float withdraw_amount 提现金额
|
||||
* @property float recharge_amount 充值金额
|
||||
* @property float bonus_amount 活动奖励金额
|
||||
* @property float admin_deduct_amount 管理员扣点
|
||||
* @property float admin_add_amount 管理员加点
|
||||
* @property float present_amount 赠送金额
|
||||
* @property float machine_up_amount 玩家上点
|
||||
* @property float machine_down_amount 玩家下点
|
||||
* @property float lottery_amount 派彩金额
|
||||
* @property float profit_amount 分润金额
|
||||
* @property float player_profit_amount 直系玩家提供分润
|
||||
* @property string settlement_tradeno 结算单号
|
||||
* @property int settlement_id 结算id
|
||||
* @property float ratio 分润比
|
||||
* @property float actual_ratio 实际分润
|
||||
* @property int model 类型 1 任务模式 2 事件模式
|
||||
* @property string date 分润日期
|
||||
* @property string settlement_time 结算时间
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家信息
|
||||
* @property Player player_promoter 推广员玩家信息
|
||||
* @property PlayerPromoter promoter 推广员信息
|
||||
* @property PlayerPromoter source_promoter 来员推广员
|
||||
* @property PromoterProfitSettlementRecord settlement 结算信息
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PromoterProfitRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
const STATUS_UNCOMPLETED = 0; // 未结算
|
||||
const STATUS_COMPLETED = 1; // 已结算
|
||||
|
||||
const MODEL_TASK = 1; // 任务模式
|
||||
const MODEL_EVENT = 2; // 事件模式
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.promoter_profit_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_promoter_model'), 'promoter_player_id', 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 来源推广员
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function source_promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_promoter_model'), 'source_player_id', 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player_promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'promoter_player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 结算信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function settlement(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.promoter_profit_settlement_record_model'), 'settlement_id');
|
||||
}
|
||||
}
|
||||
81
addons/webman/model/PromoterProfitSettlementRecord.php
Normal file
81
addons/webman/model/PromoterProfitSettlementRecord.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* 分润结算记录
|
||||
* Class PromoterProfitSettlementRecord
|
||||
* @property int id 主键
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int promoter_player_id 部门/渠道id
|
||||
* @property float total_withdraw_amount 总提现金额
|
||||
* @property float total_recharge_amount 总充值金额
|
||||
* @property float total_bonus_amount 活动奖励金额
|
||||
* @property float total_admin_deduct_amount 管理员扣点金额
|
||||
* @property float total_admin_add_amount 管理员加点金额
|
||||
* @property float total_present_amount 赠送金额
|
||||
* @property float total_machine_up_amount 机台上点
|
||||
* @property float total_machine_down_amount 机台下点
|
||||
* @property float total_lottery_amount 派彩总金额
|
||||
* @property float total_profit_amount 结算分润
|
||||
* @property float total_player_profit_amount 直系玩家提供分润
|
||||
* @property float last_profit_amount 上次结算分润
|
||||
* @property float adjust_amount 分润调整金额
|
||||
* @property float actual_amount 实际到账金额
|
||||
* @property int type 类型
|
||||
* @property float tradeno 结算单号
|
||||
* @property int user_id 管理员id
|
||||
* @property string user_name 管理员名称
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player_promoter
|
||||
* @property PlayerPromoter promoter
|
||||
* @property AdminUser user
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class PromoterProfitSettlementRecord extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
const TYPE_SETTLEMENT = 1; // 结算
|
||||
const TYPE_CLEAR = 2; // 清算
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
|
||||
$this->setTable(plugin()->webman->config('database.promoter_profit_settlement_record_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_promoter_model'), 'promoter_player_id', 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广员玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player_promoter(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'promoter_player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员用户
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.user_model'), 'user_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
57
addons/webman/model/Qrcode.php
Normal file
57
addons/webman/model/Qrcode.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property int batch_id 批次ID
|
||||
* @property string verify_code 验证码
|
||||
* @property string tag_code 标识码
|
||||
* @property int score 积分值
|
||||
* @property int scan_user_id 扫码人
|
||||
* @property string scan_nickname 扫码人昵称
|
||||
* @property int brand_id
|
||||
* @property string scan_phone 扫码人电话
|
||||
* @property string scan_time 扫码时间
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
*
|
||||
* @property Player player
|
||||
* @property Qrcode parent_promoter
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Qrcode extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
protected $fillable = ['batch_id', 'verify_code', 'tag_code', 'score', 'brand_id'];
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.qrcode_table'));
|
||||
}
|
||||
|
||||
public function qrcode_batch(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.qrcode_batch_model'), 'batch_id', 'id');
|
||||
}
|
||||
|
||||
}
|
||||
59
addons/webman/model/QrcodeBatch.php
Normal file
59
addons/webman/model/QrcodeBatch.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property string batch_code 批次码
|
||||
* @property int score 面值
|
||||
* @property int batch_count 数量
|
||||
* @property int owner_id 持码者
|
||||
* @property string creator 创建人
|
||||
* @property int brand_id
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
*
|
||||
* @property QrcodeBatch qrcode_bath
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class QrcodeBatch extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.qrcode_batch_table'));
|
||||
}
|
||||
|
||||
|
||||
public function qrcode_owner(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.qrcode_owner_model'), 'owner_id');
|
||||
}
|
||||
|
||||
public function qrcode(): HasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.qrcode_model'), 'batch_id');
|
||||
}
|
||||
|
||||
}
|
||||
58
addons/webman/model/QrcodeOwner.php
Normal file
58
addons/webman/model/QrcodeOwner.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\hasMany;
|
||||
use Illuminate\Database\Eloquent\Relations\hasManyThrough;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property string batch_code 批次码
|
||||
* @property int score 面值
|
||||
* @property int batch_count 数量
|
||||
* @property int owner_id 持码者
|
||||
* @property string creator 创建人
|
||||
* @property int brand_id
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
*
|
||||
* @property QrcodeOwner qrcode_owner
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class QrcodeOwner extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.qrcode_owner_table'));
|
||||
}
|
||||
|
||||
public function qrcode_batch(): hasMany
|
||||
{
|
||||
return $this->hasMany(plugin()->webman->config('database.qrcode_batch_model'), 'owner_id');
|
||||
}
|
||||
|
||||
public function qrcode(): hasManyThrough
|
||||
{
|
||||
return $this->hasManyThrough(plugin()->webman->config('database.qrcode_model'), plugin()->webman->config('database.qrcode_batch_model'), 'owner_id', 'batch_id');
|
||||
}
|
||||
|
||||
}
|
||||
50
addons/webman/model/SepayRecharge.php
Normal file
50
addons/webman/model/SepayRecharge.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class PlayerPromoter
|
||||
* @property int id 主键
|
||||
* @property int department_id 渠道id
|
||||
* @property string title 标题
|
||||
* @property float coins_num coins数量
|
||||
* @property float gift_coins 赠送coins
|
||||
* @property float first_coins 首充赠送coins
|
||||
* @property float money 充值金额
|
||||
* @property int admin_id 管理员id
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 修改时间
|
||||
*
|
||||
* @property Player player
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class SepayRecharge extends Model
|
||||
{
|
||||
use HasDateTimeFormatter;
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.sepay_recharge_table'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
67
addons/webman/model/SignIns.php
Normal file
67
addons/webman/model/SignIns.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use DateTimeInterface;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* Class SignIns
|
||||
* @property int id 主键
|
||||
* @property int player_id 玩家id
|
||||
* @property int department_id 渠道id
|
||||
* @property string sign_date 签到日期
|
||||
* @property float reward_amount 奖励金额
|
||||
* @property float chip_amount 打码量
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @property Player player 玩家
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class SignIns extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
//简写省略id,默认后台用户表的id
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.sign_ins_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
* 玩家信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function player(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.player_model'), 'player_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 时间转换
|
||||
* @param DateTimeInterface $date
|
||||
* @return string
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date): string
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
}
|
||||
46
addons/webman/model/Slider.php
Normal file
46
addons/webman/model/Slider.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* Class Slider
|
||||
* @property int id 主键
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property int type 类型
|
||||
* @property string name 名称
|
||||
* @property string picture_url 图片地址
|
||||
* @property int status 状态
|
||||
* @property int sort 排序
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
* @property string deleted_at 删除时间
|
||||
|
||||
* @property Channel channel 渠道
|
||||
* @package addons\webman\model
|
||||
*/
|
||||
class Slider extends Model
|
||||
{
|
||||
use SoftDeletes, HasDateTimeFormatter, DataPermissions;
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id'=>'department_id'];
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.slider_table'));
|
||||
}
|
||||
|
||||
/**
|
||||
* 渠道信息
|
||||
* @return BelongsTo
|
||||
*/
|
||||
public function channel(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(plugin()->webman->config('database.channel_model'), 'department_id', 'department_id')->withTrashed();
|
||||
}
|
||||
}
|
||||
43
addons/webman/model/SystemSetting.php
Normal file
43
addons/webman/model/SystemSetting.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
namespace addons\webman\model;
|
||||
|
||||
use addons\webman\traits\DataPermissions;
|
||||
use addons\webman\traits\HasDateTimeFormatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Class SystemSetting
|
||||
* @property int id 主键
|
||||
* @property int department_id 部门/渠道id
|
||||
* @property string feature 功能名稱
|
||||
* @property int num 数量
|
||||
* @property string content 内容
|
||||
* @property string date_start 开始时间
|
||||
* @property string date_end 结束时间
|
||||
* @property int status 状态
|
||||
* @property string created_at 创建时间
|
||||
* @property string updated_at 最后一次修改时间
|
||||
*
|
||||
* @package app\model
|
||||
*/
|
||||
class SystemSetting extends Model
|
||||
{
|
||||
use HasDateTimeFormatter, DataPermissions;
|
||||
protected $fillable = ['department_id', 'feature', 'num', 'content', 'date_start', 'date_end', 'status'];
|
||||
|
||||
//数据权限字段
|
||||
protected $dataAuth = ['department_id' => 'department_id'];
|
||||
|
||||
public function __construct(array $attributes = [])
|
||||
{
|
||||
parent::__construct($attributes);
|
||||
$this->setTable(plugin()->webman->config('database.system_setting_table'));
|
||||
}
|
||||
|
||||
const FIRST_RECHARGE_MODEL_ONE = 1; // 一次性发放
|
||||
const FIRST_RECHARGE_MODEL_ADD = 2; // 累计发放
|
||||
|
||||
const FIRST_RECHARGE_TYPE_VALUE = 1; // 固定值
|
||||
const FIRST_RECHARGE_TYPE_PERCENT = 2; // 百分比
|
||||
}
|
||||
Reference in New Issue
Block a user