存客宝应用接口初始化

This commit is contained in:
Ghost
2026-01-05 10:25:32 +08:00
parent fa37227954
commit 02797ba50a
414 changed files with 85530 additions and 75 deletions

View File

@@ -0,0 +1,31 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 超级管理员模型类
*/
class Administrator extends Model
{
use SoftDelete;
const MASTER_ID = 1;
// 设置数据表名
protected $name = 'administrators';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
// 隐藏字段
protected $hidden = [
'password'
];
}

View File

@@ -0,0 +1,23 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 超级管理员权限配置模型类
*/
class AdministratorPermissions extends Model
{
use SoftDelete;
// 设置数据表名
protected $name = 'administrator_permissions';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,23 @@
<?php
namespace app\common\model;
use think\Model;
class Attachment extends Model
{
// 设置表名
protected $name = 'attachments';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $defaultSoftDelete = 0;
public static function addAttachment($attachmentData)
{
return self::create($attachmentData);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 项目模型
*/
class Company extends Model
{
use SoftDelete;
// 设置数据表名
protected $name = 'company';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,24 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 设备模型类
*/
class Device extends Model
{
use SoftDelete;
// 设置表名
protected $name = 'device';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,34 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 设备操作日志模型类
*/
class DeviceHandleLog extends Model
{
// 设置表名
protected $name = 'device_handle_log';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
/**
* 添加设备操作日志
*
* @param array $data 日志数据
* @return int 新增日志ID
*/
public static function addLog(array $data): int
{
$log = new self();
$log->allowField(true)->save($data);
return $log->id;
}
}

View File

@@ -0,0 +1,24 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 设备任务配置模型类
*/
class DeviceTaskconf extends Model
{
use SoftDelete;
// 设置表名
protected $name = 'device_taskconf';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,28 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 设备用户关联模型
* 用于管理设备与操盘手(用户)的关联关系
*/
class DeviceUser extends Model
{
use SoftDelete;
/**
* 数据表名
* @var string
*/
protected $name = 'device_user';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,37 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信好友模型类
*/
class DeviceWechatLogin extends Model
{
const ALIVE_WECHAT_ACTIVE = 1; // 微信在线
const ALIVE_WECHAT_DIED = 0; // 微信离线
// 登录日志最新登录 alive = 1旧数据全部设置0
protected $name = 'device_wechat_login';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
/**
* 获取设备最新登录记录的id
*
* @param array $deviceIds
* @return array
*/
public static function getDevicesLatestLogin(array $deviceIds): array
{
return static::fieldRaw('max(id) as lastedId,deviceId')
->whereIn('deviceId', $deviceIds)
->group('deviceId')
->select()
->toArray();
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 菜单模型类
*/
class Menu extends Model
{
const STATUS_ACTIVE = 1;
const TOP_LEVEL = 0;
// 设置数据表名
protected $name = 'menus';
}

View File

@@ -0,0 +1,14 @@
<?php
namespace app\common\model;
use think\Model;
class Order extends Model
{
// 设置数据表名
protected $name = 'order';
}

View File

@@ -0,0 +1,26 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 获客场景模型类
*/
class PlanScene extends Model
{
use SoftDelete;
const STATUS_ACTIVE = 1; // 活动状态
// 设置表名
protected $name = 'plan_scene';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,19 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 流量池模型类
*/
class TrafficPool extends Model
{
// 设置数据表名
protected $name = 'traffic_pool';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,27 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 流量池模型类
*/
class TrafficSource extends Model
{
const STATUS_PENDING = 1; // 待处理
const STATUS_WORKING = 2; // 处理中
const STATUS_PASSED = 3; // 已通过
const STATUS_REFUSED = 4; // 已拒绝
const STATUS_EXPIRED = 5; // 已过期
const STATUS_CANCELED = 6; // 已取消
// 设置数据表名
protected $name = 'traffic_source';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 流量池模型类
*/
class TrafficSourcePackage extends Model
{
// 设置数据表名
protected $name = 'traffic_source_package';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 流量池模型类
*/
class TrafficSourcePackageItem extends Model
{
// 设置数据表名
protected $name = 'traffic_source_package_item';
}

View File

@@ -0,0 +1,38 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
class User extends Model
{
use SoftDelete;
const ADMIN_STP = 1; // 操盘手账号
const ADMIN_OTP = 0;
const NOT_USER = -1; // 非登录用户用于任务操作的S2系统专属
const MASTER_USER = 1; // 操盘手
const CUSTOMER_USER = 2; // 门店接待
const STATUS_STOP = 0; // 禁用状态
const STATUS_ACTIVE = 1; // 活动状态
/**
* 数据表名
* @var string
*/
protected $name = 'users';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
/**
* 隐藏属性
* @var array
*/
protected $hidden = ['passwordMd5', 'deleteTime'];
}

View File

@@ -0,0 +1,19 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信账号模型类
*/
class WechatAccount extends Model
{
// 设置表名
protected $name = 'wechat_account';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,44 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信账号评分记录模型类
*/
class WechatAccountScore extends Model
{
// 设置表名
protected $name = 'wechat_account_score';
protected $table = 's2_wechat_account_score';
// 自动写入时间戳
protected $autoWriteTimestamp = false;
// 定义字段类型
protected $type = [
'accountId' => 'integer',
'baseScore' => 'integer',
'baseScoreCalculated' => 'integer',
'baseInfoScore' => 'integer',
'friendCountScore' => 'integer',
'friendCount' => 'integer',
'dynamicScore' => 'integer',
'frequentCount' => 'integer',
'frequentPenalty' => 'integer',
'consecutiveNoFrequentDays' => 'integer',
'noFrequentBonus' => 'integer',
'banPenalty' => 'integer',
'healthScore' => 'integer',
'maxAddFriendPerDay' => 'integer',
'isModifiedAlias' => 'integer',
'isBanned' => 'integer',
'lastFrequentTime' => 'integer',
'lastNoFrequentTime' => 'integer',
'baseScoreCalcTime' => 'integer',
'createTime' => 'integer',
'updateTime' => 'integer',
];
}

View File

@@ -0,0 +1,21 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信客服信息模型类
*/
class WechatCustomer extends Model
{
// 设置表名
protected $name = 'wechat_customer';
// 自动进行 json_encode/json_decode
protected $json = ['basic', 'weight', 'activity', 'friendShip'];
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,24 @@
<?php
namespace app\common\model;
use think\Model;
use think\model\concern\SoftDelete;
/**
* 微信好友模型类
*/
class WechatFriendShip extends Model
{
use SoftDelete;
// 设置表名
protected $name = 'wechat_friendship';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $deleteTime = 'deleteTime';
protected $defaultSoftDelete = 0;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信风险受限记录
*/
class WechatRestricts extends Model
{
const LEVEL_WARNING = 2;
const LEVEL_ERROR = 3;
// 设置数据表名
protected $name = 'wechat_restricts';
}

View File

@@ -0,0 +1,20 @@
<?php
namespace app\common\model;
use think\Model;
/**
* 微信好友模型类
*/
class WechatTag extends Model
{
// 设置表名
protected $name = 'ck_wechat_tag';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
protected $defaultSoftDelete = 0;
}