2021年8月

1、评论表

CREATE TABLE `comment` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `topic_id` int(10) unsigned DEFAULT NULL COMMENT '主题id',
  `topic_type` tinyint(2) unsigned NOT NULL DEFAULT '1' COMMENT '1为课程,2为集会,3为商品',
  `content` text COMMENT '评论内容',
  `from_uid` int(10) unsigned DEFAULT NULL COMMENT '评论者id,一般为会员表的id',
  `nickname` varchar(60) DEFAULT NULL COMMENT '冗余用户昵称',
  `thumb_img` varchar(255) DEFAULT NULL COMMENT '冗余用户头像',
  `is_top` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '是否置顶评论,1为置顶,0为不置顶',
  `is_hot` tinyint(2) unsigned NOT NULL DEFAULT '0' COMMENT '是否为热评,1为热评',
  `like_num` int(5) unsigned DEFAULT '0' COMMENT '评论被点赞的次数',
  `reply_num` int(5) unsigned DEFAULT '0' COMMENT '评论被回复的次数',
  `is_reply` tinyint(2) unsigned DEFAULT '0' COMMENT '是否回复',
  `status` tinyint(2) unsigned NOT NULL COMMENT '评论状态,-1为删除,0为待审核,1为已发布',
  `create_time` int(11) unsigned DEFAULT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `topic_id` (`topic_id`) USING BTREE,
  KEY `topic_type` (`topic_type`) USING BTREE,
  KEY `from_id` (`from_uid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8

2、回复表

CREATE TABLE `comment_reply` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `comment_id` int(10) unsigned DEFAULT NULL COMMENT '评论id',
  `reply_type` tinyint(2) unsigned DEFAULT '1' COMMENT '1为回复评论,2为回复别人的回复',
  `reply_id` int(10) unsigned DEFAULT NULL COMMENT '回复目标id,reply_type为1时,是comment_id,reply_type为2时为回复表的id',
  `content` text CHARACTER SET utf8 COMMENT '回复内容',
  `to_uid` int(10) unsigned DEFAULT NULL COMMENT '回复目标id',
  `from_uid` int(10) unsigned DEFAULT NULL COMMENT '回复用户id',
  `from_thumb_img` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '回复者的头像',
  `from_nickname` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '回复者的昵称',
  `create_time` int(11) unsigned DEFAULT NULL COMMENT '评论时间',
  `to_nickname` varchar(50) CHARACTER SET utf8 DEFAULT NULL COMMENT '冗余回复对象的昵称',
  `is_author` tinyint(2) unsigned DEFAULT NULL COMMENT '0为普通回复,1为后台管理员回复',
  PRIMARY KEY (`id`),
  KEY `comment_id` (`comment_id`) USING BTREE,
  KEY `from_uid` (`from_uid`) USING BTREE,
  KEY `to_uid` (`to_uid`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8

注意:字符集是否满足需求。
转自:https://blog.csdn.net/sluckyboy/article/details/76574030

错误如下:

Composer detected issues in your platform:

Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.24-(to be removed in future macOS).

PHP Fatal error:  Composer detected issues in your platform: Your Composer dependencies require a PHP version ">= 7.4.0". You are running 7.3.24-(to be removed in future macOS). 

解决办法:

1、在项目根目录的composer.josn内增加

{
    "config": {
    
        "platform-check": false
    }
}

2、清除配置缓存:

run php artisan config:cache

3、重构对象,在控制台执行:

composer dump-autoload

1.首先在http://open-doc.dingtalk.com/microapp/serverapi2/vzzrkv中下载PHP版本SDK。解压后文件目录如图:

111.jpeg

这里我只用到dingtalk中的文件,删除aliyun、QimenCloud目录,保留top目录Autoloader.phpTopSdk.php文件。

2、composer.json中:

"autoload": {
    "classmap": [
        "database"
    ],
    "files":[
        "app/Packages/taobao/TopSdk.php"
    ],
    "psr-4": {
        "App\\": "app/"
    }
 
}

别忘记:然后执行composer dump-autoload

3、执行完毕后,在Controller中就可以直接使用DingTalk SDK了。测试结果如下(注意要加‘ \ ’):

object(DingTalkClient)#276 (9) { ["gatewayUrl"]=> string(34) "http://eco.taobao.com/router/rest" ["format"]=> string(4) "json" ["connectTimeout"]=> NULL ["readTimeout"]=> NULL ["apiCallType"]=> string(4) "oapi" ["httpMethod"]=> string(4) "POST" ["checkRequest"]=> bool(true) ["apiVersion":protected]=> string(3) "2.0" ["sdkVersion":protected]=> string(25) "dingtalk-sdk-php-20161214" }

本文转载:https://blog.csdn.net/xiaoweite1/article/details/106175892

一、若出现Not Found The requested URL解决

public下的.htaccess文件增加:

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} (.+)/$
    RewriteRule ^ %1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

二、若出现图片无法上传或访问请这样解决

1、php artisan storage:link但需要在cmd下操作,这时需要在“我的电脑”里增加path环境变量。
112233.png
如下图,找到php对应的目录(如:php.exe所在目录),即:E:\phpstudy\Extensions\php\php7.4.3nts
2、找到“我的电脑”的环境变量增加,如下图:
11223344.png
3、接下来就可以在cmd下执行相关操作了,如下:
223344.png

三、上线后的必要优化,提升访问速度很有效

配置信息缓存 artisan config:cache
路由缓存 artisan route:cache
类映射加载优化 artisan optimize
自动加载优化 composer dumpautoload
使用 Memcached 来存储会话 config/session.php
使用专业缓存驱动器 config/cache.php
数据库请求优化
为数据集书写缓存逻辑
使用即时编译器(JIT),如:HHVM
开启 OpCache
前端资源合并 Elixir

更多优化见:https://learnku.com/laravel/t/47213

1、可以将 Composer 降级到 1.x 版,操作如下:

composer self-update --1

2、如果您需要切换回 Composer 2.x 版,只需键入:

composer self-update --2

3、更多信息
https://5balloons.info/fix-you-are-using-composer-2-some-plugins-seem-to-be-incompatible-with/