存客宝应用接口初始化

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,52 @@
<?php
namespace app\chukebao\model;
use think\Model;
/**
* AI知识库模型
*/
class AiKnowledgeBase extends Model
{
// 设置表名
protected $name = 'ai_knowledge_base';
// 设置主键
protected $pk = 'id';
// 设置JSON字段
protected $json = ['label'];
// 设置JSON字段自动转换为数组
protected $jsonAssoc = true;
/**
* 关联知识库类型
*/
public function type()
{
return $this->belongsTo(AiKnowledgeBaseType::class, 'typeId', 'id');
}
/**
* 获取有效的知识库列表(未删除)
*/
public static function getValidList($companyId, $typeId = null)
{
$where = [
['isDel', '=', 0],
['companyId', '=', $companyId]
];
if ($typeId !== null) {
$where[] = ['typeId', '=', $typeId];
}
return self::where($where)
->with(['type'])
->order('createTime', 'desc')
->select();
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace app\chukebao\model;
use think\Model;
/**
* AI知识库类型模型
*/
class AiKnowledgeBaseType extends Model
{
// 设置表名
protected $name = 'ai_knowledge_base_type';
// 设置主键
protected $pk = 'id';
// 设置JSON字段
protected $json = ['label'];
// 设置JSON字段自动转换为数组
protected $jsonAssoc = true;
// 类型常量
const TYPE_SYSTEM = 0; // 系统类型
const TYPE_USER = 1; // 用户创建类型
/**
* 获取有效的类型列表(未删除)
*/
public static function getValidList($companyId, $includeSystem = true)
{
$where = [
['isDel', '=', 0]
];
if ($includeSystem) {
$where[] = ['type|companyId', 'in', [0, $companyId]];
} else {
$where[] = ['companyId', '=', $companyId];
$where[] = ['type', '=', self::TYPE_USER];
}
return self::where($where)
->order('createTime', 'desc')
->select();
}
/**
* 检查是否为系统类型
*/
public function isSystemType()
{
return $this->type == self::TYPE_SYSTEM;
}
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class AiPush extends Model
{
protected $pk = 'id';
protected $name = 'kf_ai_push';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace app\chukebao\model;
use think\Model;
class AiPushRecord extends Model
{
protected $pk = 'id';
protected $name = 'kf_ai_push_record';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class AiSettings extends Model
{
protected $pk = 'id';
protected $name = 'ai_settings';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class AutoGreetings extends Model
{
protected $pk = 'id';
protected $name = 'kf_auto_greetings';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace app\chukebao\model;
use think\Model;
class ChatGroups extends Model
{
protected $pk = 'id';
protected $name = 'chat_groups';
// 不开启自动时间戳,手动维护 createTime / deleteTime
protected $autoWriteTimestamp = false;
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class FollowUp extends Model
{
protected $pk = 'id';
protected $name = 'kf_follow_up';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class FriendSettings extends Model
{
protected $pk = 'id';
protected $name = 'kf_friend_settings';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class Keywords extends Model
{
protected $pk = 'id';
protected $name = 'kf_keywords';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,11 @@
<?php
namespace app\chukebao\model;
use think\Model;
class KfMoments extends Model
{
protected $table = 'ck_kf_moments';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class Material extends Model
{
protected $pk = 'id';
protected $name = 'kf_material';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace app\chukebao\model;
use think\Model;
class NoticeModel extends Model
{
protected $pk = 'id';
protected $name = 'kf_notice';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class Questions extends Model
{
protected $pk = 'id';
protected $name = 'kf_questions';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class Reply extends Model
{
protected $pk = 'id';
protected $name = 'kf_reply';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'lastUpdateTime';
}

View File

@@ -0,0 +1,10 @@
<?php
namespace app\chukebao\model;
use think\Model;
class ReplyGroup extends Model
{
protected $pk = 'id';
protected $name = 'kf_reply_group';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class SensitiveWord extends Model
{
protected $pk = 'id';
protected $name = 'kf_sensitive_word';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,17 @@
<?php
namespace app\chukebao\model;
use think\Model;
class ToDo extends Model
{
protected $pk = 'id';
protected $name = 'kf_to_do';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
protected $updateTime = 'updateTime';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace app\chukebao\model;
use think\Model;
class TokensCompany extends Model
{
protected $pk = 'id';
protected $name = 'tokens_company';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
}

View File

@@ -0,0 +1,16 @@
<?php
namespace app\chukebao\model;
use think\Model;
class TokensRecord extends Model
{
protected $pk = 'id';
protected $name = 'tokens_record';
// 自动写入时间戳
protected $autoWriteTimestamp = true;
protected $createTime = 'createTime';
}