init: import production code mss.nahaichuan.com (exclude Runtime/Uploads/backups/logs)
这个提交包含在:
@@ -0,0 +1,170 @@
|
||||
<?php
|
||||
|
||||
namespace Common\Model;
|
||||
//[1.4.27]
|
||||
|
||||
/**
|
||||
* OrderEvaluateController 零售小程序商品评价
|
||||
* @author shao nianyi
|
||||
* @create_time 2020年4月8日
|
||||
*/
|
||||
class RetailOrderEvaluateModel extends BaseModel
|
||||
{
|
||||
protected $tableName = 'retail_order_evaluate';
|
||||
protected $fields = array(
|
||||
'id', // int(11) NOT NULL AUTO_INCREMENT,
|
||||
'bill_id', // int(11) NOT NULL COMMENT '零售订单ID',
|
||||
'sell_id', // int(11) NOT NULL COMMENT '销售记录ID',
|
||||
'goods_id', // int(11) NOT NULL COMMENT '商品ID',
|
||||
'sku_id', // int(11) NOT NULL COMMENT '规格ID',
|
||||
'store_id', // int(11) NOT NULL COMMENT '门店ID',
|
||||
'uid', // int(11) NOT NULL COMMENT '小程序用户ID',
|
||||
'sku_name', // varchar(249) DEFAULT NULL COMMENT '规格信息'
|
||||
'goods_name', // varchar(249) DEFAULT NULL COMMENT '商品名'
|
||||
'content', // varchar(255) DEFAULT NULL COMMENT '评价内容',
|
||||
'stars', // int(1) NOT NULL DEFAULT '5' COMMENT '星级',
|
||||
'img_id', // varchar(249) DEFAULT NULL COMMENT '图片ID',
|
||||
'create_time', // datetime NOT NULL COMMENT '发布时间',
|
||||
'state', // int(1) NOT NULL DEFAULT '2' COMMENT '状态:1=显示,2=隐匿',
|
||||
'is_top', // int(1) NOT NULL DEFAULT '2' COMMENT '置顶:1=置顶,2=正常',
|
||||
'is_hide', // int(1) NOT NULL DEFAULT '2' COMMENT '隐藏:1=隐藏,2=正常',
|
||||
);
|
||||
|
||||
/**
|
||||
* 获取商品第一个评价及总条数
|
||||
* $goods_id
|
||||
* @param $goods_id
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGoodsEvaluate($goods_id)
|
||||
{
|
||||
$field = array(
|
||||
'roe.id as evaluate_id',
|
||||
'roe.content',
|
||||
'roe.stars',
|
||||
'roe.img_id',
|
||||
'roe.sku_name',
|
||||
'roe.create_time',
|
||||
'rx.nickname',
|
||||
'rx.avatar'
|
||||
);
|
||||
$where['roe.goods_id'] = $goods_id;
|
||||
$where['roe.is_hide'] = 2;
|
||||
|
||||
$list = $this->alias('roe')
|
||||
->field($field)
|
||||
->join('ls_retail_xcxvip as rx on roe.uid = rx.id', 'LEFT')
|
||||
->where($where)
|
||||
->order('roe.is_top, roe.id desc')
|
||||
->find();
|
||||
$total = $this->getCount(['goods_id' => $goods_id, 'is_hide' => 2]);
|
||||
$evaluate['list'] = $list;
|
||||
$evaluate['total'] = $total;
|
||||
return $evaluate;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论列表
|
||||
* @param $goods_id
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGoodsEvaluateList($goods_id, $page = 1, $pageSize = 3)
|
||||
{
|
||||
$field = array(
|
||||
'roe.id as evaluate_id',
|
||||
'roe.content',
|
||||
'roe.stars',
|
||||
'roe.img_id',
|
||||
'roe.sku_name',
|
||||
'roe.create_time',
|
||||
'rx.nickname',
|
||||
'rx.avatar'
|
||||
);
|
||||
$where['roe.goods_id'] = $goods_id;
|
||||
$where['roe.is_hide'] = 2;
|
||||
|
||||
$list = $this->alias('roe')
|
||||
->field($field)
|
||||
->join('ls_retail_xcxvip as rx on roe.uid = rx.id', 'LEFT')
|
||||
->where($where)
|
||||
->order('roe.is_top, roe.id desc')
|
||||
->page($page, $pageSize)
|
||||
->select();
|
||||
return $list ? $list : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取评论详情
|
||||
* @param $evaluate_id 评价ID
|
||||
* @return mixed
|
||||
*/
|
||||
public function getGoodsEvaluateDetails($evaluate_id)
|
||||
{
|
||||
$field = array(
|
||||
'roe.id as evaluate_id',
|
||||
'roe.content',
|
||||
'roe.stars',
|
||||
'roe.img_id',
|
||||
'roe.sku_name',
|
||||
'roe.create_time',
|
||||
'rx.nickname',
|
||||
'rx.avatar'
|
||||
);
|
||||
|
||||
$where['roe.id'] = $evaluate_id;
|
||||
|
||||
$evaluateDetails = $this->alias('roe')
|
||||
->field($field)
|
||||
->join('ls_retail_xcxvip as rx on roe.uid = rx.id', 'LEFT')
|
||||
->where($where)
|
||||
->find();
|
||||
return $evaluateDetails;
|
||||
}
|
||||
|
||||
|
||||
/* *************************** 后台Start ************************************* */
|
||||
/**
|
||||
* 获取列表及数量
|
||||
* @param $map
|
||||
* @param int $page
|
||||
* @param int $pageSize
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEvaluateByStore($map, $page = 1, $pageSize = 10)
|
||||
{
|
||||
$field = array(
|
||||
'roe.id as evaluate_id',
|
||||
'roe.bill_id',
|
||||
'roe.content',
|
||||
'roe.stars',
|
||||
'roe.img_id',
|
||||
'roe.sku_name',
|
||||
'roe.is_hide',
|
||||
'roe.is_top',
|
||||
'roe.goods_name',
|
||||
'roe.create_time',
|
||||
'rx.nickname',
|
||||
'rx.avatar',
|
||||
'rg.goods_img_id'
|
||||
);
|
||||
|
||||
$list = $this->alias('roe')
|
||||
->field($field)
|
||||
->join('ls_retail_xcxvip as rx on roe.uid = rx.id', 'LEFT')
|
||||
->join('ls_retail_goods as rg on roe.goods_id = rg.id', 'LEFT')
|
||||
->where($map)
|
||||
->order('roe.id desc')
|
||||
->page($page, $pageSize)
|
||||
->select();
|
||||
|
||||
$total = $this->alias('roe')
|
||||
->join('ls_retail_xcxvip as rx on roe.uid = rx.id', 'LEFT')
|
||||
->where($map)
|
||||
->count();
|
||||
$evaluate['list'] = $list;
|
||||
$evaluate['total'] = $total;
|
||||
return $evaluate;
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户