商品评论
parent
219a7de51f
commit
0b2605938b
|
|
@ -349,7 +349,7 @@
|
|||
<span data-am-modal-close class="am-close">×</span>
|
||||
</div>
|
||||
<div class="am-popup-bd">
|
||||
<form class="am-form form-validation delivery-form" method="post" action="{{:MyUrl('admin/order/delivery')}}" request-type="ajax-reload">
|
||||
<form class="am-form form-validation-delivery delivery-form" method="post" action="{{:MyUrl('admin/order/delivery')}}" request-type="ajax-reload">
|
||||
<!-- 支付方式 -->
|
||||
<div class="business-item">
|
||||
<h3>选择快递</h3>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace app\index\controller;
|
|||
|
||||
use app\service\OrderService;
|
||||
use app\service\PaymentService;
|
||||
use app\service\GoodsCommentsService;
|
||||
|
||||
/**
|
||||
* 订单管理
|
||||
|
|
@ -190,7 +191,7 @@ class Order extends Common
|
|||
{
|
||||
$params = input('post.');
|
||||
$params['user'] = $this->user;
|
||||
return OrderService::Comments($params);
|
||||
return GoodsCommentsService::Comments($params);
|
||||
} else {
|
||||
$this->assign('msg', '非法访问');
|
||||
return $this->fetch('public/tips_error');
|
||||
|
|
|
|||
|
|
@ -384,10 +384,15 @@
|
|||
|
||||
<!-- tab -->
|
||||
<div class="am-tabs" data-am-tabs>
|
||||
<ul class="am-avg-sm-2 am-tabs-nav am-nav am-nav-tabs" data-am-sticky="{animation: 'slide-top'}">
|
||||
<ul class="am-avg-sm-3 am-tabs-nav am-nav am-nav-tabs" data-am-sticky="{animation: 'slide-top'}">
|
||||
<li class="am-active">
|
||||
<a href="javascript:;">
|
||||
<span class="index-needs-dt-txt">宝贝详情</span>
|
||||
<span class="index-needs-dt-txt">详情</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="javascript:;">
|
||||
<span class="index-needs-dt-txt">评价({{$goods.comments_count}})</span>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
|
@ -424,6 +429,64 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 评论 -->
|
||||
<div class="am-tab-panel am-fade goods-comment">
|
||||
<article class="am-comment">
|
||||
<a href="#">
|
||||
<img src="http://tp5-dev.com/static/index/default/images/default-user-avatar.jpg" class="am-comment-avatar" alt=""/>
|
||||
</a>
|
||||
<div class="am-comment-main"> <!-- 评论内容容器 -->
|
||||
<header class="am-comment-hd">
|
||||
<!--<h3 class="am-comment-title">评论标题</h3>-->
|
||||
<div class="am-comment-meta"> <!-- 评论元数据 -->
|
||||
<a href="#link-to-user" class="am-comment-author">魔鬼</a> <!-- 评论者 -->
|
||||
评论于 <time datetime="">2019-05-13 15:32</time>
|
||||
</div>
|
||||
</header>
|
||||
<div class="am-comment-bd">
|
||||
<p>那,那是一封写给南部母亲的信。我茫然站在骑楼下,我又看到永远的樱子走到街心。其实雨下得并不大,却是一生一世中最大的一场雨。而那封信是这样写的,年轻的樱子知不知道呢?</p>
|
||||
<p class="comment-spec">颜色:红色,尺码:M</p>
|
||||
<div class="comment-reply">
|
||||
<span class="comment-reply-title">管理员回复:</span>
|
||||
<span class="comment-reply-desc">我打算在下个月和樱子结婚。</span>
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
<article class="am-comment">
|
||||
<a href="#">
|
||||
<img src="http://tp5-dev.com/static/index/default/images/default-user-avatar.jpg" class="am-comment-avatar" alt=""/>
|
||||
</a>
|
||||
<div class="am-comment-main"> <!-- 评论内容容器 -->
|
||||
<header class="am-comment-hd">
|
||||
<!--<h3 class="am-comment-title">评论标题</h3>-->
|
||||
<div class="am-comment-meta"> <!-- 评论元数据 -->
|
||||
<a href="#link-to-user" class="am-comment-author">魔鬼</a> <!-- 评论者 -->
|
||||
评论于 <time datetime="">2019-05-13 15:32</time>
|
||||
</div>
|
||||
</header>
|
||||
<div class="am-comment-bd">
|
||||
<p>那,那是一封写给南部母亲的信。我茫然站在骑楼下,我又看到永远的樱子走到街心。其实雨下得并不大,却是一生一世中最大的一场雨。而那封信是这样写的,年轻的樱子知不知道呢?</p>
|
||||
<p class="comment-spec">颜色:红色,尺码:M</p>
|
||||
</div>
|
||||
</article>
|
||||
<article class="am-comment">
|
||||
<a href="#">
|
||||
<img src="http://tp5-dev.com/static/index/default/images/default-user-avatar.jpg" class="am-comment-avatar" alt=""/>
|
||||
</a>
|
||||
<div class="am-comment-main"> <!-- 评论内容容器 -->
|
||||
<header class="am-comment-hd">
|
||||
<!--<h3 class="am-comment-title">评论标题</h3>-->
|
||||
<div class="am-comment-meta"> <!-- 评论元数据 -->
|
||||
<a href="#link-to-user" class="am-comment-author">魔鬼</a> <!-- 评论者 -->
|
||||
评论于 <time datetime="">2019-05-13 15:32</time>
|
||||
</div>
|
||||
</header>
|
||||
<div class="am-comment-bd">
|
||||
<p>那,那是一封写给南部母亲的信。我茫然站在骑楼下,我又看到永远的樱子走到街心。其实雨下得并不大,却是一生一世中最大的一场雨。而那封信是这样写的,年轻的樱子知不知道呢?</p>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
|
||||
<!-- 猜你喜欢 -->
|
||||
<div class="am-tab-panel am-fade">
|
||||
<div class="like">
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
<form class="am-form form-validation" method="post" action="{{:MyUrl('index/order/commentssave')}}" request-type="ajax-url" request-value="{{$referer_url}}">
|
||||
<!-- 商品列表 -->
|
||||
{{if !empty($data.items)}}
|
||||
<div class="order-goods">
|
||||
<div class="order-goods am-form-group business-form-block">
|
||||
<table class="am-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{{foreach $data.items as $goods}}
|
||||
<tr id="data-list-{{$goods.id}}" data-id="{{$goods.id}}" data-goods-id="{{$goods.goods_id}}">
|
||||
<tr id="data-list-{{$goods.id}}" data-id="{{$goods.id}}" data-goods-id="{{$goods.goods_id}}" class="am-form-group business-form-block">
|
||||
<td class="base">
|
||||
<div class="goods-detail">
|
||||
<a href="{{$goods.goods_url}}" target="_blank">
|
||||
|
|
@ -69,8 +69,8 @@
|
|||
<p class="line-price">¥{{$goods.price}} x {{$goods.buy_number}}</p>
|
||||
</td>
|
||||
<td>
|
||||
<div class="am-form-group rating-items">
|
||||
<ul class="rating">
|
||||
<div class="rating-items">
|
||||
<ul class="rating not-selected">
|
||||
<li><i class="am-icon-star-o am-icon-md"></i></li>
|
||||
<li><i class="am-icon-star-o am-icon-md"></i></li>
|
||||
<li><i class="am-icon-star-o am-icon-md"></i></li>
|
||||
|
|
@ -79,9 +79,7 @@
|
|||
</ul>
|
||||
<input type="text" name="rating[]" value="" class="input-rating" data-validation-message="请选择评分" required />
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<textarea name="content[]" class="am-radius" rows="4" minlength="6" maxlength="200" data-validation-message="评价内容 6~200 个字符之间" required></textarea>
|
||||
</div>
|
||||
<textarea name="content[]" class="am-radius" rows="4" minlength="6" maxlength="200" data-validation-message="评价内容 6~200 个字符之间" required></textarea>
|
||||
<input type="hidden" name="goods_id[]" value="{{$goods.goods_id}}" />
|
||||
</td>
|
||||
</tr>
|
||||
|
|
@ -90,7 +88,13 @@
|
|||
</table>
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="am-form-group">
|
||||
|
||||
<div class="am-form-group business-form-block">
|
||||
<label class="block">是否匿名</label>
|
||||
<input name="is_anonymous" value="1" type="checkbox" data-off-text="否" data-on-text="是" data-size="xs" data-on-color="success" data-off-color="default" data-handle-width="50" data-am-switch />
|
||||
</div>
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing business-form-block">
|
||||
<input type="hidden" name="id" value="{{$data.id}}" />
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm" data-am-loading="{loadingText:'处理中...'}">提交</button>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ namespace app\plugins\wallet\service;
|
|||
|
||||
use think\Db;
|
||||
use app\service\ResourcesService;
|
||||
use app\service\UserService;
|
||||
use app\plugins\wallet\service\WalletService;
|
||||
use app\plugins\wallet\service\CashService;
|
||||
use app\plugins\wallet\service\RechargeService;
|
||||
|
|
@ -49,7 +50,7 @@ class BaseService
|
|||
foreach($data as &$v)
|
||||
{
|
||||
// 用户信息
|
||||
$v['user'] = self::GetUserInfo($v['user_id']);
|
||||
$v['user'] = UserService::GetUserViewInfo($v['user_id']);
|
||||
|
||||
// 状态
|
||||
$v['status_text'] = (isset($v['status']) && isset($wallet_status_list[$v['status']])) ? $wallet_status_list[$v['status']]['name'] : '未知';
|
||||
|
|
@ -62,46 +63,6 @@ class BaseService
|
|||
return DataReturn('处理成功', 0, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-05
|
||||
* @desc description
|
||||
* @param [int] $user_id [用户id]
|
||||
*/
|
||||
private static function GetUserInfo($user_id)
|
||||
{
|
||||
$user = Db::name('User')->field('username,nickname,mobile,email,avatar')->find($user_id);
|
||||
if(!empty($user))
|
||||
{
|
||||
$user['user_name_view'] = $user['username'];
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['nickname'];
|
||||
}
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['mobile'];
|
||||
}
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['email'];
|
||||
}
|
||||
|
||||
// 头像
|
||||
if(!empty($user['avatar']))
|
||||
{
|
||||
$user['avatar'] = ResourcesService::AttachmentPathViewHandle($user['avatar']);
|
||||
} else {
|
||||
$user['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(config('DEFAULT_THEME', 'default')).'/images/default-user-avatar.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 钱包总数
|
||||
* @author Devil
|
||||
|
|
@ -175,7 +136,7 @@ class BaseService
|
|||
foreach($data as &$v)
|
||||
{
|
||||
// 用户信息
|
||||
$v['user'] = self::GetUserInfo($v['user_id']);
|
||||
$v['user'] = UserService::GetUserViewInfo($v['user_id']);
|
||||
|
||||
// 支付状态
|
||||
$v['status_text'] = isset($v['status']) ? RechargeService::$recharge_status_list[$v['status']]['name'] : '';
|
||||
|
|
@ -274,7 +235,7 @@ class BaseService
|
|||
foreach($data as &$v)
|
||||
{
|
||||
// 用户信息
|
||||
$v['user'] = self::GetUserInfo($v['user_id']);
|
||||
$v['user'] = UserService::GetUserViewInfo($v['user_id']);
|
||||
|
||||
// 业务类型
|
||||
$v['business_type_text'] = (isset($v['business_type']) && isset($business_type_list[$v['business_type']])) ? $business_type_list[$v['business_type']]['name'] : '未知';
|
||||
|
|
@ -386,7 +347,7 @@ class BaseService
|
|||
foreach($data as &$v)
|
||||
{
|
||||
// 用户信息
|
||||
$v['user'] = self::GetUserInfo($v['user_id']);
|
||||
$v['user'] = UserService::GetUserViewInfo($v['user_id']);
|
||||
|
||||
// 提现状态
|
||||
$v['status_text'] = isset($v['status']) ? CashService::$cash_status_list[$v['status']]['name'] : '';
|
||||
|
|
|
|||
|
|
@ -0,0 +1,253 @@
|
|||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: Devil
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\service;
|
||||
|
||||
use think\Db;
|
||||
use app\service\UserService;
|
||||
|
||||
/**
|
||||
* 商品评论服务层
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 0.0.1
|
||||
* @datetime 2016-12-01T21:51:08+0800
|
||||
*/
|
||||
class GoodsCommentsService
|
||||
{
|
||||
/**
|
||||
* 订单评价
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-09
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function Comments($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '订单id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'goods_id',
|
||||
'error_msg' => '商品id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'goods_id',
|
||||
'error_msg' => '商品数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'rating',
|
||||
'error_msg' => '评级有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'rating',
|
||||
'error_msg' => '评级数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '评价内容有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '评价内容数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'user',
|
||||
'error_msg' => '用户信息有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取订单信息
|
||||
$order_id = intval($params['id']);
|
||||
$where = ['id'=>$order_id, 'user_id'=>$params['user']['id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||
$order = Db::name('Order')->where($where)->field('id,status,shop_id,user_is_comments')->find();
|
||||
if(empty($order))
|
||||
{
|
||||
return DataReturn('资源不存在或已被删除', -1);
|
||||
}
|
||||
if($order['status'] != 4)
|
||||
{
|
||||
$status_text = lang('common_order_user_status')[$order['status']]['name'];
|
||||
return DataReturn('状态不可操作['.$status_text.']', -1);
|
||||
}
|
||||
if($order['user_is_comments'] != 0)
|
||||
{
|
||||
return DataReturn('该订单你已进行过评价', -10);
|
||||
}
|
||||
|
||||
// 处理数据
|
||||
Db::startTrans();
|
||||
foreach($params['goods_id'] as $k=>$goods_id)
|
||||
{
|
||||
$data = [
|
||||
'user_id' => $params['user']['id'],
|
||||
'shop_id' => $order['shop_id'],
|
||||
'order_id' => $order_id,
|
||||
'goods_id' => $goods_id,
|
||||
'content' => isset($params['content'][$k]) ? htmlspecialchars(trim($params['content'][$k])) : '',
|
||||
'rating' => isset($params['rating'][$k]) ? intval($params['rating'][$k]) : 0,
|
||||
'is_anonymous' => isset($params['is_anonymous']) ? min(1, intval($params['is_anonymous'])) : 0,
|
||||
'add_time' => time(),
|
||||
];
|
||||
if(Db::name('OrderComments')->insertGetId($data) <= 0)
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('评价内容添加失败', -100);
|
||||
}
|
||||
}
|
||||
|
||||
// 订单评价状态更新
|
||||
if(!Db::name('Order')->where($where)->update(['user_is_comments'=>time(), 'upd_time'=>time()]))
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('订单更新失败', -101);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return DataReturn('评价成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品评论列表
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function GoodsCommentsList($params = [])
|
||||
{
|
||||
$where = empty($params['where']) ? [] : $params['where'];
|
||||
$m = isset($params['m']) ? intval($params['m']) : 0;
|
||||
$n = isset($params['n']) ? intval($params['n']) : 10;
|
||||
$order_by = empty($params['order_by']) ? 'id desc' : $params['order_by'];
|
||||
|
||||
// 获取数据列表
|
||||
$data = Db::name('OrderComments')->where($where)->limit($m, $n)->order($order_by)->select();
|
||||
if(!empty($data))
|
||||
{
|
||||
$common_is_text_list = lang('common_is_text_list');
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 用户信息
|
||||
$v['user'] = UserService::GetUserViewInfo($v['user_id']);
|
||||
|
||||
// 是否
|
||||
$v['is_reply_text'] = isset($common_is_text_list[$v['is_reply']]) ? $common_is_text_list[$v['is_reply']]['name'] : '';
|
||||
$v['is_anonymous_text'] = isset($common_is_text_list[$v['is_anonymous']]) ? $common_is_text_list[$v['is_anonymous']]['name'] : '';
|
||||
|
||||
// 评论时间
|
||||
$v['add_time_time'] = date('Y-m-d H:i:s', $v['add_time']);
|
||||
$v['add_time_date'] = date('Y-m-d', $v['add_time']);
|
||||
|
||||
// 回复时间
|
||||
$v['reply_time_time'] = empty($v['reply_time']) ? null : date('Y-m-d H:i:s', $v['reply_time']);
|
||||
$v['reply_time_date'] = empty($v['reply_time']) ? null : date('Y-m-d', $v['reply_time']);
|
||||
}
|
||||
}
|
||||
return DataReturn('处理成功', 0, $data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论总数
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $where [条件]
|
||||
*/
|
||||
public static function GoodsCommentsTotal($where = [])
|
||||
{
|
||||
return (int) Db::name('OrderComments')->where($where)->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论列表条件
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-09-29
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function GoodsCommentsListWhere($params = [])
|
||||
{
|
||||
$where = [];
|
||||
|
||||
// 用户id
|
||||
if(!empty($params['user']))
|
||||
{
|
||||
$where[] = ['user_id', '=', $params['user']['id']];
|
||||
}
|
||||
|
||||
// 关键字根据用户筛选
|
||||
if(!empty($params['keywords']))
|
||||
{
|
||||
if(empty($params['user']))
|
||||
{
|
||||
$user_ids = Db::name('User')->where('username|nickname|mobile|email', '=', $params['keywords'])->column('id');
|
||||
if(!empty($user_ids))
|
||||
{
|
||||
$where[] = ['user_id', 'in', $user_ids];
|
||||
} else {
|
||||
// 无数据条件,走单号条件
|
||||
$where[] = ['recharge_no', '=', $params['keywords']];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 是否更多条件
|
||||
if(isset($params['is_more']) && $params['is_more'] == 1)
|
||||
{
|
||||
// 等值
|
||||
if(isset($params['is_anonymous']) && $params['is_anonymous'] > -1)
|
||||
{
|
||||
$where[] = ['is_anonymous', '=', intval($params['is_anonymous'])];
|
||||
}
|
||||
if(isset($params['is_reply']) && $params['is_reply'] > -1)
|
||||
{
|
||||
$where[] = ['is_reply', '=', intval($params['is_reply'])];
|
||||
}
|
||||
|
||||
|
||||
if(!empty($params['time_start']))
|
||||
{
|
||||
$where[] = ['add_time', '>', strtotime($params['time_start'])];
|
||||
}
|
||||
if(!empty($params['time_end']))
|
||||
{
|
||||
$where[] = ['add_time', '<', strtotime($params['time_end'])];
|
||||
}
|
||||
}
|
||||
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -1233,115 +1233,6 @@ class OrderService
|
|||
return DataReturn('删除失败或资源不存在', -1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单评价
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2018-10-09
|
||||
* @desc description
|
||||
* @param [array] $params [输入参数]
|
||||
*/
|
||||
public static function Comments($params = [])
|
||||
{
|
||||
// 请求参数
|
||||
$p = [
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'id',
|
||||
'error_msg' => '订单id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'goods_id',
|
||||
'error_msg' => '商品id有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'goods_id',
|
||||
'error_msg' => '商品数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'rating',
|
||||
'error_msg' => '评级有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'rating',
|
||||
'error_msg' => '评级数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'isset',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '评价内容有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'is_array',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '评价内容数据格式有误',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'user',
|
||||
'error_msg' => '用户信息有误',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
{
|
||||
return DataReturn($ret, -1);
|
||||
}
|
||||
|
||||
// 获取订单信息
|
||||
$order_id = intval($params['id']);
|
||||
$where = ['id'=>$order_id, 'user_id'=>$params['user']['id'], 'is_delete_time'=>0, 'user_is_delete_time'=>0];
|
||||
$order = Db::name('Order')->where($where)->field('id,status,shop_id,user_is_comments')->find();
|
||||
if(empty($order))
|
||||
{
|
||||
return DataReturn('资源不存在或已被删除', -1);
|
||||
}
|
||||
if($order['status'] != 4)
|
||||
{
|
||||
$status_text = lang('common_order_user_status')[$order['status']]['name'];
|
||||
return DataReturn('状态不可操作['.$status_text.']', -1);
|
||||
}
|
||||
if($order['user_is_comments'] != 0)
|
||||
{
|
||||
return DataReturn('该订单你已进行过评价', -10);
|
||||
}
|
||||
|
||||
// 处理数据
|
||||
Db::startTrans();
|
||||
foreach($params['goods_id'] as $k=>$goods_id)
|
||||
{
|
||||
$data = [
|
||||
'user_id' => $params['user']['id'],
|
||||
'shop_id' => $order['shop_id'],
|
||||
'order_id' => $order_id,
|
||||
'goods_id' => $goods_id,
|
||||
'content' => isset($params['content'][$k]) ? htmlspecialchars(trim($params['content'][$k])) : '',
|
||||
'rating' => isset($params['rating'][$k]) ? intval($params['rating'][$k]) : 0,
|
||||
'add_time' => time(),
|
||||
];
|
||||
if(Db::name('OrderComments')->insertGetId($data) <= 0)
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('评价内容添加失败', -100);
|
||||
}
|
||||
}
|
||||
|
||||
// 订单评价状态更新
|
||||
if(!Db::name('Order')->where($where)->update(['user_is_comments'=>time(), 'upd_time'=>time()]))
|
||||
{
|
||||
Db::rollback();
|
||||
return DataReturn('订单更新失败', -101);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
return DataReturn('评价成功', 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单每个环节状态总数
|
||||
* @author Devil
|
||||
|
|
|
|||
|
|
@ -1852,5 +1852,45 @@ class UserService
|
|||
return DataReturn('退出成功', 0, $result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户展示信息
|
||||
* @author Devil
|
||||
* @blog http://gong.gg/
|
||||
* @version 1.0.0
|
||||
* @date 2019-05-05
|
||||
* @desc description
|
||||
* @param [int] $user_id [用户id]
|
||||
*/
|
||||
public static function GetUserViewInfo($user_id)
|
||||
{
|
||||
$user = Db::name('User')->field('username,nickname,mobile,email,avatar')->find($user_id);
|
||||
if(!empty($user))
|
||||
{
|
||||
$user['user_name_view'] = $user['username'];
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['nickname'];
|
||||
}
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['mobile'];
|
||||
}
|
||||
if(empty($user['user_name_view']))
|
||||
{
|
||||
$user['user_name_view'] = $user['email'];
|
||||
}
|
||||
|
||||
// 头像
|
||||
if(!empty($user['avatar']))
|
||||
{
|
||||
$user['avatar'] = ResourcesService::AttachmentPathViewHandle($user['avatar']);
|
||||
} else {
|
||||
$user['avatar'] = config('shopxo.attachment_host').'/static/index/'.strtolower(config('DEFAULT_THEME', 'default')).'/images/default-user-avatar.jpg';
|
||||
}
|
||||
}
|
||||
|
||||
return $user;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
File diff suppressed because one or more lines are too long
|
|
@ -29,6 +29,7 @@ $(function()
|
|||
});
|
||||
|
||||
// 发货操作表单
|
||||
FromInit('form.form-validation-delivery');
|
||||
$('form.delivery-form button[type=submit]').on('click', function()
|
||||
{
|
||||
var id = $('form.delivery-form input[name=id]').val() || 0;
|
||||
|
|
|
|||
|
|
@ -918,7 +918,7 @@ function ConfirmDataDelete(e)
|
|||
function AjaxRequest(e)
|
||||
{
|
||||
var id = e.data('id');
|
||||
var field = e.data('field') || 'value';
|
||||
var field = e.data('field') || '';
|
||||
var value = e.data('value') || '';
|
||||
var url = e.data('url');
|
||||
var view = e.data('view') || '';
|
||||
|
|
@ -929,7 +929,7 @@ function AjaxRequest(e)
|
|||
type:'POST',
|
||||
dataType:"json",
|
||||
timeout:10000,
|
||||
data:{id:id, field: value},
|
||||
data:{"id":id, "value": value, "field": field},
|
||||
success:function(result)
|
||||
{
|
||||
if(result.code == 0)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
h1, h2, h3, h4, h5, h6, p, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
del, dfn, em, img, ins, kbd, q, s, samp,
|
||||
small, strike, strong, sub, sup, tt, var,
|
||||
|
|
|
|||
|
|
@ -61,6 +61,14 @@ input{font-size:12px;font-size:100%;outline:none;line-height:normal;color:#444;}
|
|||
.buy-nav-opt a { color: #666; }
|
||||
.text-active { color: #cf2915 !important; }
|
||||
|
||||
/* 商品评论 */
|
||||
.goods-comment .am-comment { margin-top: 15px; }
|
||||
.goods-comment .am-comment-main { border: 1px solid #eee; }
|
||||
.goods-comment .comment-spec { margin-top: 5px; color: #B0B0B0; }
|
||||
.comment-reply { border-top: 1px dashed #eee; margin-top: 10px; padding-top: 10px; }
|
||||
.comment-reply-title { color: #666; }
|
||||
.comment-reply-desc { color: #905602; }
|
||||
|
||||
|
||||
@media only screen and (min-width:640px) {
|
||||
.theme-span{height:0px;background:#fff ;}
|
||||
|
|
@ -469,6 +477,9 @@ li.am-comment{ width:100%}
|
|||
/* 视频操作 */
|
||||
.scoll .goods-video-submit-close { bottom: 50px; }
|
||||
|
||||
/* 商品评论 */
|
||||
.goods-comment .am-comment { margin-left: 5px; margin-right: 5px; }
|
||||
|
||||
/* 底部 */
|
||||
.am-footer { padding-bottom: 35px; }
|
||||
}
|
||||
|
|
@ -1,29 +1,35 @@
|
|||
ul.rating {
|
||||
.user-content-body ul.rating {
|
||||
overflow: hidden;
|
||||
margin-bottom: 2px;
|
||||
padding: 3px 5px;
|
||||
}
|
||||
ul.rating li {
|
||||
.user-content-body ul.rating li {
|
||||
float: left;
|
||||
margin-right: 10px;
|
||||
}
|
||||
ul.rating li i.am-icon-star-o {
|
||||
.user-content-body ul.rating li i {
|
||||
cursor: pointer;
|
||||
}
|
||||
.user-content-body ul.rating li i.am-icon-star-o {
|
||||
color: #888;
|
||||
}
|
||||
ul.rating li i.am-icon-star {
|
||||
.user-content-body ul.rating li i.am-icon-star {
|
||||
color: #d13b49;
|
||||
}
|
||||
.rating-items {
|
||||
.user-content-body .rating-items {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.rating-items .input-rating {
|
||||
.user-content-body .rating-items .input-rating {
|
||||
position: fixed;
|
||||
top: -10000px;
|
||||
left: -10000px;
|
||||
}
|
||||
.rating-items.am-form-error ul.rating {
|
||||
.user-content-body .am-form-group.am-form-error ul.not-selected {
|
||||
background-color: #ffe7e7;
|
||||
}
|
||||
.user-content-body .order-goods:hover {
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ $(function()
|
|||
$(this).parent().find('li').eq(i).find('i').removeClass('am-icon-star-o').addClass('am-icon-star');
|
||||
}
|
||||
$(this).parents('td').find('input.input-rating').val(index+1).trigger('blur');
|
||||
$(this).parent().removeClass('not-selected');
|
||||
});
|
||||
|
||||
// 是否自动开启支付窗口
|
||||
|
|
|
|||
Loading…
Reference in New Issue