其余文件

This commit is contained in:
2026-04-14 17:46:22 +08:00
parent 294b68fe37
commit 3691f4db22
1343 changed files with 189847 additions and 0 deletions

View File

@ -0,0 +1,90 @@
<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\common\model\goods;
use app\common\basics\Models;
use app\common\model\order\OrderGoods;
class GoodsComment extends Models
{
/**
* 关联商品
*/
public function goods()
{
return $this->hasOne(Goods::class, 'id', 'goods_id')
->field('id,name,image');
}
/**
* 关联SKU
*/
public function goodsItem()
{
return $this->hasOne(GoodsItem::class, 'id', 'item_id')
->field('id,image,spec_value_str');
}
/**
* 关联订单商品
*/
public function orderGoods()
{
return $this->hasOne(OrderGoods::class, 'id', 'order_goods_id')
->field('id,total_pay_price');
}
/**
* 关联图片评论
*/
public function goodsCommentImage()
{
return $this->hasMany(GoodsCommentImage::class, 'goods_comment_id', 'id');
}
public function getStatusDescAttr($value)
{
return $value ? '显示' : '隐藏';
}
public function getGoodsCommentDescAttr($value)
{
$desc = [1=>'差评',2=>'差评',3=>'中评',4=>'好评',5=>'好评',];
return $desc[$value];
}
/**
* @notes 评论内容 xss
* @param $comment
* @return mixed|string
* @author lbzy
* @datetime 2023-09-06 14:36:25
*/
function getCommentAttr($comment)
{
if (in_array(app('http')->getName(), [ 'admin', 'shop' ]) && request()->isAjax()) {
$comment = htmlspecialchars($comment);
}
return $comment;
}
}