初始化代码

This commit is contained in:
2025-12-22 14:32:54 +08:00
parent e27ab90d9f
commit d02b31a8b9
1459 changed files with 240973 additions and 0 deletions

42
app/im/info/Info.php Normal file
View File

@@ -0,0 +1,42 @@
<?php
// +----------------------------------------------------------------------
// | Longbing [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright Chengdu longbing Technology Co., Ltd.
// +----------------------------------------------------------------------
// | Website http://longbing.org/
// +----------------------------------------------------------------------
// | Sales manager: +86-13558882532 / +86-13330887474
// | Technical support: +86-15680635005
// | After-sale service: +86-17361005938
// +----------------------------------------------------------------------
declare(strict_types=1);
return [
//模块名称[必填]
'name' => 'im',
//模块标题[必填]
'title' =>'即时通讯',
//内容简介
'desc' =>'',
//封面图标
'icon' =>'',
//模块类型[必填] model:模块 可以出现在左侧一级 app:应用中心 , 是一个应用中心的应用
'type' => 'model',
// 模块唯一标识[必填],格式:模块名.开发者标识.module
'identifier' => 'im.longbing.module',
// 版本[必填],格式采用三段式:主版本号.次版本号.修订版本号
'version' => '1.0.2',
// 模块依赖[可选],格式[[模块名, 模块唯一标识, 依赖版本, 对比方式]]
'need_module' => [
['admin', 'admin.longbing.module', '1.0.0']
],
// 应用依赖[可选],格式[[插件名, 应用唯一标识, 依赖版本, 对比方式]]
'need_app' => [],
//订阅消息
'tmpl_name'=>['im_msg']
];

View File

@@ -0,0 +1,71 @@
<?php
// +----------------------------------------------------------------------
// | Longbing [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright Chengdu longbing Technology Co., Ltd.
// +----------------------------------------------------------------------
// | Website http://longbing.org/
// +----------------------------------------------------------------------
// | Sales manager: +86-13558882532 / +86-13330887474
// | Technical support: +86-15680635005
// | After-sale service: +86-17361005938
// +----------------------------------------------------------------------
declare(strict_types=1);
namespace app\im\info;
use longbingcore\permissions\PermissionAbstract;
/**
* 模块功能权限
* Class PermissionSendmsg
*/
class PermissionIm extends PermissionAbstract {
const tabbarKey = null;
//后台管理菜单对应key[必填] , 当前模块文件夹名称
const adminMenuKey = 'im';
public $saasKey ;
const apiPaths = [];
public function __construct(int $uniacid,$infoConfigOptions = [])
{
parent::__construct($uniacid, self::tabbarKey, self::adminMenuKey, $this->saasKey, self::apiPaths , $infoConfigOptions);
}
/**
* 返回saas端授权结果
* @return bool
*/
public function sAuth(): bool
{
return true ;
}
/**
* 返回p端授权结果
* @return bool
*/
public function pAuth(): bool
{
return true;
}
/**
* 返回c端授权结果
*
* @param int $user_id
* @return bool
* @author ArtizanZhang
* @DataTime: 2019/12/9 17:13
*/
public function cAuth(int $user_id): bool
{
return true;
}
}

82
app/im/info/Subscribe.php Normal file
View File

@@ -0,0 +1,82 @@
<?php
// +----------------------------------------------------------------------
// | Longbing [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright Chengdu longbing Technology Co., Ltd.
// +----------------------------------------------------------------------
// | Website http://longbing.org/
// +----------------------------------------------------------------------
// | Sales manager: +86-13558882532 / +86-13330887474
// | Technical support: +86-15680635005
// | After-sale service: +86-17361005938
// +----------------------------------------------------------------------
declare(strict_types=1);
namespace app\im\info;
use app\card\model\CardCount;
use app\radar\model\RadarMessage;
use app\radar\model\RadarOrder;
use longbingcore\diy\BaseSubscribe;
/**
* @author shuixian
* @DataTime: 2019/12/11 16:23
* Class Subscribe
* @package app\ucenter\info
*/
class Subscribe extends BaseSubscribe
{
/**
* 相应个人中心工具菜单
*
* @return mixed
* @author shuixian
* @DataTime: 2019/12/12 11:24
*/
public function onAddWorkStaffCenterMenu(){
$toolsMenu= [
"title" => '话术库管理',
"icon" => 'iconhuashuku',
"link" => '/admin/pages/speech/index',
"linkType"=> '4',
];
return [$toolsMenu];
}
/**
* 员工 客户获取列表查询
*
* @param $data
* @return array
* @author shuixian
* @DataTime: 2019/12/26 10:30
*/
public function onStaffCustomerList($data)
{
// 聊天数量
$map1 = [ [ 'user_id', '=', $data[ 'uid' ] ], [ 'target_id', '=', $data['to_uid'] ] ];
$map2 = [ [ 'target_id', '=', $data[ 'uid' ] ], [ 'user_id', '=', $data['to_uid'] ] ];
$messageCount = RadarMessage::whereOr( [ $map1, $map2 ] )->count();
$msgData[ 'count' ] = $messageCount;
$msgData[ 'title' ] = "聊天";
// 通话数量
$phoneCount = CardCount::where( [ [ 'user_id', '=', $data[ 'uid' ] ], [ 'to_uid', '=', $data['to_uid'] ],
[ 'sign', '=', 'copy' ], [ 'type', 'in', [ 2, 3, 11 ] ] ]
)->count();
$phoneData[ 'count' ] = $phoneCount;
$phoneData[ 'title' ] = "通话";
return [$msgData , $phoneData];
}
}

30
app/im/info/UpdateSql.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
//获取表前缀
$prefix = longbing_get_prefix();
//每个一个sql语句结束都必须以英文分号结束。因为在执行sql时需要分割单个脚本执行。
//表前缀需要自己添加{$prefix} 以下脚本被测试脚本
$sql = <<<updateSql
CREATE TABLE IF NOT EXISTS `{$prefix}longbing_card_message_friend` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(10) NOT NULL COMMENT '发送消息用户id',
`friend_id` int(10) NOT NULL COMMENT '接收消息用户id',
`message_type` varchar(50) NOT NULL DEFAULT 'text',
`lastmessage` text COMMENT '消息内容',
`not_read_message_count` int(11) NOT NULL DEFAULT '0' COMMENT '未读消息数量',
`uniacid` int(10) NOT NULL,
`create_time` int(11) NOT NULL DEFAULT '0',
`update_time` int(11) NOT NULL DEFAULT '0',
`is_read` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `chat_id` (`user_id`,`friend_id`,`create_time`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=175 DEFAULT CHARSET=utf8mb4 COMMENT='名片--聊天记录表';
ALTER TABLE `{$prefix}longbing_card_message_friend` ADD COLUMN `is_read` tinyint(1) NOT NULL DEFAULT 0;
updateSql;
return $sql;