评论消息title报错

This commit is contained in:
taoser 2023-03-16 22:33:28 +08:00
parent d6d512f54e
commit 9c83c4d0cd
19 changed files with 112 additions and 72 deletions

View File

@ -258,7 +258,7 @@ abstract class BaseController
} else {
$artUrl = (string) url('article_detail', ['id' => $aid]);
}
//halt($indexUrl,$artUrl);
//多应用时,文章所属应用 2022.11.17
$app = app('http')->getName();
if(empty($appname)) {
@ -268,9 +268,9 @@ abstract class BaseController
}
// 判断index应用是否绑定域名
$bind_index = array_search($appname,config('app.domain_bind'));
$bind_index = array_search($appname, config('app.domain_bind'));
// 判断index应用是否域名映射
$map_index = array_search($appname,config('app.app_map'));
$map_index = array_search($appname, config('app.app_map'));
// article 所属应用名
$index = $map_index ?: $appname; // index应用名
@ -293,7 +293,7 @@ abstract class BaseController
if($bind_index) {
// echo 111;
// index或home前端(非admin应用)域名进行了绑定
// url = $indexUrl . str_replace($admin . '/','',$artUrl);
// $url = $indexUrl . str_replace($admin . '/','',$artUrl);
$url = $indexUrl . $artUrl;
} else {
if($bind_admin) {
@ -304,11 +304,11 @@ abstract class BaseController
// echo 333;
// var_dump($admin, $appname, $artUrl);
// admin进行了映射
$url = $indexUrl . str_replace($admin, $appname, $artUrl);
$url = $indexUrl . str_replace($admin, $index, $artUrl);
} else {
// echo 444;
// admin未绑定域名
$url = $indexUrl . str_replace($app, $appname, $artUrl);
$url = $indexUrl . str_replace($app, $index, $artUrl);
}
}

View File

@ -27,7 +27,7 @@ class AuthGroup extends AdminController
if(Request::isAjax()){
$data = Request::only(['id']);
$map = array_filter($data);
$role = Db::name('auth_group')->field('id,title,limits,descr,status')->where('status',1)->where($map)->select();
$role = Db::name('auth_group')->field('id,title,limits,descr,status')->where($map)->select();
$count = $role->count();
$res = [];
if($count){

View File

@ -42,12 +42,16 @@ class User extends AdminController
//
if(Request::isAjax()){
$data = Request::param();
$result = Db::name('user')->save($data);
if($result){
$res = ['code'=>0,'msg'=>'添加成功'];
}else{
$res = ['code'=>-1,'msg'=>'添加失败'];
}
$data['create_time'] = time();
$salt = substr(md5($data['create_time']),-6);
// 默认手机号为密码
$data['password'] = md5(substr_replace(md5($data['phone']),$salt,0,6));
try {
Db::name('user')->save($data);
$res = ['code'=>0,'msg'=>'添加成功'];
} catch (\Exception $e) {
$res = ['code'=>-1, 'msg'=>$e->getMessage()];
}
return json($res);
}
@ -59,6 +63,10 @@ class User extends AdminController
{
if(Request::isAjax()){
$data = Request::param();
$user = Db::name('user')->field('create_time')->find($data['id']);
$salt = substr(md5($user['create_time']),-6);
// 默认手机号为密码
$data['password'] = md5(substr_replace(md5($data['phone']),$salt,0,6));
$result = Db::name('user')->update($data);
if($result){
$res = ['code'=>0,'msg'=>'编辑成功'];

View File

@ -26,18 +26,18 @@
<div class="layui-input-block">
<input type="text" name="ename" lay-verify="required" placeholder="英文名*" autocomplete="off" class="layui-input">
</div>
<label class="layui-form-label">详情页模板</label>
<div class="layui-input-block">
<select name="detpl" id="tpl" lay-verify="required">
{volist name="template" id="vo"}
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
{/volist}
</select>
</div>
<label class="layui-form-label">图标</label>
<div class="layui-input-block">
<input type="text" name="icon" placeholder="图标*" id="iconPicker" lay-filter="iconPicker" style="display:none;" class="layui-input">
</div>
<label class="layui-form-label">详情页模板</label>
<div class="layui-input-block">
<select name="detpl" id="tpl" lay-verify="required">
{volist name="template" id="vo"}
<option value="{$vo}" {if($vo == $cate.detpl)} selected {/if} >{$vo}</option>
{/volist}
</select>
</div>
<label class="layui-form-label">描述</label>
<div class="layui-input-block">
<input type="text" name="desc" lay-verify="required" placeholder="描述*" autocomplete="off" class="layui-input">

View File

@ -55,7 +55,7 @@
//上传头像
upload.render({
elem: '#layuiadmin-upload-useradmin'
,url: 'uploadImg'
,url: "{:url('user/uploadImg')}"
,data: {type:'image'}
,accept: 'images'
,method: 'get'

View File

@ -52,7 +52,7 @@
//上传头像
upload.render({
elem: '#layuiadmin-upload-useradmin'
,url: 'uploadImg'
,url: "{:url('user/uploadImg')}"
,data: {type:'image'}
,accept: 'images'
,method: 'get'

View File

@ -40,7 +40,7 @@ class Arts
* @param string $appname 所属应用名
* @return string
*/
public function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
protected function getRouteUrl(int $aid, string $ename = '', string $appname = '') : string
{
$indexUrl = $this->getIndexUrl();
if(config('taoler.url_rewrite.article_as') == '<ename>/'){
@ -50,7 +50,7 @@ class Arts
} else {
$artUrl = (string) url('article_detail', ['id' => $aid]);
}
//halt($indexUrl,$artUrl);
//多应用时,文章所属应用 2022.11.17
$app = app('http')->getName();
if(empty($appname)) {
@ -60,9 +60,9 @@ class Arts
}
// 判断index应用是否绑定域名
$bind_index = array_search($appname,config('app.domain_bind'));
$bind_index = array_search($appname, config('app.domain_bind'));
// 判断index应用是否域名映射
$map_index = array_search($appname,config('app.app_map'));
$map_index = array_search($appname, config('app.app_map'));
// article 所属应用名
$index = $map_index ?: $appname; // index应用名
@ -83,24 +83,28 @@ class Arts
$admin = $map_admin ?: 'admin'; // admin应用名
if($bind_index) {
// echo 111;
// index或home前端(非admin应用)域名进行了绑定
// url = $indexUrl . str_replace($admin . '/','',$artUrl);
// $url = $indexUrl . str_replace($admin . '/','',$artUrl);
$url = $indexUrl . $artUrl;
} else {
if($bind_admin) {
// echo 222;
// admin绑定域名
$url = $indexUrl .'/' . $index . $artUrl;
} elseif ($app == 'admin' && isset($map_admin)) {
// echo 333;
// var_dump($admin, $appname, $artUrl);
// admin进行了映射
$url = $indexUrl . str_replace($admin, $appname, $artUrl);
$url = $indexUrl . str_replace($admin, $index, $artUrl);
} else {
// echo 444;
// admin未绑定域名
$url = $indexUrl . str_replace($app, $appname, $artUrl);
$url = $indexUrl . str_replace($app, $index, $artUrl);
}
}
//halt($url);
return $url;
}

View File

@ -220,9 +220,9 @@ class Article extends BaseController
} else {
$receveId = $article['user_id'];
}
$data = ['title'=>$title,'content'=>'评论通知','link'=>$link,'user_id'=>$sendId,'type'=>2]; //type=2为评论留言
Message::sendMsg($sendId,$receveId,$data);
if(Config::get('taoler.config.email_notice')) hook('mailtohook',[$this->showUser(1)['email'],'评论审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚对 <b>'.$title.'</b> 发表了评论,请尽快处理。']);
$data = ['title' => $article['title'], 'content' => '评论通知', 'link' => $link, 'user_id' => $sendId, 'type' => 2]; //type=2为评论留言
Message::sendMsg($sendId, $receveId, $data);
if(Config::get('taoler.config.email_notice')) hook('mailtohook',[$this->showUser(1)['email'],'评论审核通知','Hi亲爱的管理员:</br>用户'.$this->showUser($this->uid)['name'].'刚刚对 <b>' . $article['title'] . '</b> 发表了评论,请尽快处理。']);
$res = ['code'=>0, 'msg'=>$msg];
} else {
$res = ['code'=>-1, 'msg'=>'留言失败'];

View File

@ -479,13 +479,13 @@ INSERT INTO `tao_slider` VALUES ('2', '通用右栏底部广告', '2', '/storage
-- ----------------------------
DROP TABLE IF EXISTS `tao_station`;
CREATE TABLE `tao_station` (
`id` int NOT NULL AUTO_INCREMENT,
`city_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`city_ename` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`master` tinyint(1) NOT NULL DEFAULT 0,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `ename`(`city_ename` ASC) USING BTREE COMMENT 'ename索引'
`id` int NOT NULL AUTO_INCREMENT,
`city_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`city_ename` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`master` tinyint(1) NOT NULL DEFAULT 0,
`create_time` datetime NOT NULL,
PRIMARY KEY (`id`) USING BTREE,
INDEX `ename`(`city_ename` ASC) USING BTREE COMMENT 'ename索引'
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;
-- ----------------------------

14
composer.lock generated
View File

@ -3272,16 +3272,16 @@
},
{
"name": "workerman/phpsocket.io",
"version": "v1.1.14",
"version": "v1.1.16",
"source": {
"type": "git",
"url": "https://github.com/walkor/phpsocket.io.git",
"reference": "a5758da4d55b4744a4cc9c956816d88ce385601e"
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/a5758da4d55b4744a4cc9c956816d88ce385601e",
"reference": "a5758da4d55b4744a4cc9c956816d88ce385601e",
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"shasum": "",
"mirrors": [
{
@ -3292,7 +3292,7 @@
},
"require": {
"workerman/channel": ">=1.0.0",
"workerman/workerman": ">=3.5.16"
"workerman/workerman": ">=4.0.0"
},
"type": "library",
"autoload": {
@ -3310,7 +3310,7 @@
],
"support": {
"issues": "https://github.com/walkor/phpsocket.io/issues",
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.14"
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.16"
},
"funding": [
{
@ -3322,7 +3322,7 @@
"type": "patreon"
}
],
"time": "2022-02-24T03:33:45+00:00"
"time": "2022-11-25T13:00:18+00:00"
},
{
"name": "workerman/workerman",

View File

@ -46,8 +46,8 @@ class Message
/**
* 接收消息
* @param $uid 接收消息用户ID
* @return \think\Collection
* @param $uid 接收消息用户ID
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException

View File

@ -3288,24 +3288,30 @@
},
{
"name": "workerman/phpsocket.io",
"version": "v1.1.14",
"version_normalized": "1.1.14.0",
"version": "v1.1.16",
"version_normalized": "1.1.16.0",
"source": {
"type": "git",
"url": "https://github.com/walkor/phpsocket.io.git",
"reference": "a5758da4d55b4744a4cc9c956816d88ce385601e"
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/a5758da4d55b4744a4cc9c956816d88ce385601e",
"reference": "a5758da4d55b4744a4cc9c956816d88ce385601e",
"shasum": ""
"url": "https://api.github.com/repos/walkor/phpsocket.io/zipball/f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"reference": "f4dc14e69e9d0d8ce69c6180f93b76b7743f2304",
"shasum": "",
"mirrors": [
{
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
"preferred": true
}
]
},
"require": {
"workerman/channel": ">=1.0.0",
"workerman/workerman": ">=3.5.16"
"workerman/workerman": ">=4.0.0"
},
"time": "2022-02-24T03:33:45+00:00",
"time": "2022-11-25T13:00:18+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
@ -3323,7 +3329,7 @@
],
"support": {
"issues": "https://github.com/walkor/phpsocket.io/issues",
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.14"
"source": "https://github.com/walkor/phpsocket.io/tree/v1.1.16"
},
"funding": [
{

View File

@ -3,7 +3,7 @@
'name' => 'taoser/taoler',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '70c9f4a1c46ca50786773a38e86e10cf67fc15aa',
'reference' => 'e3f1590beb50ab5826fd410fd37264870b5967f4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -358,7 +358,7 @@
'taoser/taoler' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
'reference' => '70c9f4a1c46ca50786773a38e86e10cf67fc15aa',
'reference' => 'e3f1590beb50ab5826fd410fd37264870b5967f4',
'type' => 'project',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@ -509,9 +509,9 @@
'dev_requirement' => false,
),
'workerman/phpsocket.io' => array(
'pretty_version' => 'v1.1.14',
'version' => '1.1.14.0',
'reference' => 'a5758da4d55b4744a4cc9c956816d88ce385601e',
'pretty_version' => 'v1.1.16',
'version' => '1.1.16.0',
'reference' => 'f4dc14e69e9d0d8ce69c6180f93b76b7743f2304',
'type' => 'library',
'install_path' => __DIR__ . '/../workerman/phpsocket.io',
'aliases' => array(),

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php
// This file is automatically generated at:2022-11-23 14:02:06
// This file is automatically generated at:2022-12-03 13:32:51
declare (strict_types = 1);
return array (
0 => 'taoser\\addons\\Service',

View File

@ -2,9 +2,9 @@
A server side alternative implementation of [socket.io](https://github.com/socketio/socket.io) in PHP based on [Workerman](https://github.com/walkor/Workerman).<br>
# Notice
Only support socket.io v1.3.0 or greater. <br>
Only support socket.io >= v1.3.0 and <= v2.x <br>
This project is just translate socket.io by [workerman](https://github.com/walkor/Workerman).<br>
More api just see http://socket.io/docs/server-api/
More api just see [https://socket.io/docs/v2/server-api/](https://socket.io/docs/v2/server-api/)
# Install
composer require workerman/phpsocket.io
@ -138,6 +138,28 @@ $io->on('connection', function ($connection) use ($io) {
Worker::runAll();
```
## Acknowledgement callback
```php
use Workerman\Worker;
use PHPSocketIO\SocketIO;
require_once __DIR__ . '/vendor/autoload.php';
$io = new SocketIO(2021);
$io->on('connection', function ($connection) use ($io) {
$socket->on('message with ack', function ($data, $callback) use ($socket, $io) {
// acknowledgement callback
if ($callback && is_callable($callback)) {
$callback(0);
}
});
});
Worker::runAll();
```
# 手册
[中文手册](https://github.com/walkor/phpsocket.io/tree/master/docs/zh)

View File

@ -5,7 +5,7 @@
"homepage": "http://www.workerman.net",
"license" : "MIT",
"require": {
"workerman/workerman" : ">=3.5.16",
"workerman/workerman" : ">=4.0.0",
"workerman/channel" : ">=1.0.0"
},
"autoload": {

View File

@ -1,7 +1,7 @@
<?php
namespace PHPSocketIO\Engine;
use \PHPSocketIO\Event\Emitter;
use \Workerman\Lib\Timer;
use \Workerman\Timer;
use \PHPSocketIO\Debug;
class Socket extends Emitter
{

View File

@ -346,7 +346,7 @@ class Socket extends Emitter
call_user_func($ack, $packet['data']);
unset($this->acks[$packet['id']]);
} else {
echo ('bad ack '. packet.id);
echo ('bad ack '. $packet['id']);
}
}

View File

@ -22,7 +22,7 @@
{/volist}
{// 后台自定义头部链接}
{volist name="headlinks" id="vo"}
<li class="layui-nav-item"><a href="{$vo.slid_href}"><i class="layui-icon {$vo.slid_img}"></i>{$vo.slid_name}</a></li>
<li class="layui-nav-item"><a href="{$vo.slid_href}" target="_blank"><i class="layui-icon {$vo.slid_img}"></i>{$vo.slid_name}</a></li>
{/volist}
</ul>