diff --git a/application/api/controller/Goods.php b/application/api/controller/Goods.php
index 0d46c2dff2f13e4a6291b33ccf67da674b58881a..bf2ab954ef57fc8bf11dda56241fd19fc74aae31 100755
--- a/application/api/controller/Goods.php
+++ b/application/api/controller/Goods.php
@@ -181,5 +181,71 @@ class Goods extends Common
$data = GoodsService::GoodsCategory($params);
return DataReturn('success', 0, $data);
}
+
+ /**
+ * 商品评分
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2019-07-11
+ * @desc description
+ * @return [type] [description]
+ */
+ public function GoodsScore()
+ {
+ if(empty($this->data_post['goods_id']))
+ {
+ return DataReturn('参数有误', -1);
+ }
+
+ // 获取商品评分
+ return GoodsCommentsService::GoodsCommentsScore($this->data_post['goods_id']);
+ }
+
+ /**
+ * 商品评论
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2019-05-13T21:47:41+0800
+ */
+ public function Comment()
+ {
+ // 参数
+ $params = $this->data_post;
+
+ // 分页
+ $number = 10;
+ $page = max(1, isset($params['page']) ? intval($params['page']) : 1);
+
+ // 条件
+ $where = [
+ 'goods_id' => $params['goods_id'],
+ 'is_show' => 1,
+ ];
+
+ // 获取总数
+ $total = GoodsCommentsService::GoodsCommentsTotal($where);
+ $page_total = ceil($total/$number);
+ $start = intval(($page-1)*$number);
+
+ // 获取列表
+ $data_params = array(
+ 'm' => $start,
+ 'n' => $number,
+ 'where' => $where,
+ 'is_public' => 1,
+ );
+ $data = GoodsCommentsService::GoodsCommentsList($data_params);
+
+ // 返回数据
+ $result = [
+ 'number' => $number,
+ 'total' => $total,
+ 'page_total' => $page_total,
+ 'data' => $data['data'],
+ ];
+ return DataReturn('success', 0, $result);
+ }
}
?>
\ No newline at end of file
diff --git a/application/index/controller/Goods.php b/application/index/controller/Goods.php
index 99a02a317d48630d43a6f6335f9e8381e536cb87..ef01f52213f8b0b9178808c5d169341843dda0e2 100755
--- a/application/index/controller/Goods.php
+++ b/application/index/controller/Goods.php
@@ -322,3 +322,4 @@ class Goods extends Common
return DataReturn('请求成功', 0, $result);
}
}
+?>
\ No newline at end of file
diff --git a/extend/payment/MafubaoWeixin.php b/extend/payment/MafubaoWeixin.php
new file mode 100644
index 0000000000000000000000000000000000000000..fa328bc1f5f624a90c4525fac6d2211ef3502e48
--- /dev/null
+++ b/extend/payment/MafubaoWeixin.php
@@ -0,0 +1,249 @@
+config = $params;
+ }
+
+ /**
+ * 配置信息
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-19
+ * @desc description
+ */
+ public function Config()
+ {
+ // 基础信息
+ $base = [
+ 'name' => '码付宝-微信', // 插件名称
+ 'version' => '0.0.1', // 插件版本
+ 'apply_version' => '不限', // 适用系统版本描述
+ 'apply_terminal'=> ['pc','h5'], // 适用终端 默认全部 ['pc', 'h5', 'ios', 'android', 'alipay', 'weixin', 'baidu']
+ 'desc' => '适用PC+H5,即时到帐支付方式,免费帮助个人实现支付后立即通知。 立即申请', // 插件描述(支持html)
+ 'author' => 'Devil', // 开发者
+ 'author_url' => 'http://shopxo.net/', // 开发者主页
+ ];
+
+ // 配置信息
+ $element = [
+ [
+ 'element' => 'input',
+ 'type' => 'text',
+ 'default' => '',
+ 'name' => 'appid',
+ 'placeholder' => 'appid',
+ 'title' => 'appid',
+ 'is_required' => 0,
+ 'message' => '请填写appid',
+ ],
+ [
+ 'element' => 'input',
+ 'type' => 'text',
+ 'default' => '',
+ 'name' => 'appsecret',
+ 'placeholder' => 'appsecret',
+ 'title' => 'appsecret',
+ 'is_required' => 0,
+ 'message' => '请填写通信密钥appsecret',
+ ],
+ ];
+
+ return [
+ 'base' => $base,
+ 'element' => $element,
+ ];
+ }
+
+ /**
+ * 支付入口
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-19
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public function Pay($params = [])
+ {
+ // 参数
+ if(empty($params))
+ {
+ return DataReturn('参数不能为空', -1);
+ }
+
+ // 配置信息
+ if(empty($this->config))
+ {
+ return DataReturn('支付缺少配置', -1);
+ }
+
+ // 处理支付
+ $parameter = array(
+ 'appid' => $this->config['appid'],
+ 'channel' => 'wechat',
+ 'notify_url' => $params['notify_url'],
+ 'return_url' => $params['call_back_url'],
+
+ // 业务参数
+ 'goodsname' => $params['name'],
+ 'out_trade_no' => $params['order_no'],
+ 'money' => $params['total_price'],
+ );
+
+ $param = $this->GetParamSign($parameter);
+ $url = 'http://payapi.shopxo.net/api/pay/mchCreateOrder/?'.$param['urls'].'&sign='.md5($param['sign'].'&key='.$this->config['appsecret']);
+ return DataReturn('处理成功', 0, $url);
+ }
+
+ /**
+ * [GetParamSign 签名生成]
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2018-09-28T00:28:07+0800
+ * @param [array] $params [输入参数]
+ */
+ private function GetParamSign($params = [])
+ {
+ $sign = '';
+ $urls = '';
+ ksort($params);
+ reset($params);
+
+ foreach($params AS $key => $val)
+ {
+ // 跳过这些不参数签名
+ if($val == '' || $key == 'sign')
+ {
+ continue;
+ }
+
+ //后面追加&拼接URL
+ if($sign != '')
+ {
+ $sign .= "&";
+ $urls .= "&";
+ }
+ $sign .= "$key=$val"; //拼接为url参数形式
+ $urls .= "$key=" . urlencode($val); //拼接为url参数形式并URL编码参数值
+ }
+
+ $result = array(
+ 'urls' => $urls,
+ 'sign' => $sign,
+ );
+ return $result;
+ }
+
+ /**
+ * 支付回调处理
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-19
+ * @desc description
+ * @param [array] $params [输入参数]
+ */
+ public function Respond($params = [])
+ {
+ if(empty($this->config))
+ {
+ return DataReturn('配置有误', -1);
+ }
+ if(empty($params['pay_no']))
+ {
+ return DataReturn('支付失败', -1);
+ }
+
+ // 签名验证
+ $param = $this->GetParamSign($params);
+ if(md5($param['sign'].$this->config['key']) != $params['sign'])
+ {
+ return DataReturn('签名错误', -1);
+ }
+
+ // 支付状态
+ if(isset($params['status']))
+ {
+ switch($params['status'])
+ {
+ // 成功
+ case 0 :
+ $ret = DataReturn('支付成功', 0, $this->ReturnData($params));
+ break;
+
+ // 失败
+ case 1 :
+ $ret = DataReturn('支付失败', -100);
+ break;
+
+ // 参数有误
+ case 2 :
+ $ret = DataReturn('支付参数有误', -1001);
+ break;
+
+ // 默认
+ default :
+ $ret = DataReturn('支付异常错误', -1002);
+ }
+ } else {
+ $ret = DataReturn('支付异常错误', -1003);
+ }
+ return $ret;
+ }
+
+ /**
+ * [ReturnData 返回数据统一格式]
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @datetime 2018-10-06T16:54:24+0800
+ * @param [array] $data [返回数据]
+ */
+ private function ReturnData($data)
+ {
+ // 返回数据固定基础参数
+ $data['trade_no'] = isset($data['pay_no']) ? $data['pay_no'] : ''; // 支付平台 - 订单号
+ $data['buyer_user'] = isset($data['pay_id']) ? $data['pay_id'] : ''; // 支付平台 - 用户
+ $data['out_trade_no'] = substr($data['pay_id'], 0, strlen($data['pay_id'])-6); // 本系统发起支付的 - 订单号
+ $data['subject'] = isset($data['param']) ? $data['param'] : ''; // 本系统发起支付的 - 商品名称
+ $data['pay_price'] = $data['money']; // 本系统发起支付的 - 总价
+
+ return $data;
+ }
+}
+?>
\ No newline at end of file
diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
index ccc5eb32021f9be516a33d6771117e18a9ba720b..43c045b0d0d2b6f3d853b196020323175e0fa99e 100644
--- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
+++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.acss
@@ -213,9 +213,6 @@
.goods-base .base-grid view {
width: calc(33.33% - 1px);
}
-.goods-base .base-grid view:not(:last-child) {
- border-right: 1px solid #f5f5f5;
-}
.goods-base .base-grid view .cr-main {
padding-left: 10rpx;
}
diff --git a/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml b/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
index 9106917ff3b313e8b28be0c0a165991714dc708e..0450ab0a4c6adc6f4862fe0df98b74973af14d93 100644
--- a/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
+++ b/public/appmini/old/alipay/pages/goods-detail/goods-detail.axml
@@ -15,7 +15,7 @@
-
+
{{goods.title}}
@@ -30,7 +30,7 @@
¥{{goods.original_price}}
-
+
累计销量
{{goods.sales_count}}
@@ -38,7 +38,7 @@
浏览次数
{{goods.access_count}}
-
+
累计评论
{{goods.comments_count}}
diff --git a/public/appmini/old/weixin/app.js b/public/appmini/old/weixin/app.js
index c0a6d50ce53b7321fc254b79f41321ab4f7e48e1..d9d1f10868a9508724522db26995a44e9596872c 100755
--- a/public/appmini/old/weixin/app.js
+++ b/public/appmini/old/weixin/app.js
@@ -56,12 +56,13 @@ App({
"message": "消息",
"user_integral": "我的积分",
"user_goods_browse": "我的足迹",
+ "goods_comment": "商品评论",
},
// 请求地址
// request_url: "{{request_url}}",
request_url: 'http://tp5-dev.com/',
- request_url: 'https://test.shopxo.net/',
+ //request_url: 'https://test.shopxo.net/',
// 基础信息
application_title: "{{application_title}}",
diff --git a/public/appmini/old/weixin/app.json b/public/appmini/old/weixin/app.json
index a68dbaea740bd16dd2be12afbaa09b408bc37633..71fe18ad834e55cb7f6a4c5a26761e8918619b4d 100755
--- a/public/appmini/old/weixin/app.json
+++ b/public/appmini/old/weixin/app.json
@@ -1,5 +1,5 @@
{
- "pages": [
+ "pages": ["pages/goods-comment/goods-comment",
"pages/index/index",
"pages/goods-category/goods-category",
"pages/cart/cart",
diff --git a/public/appmini/old/weixin/pages/goods-comment/goods-comment.js b/public/appmini/old/weixin/pages/goods-comment/goods-comment.js
new file mode 100644
index 0000000000000000000000000000000000000000..5ce3292b6bba2fd39affb367ed65d1eaf0441b6e
--- /dev/null
+++ b/public/appmini/old/weixin/pages/goods-comment/goods-comment.js
@@ -0,0 +1,168 @@
+const app = getApp();
+Page({
+ data: {
+ data_list_loding_status: 1,
+ data_bottom_line_status: false,
+ data_list: [],
+ data_page_total: 0,
+ data_page: 1,
+ goods_score: null,
+ params: null,
+ progress_class: ['progress-bar-danger', 'progress-bar-warning', 'progress-bar-secondary', '', 'progress-bar-success'],
+ },
+
+ onLoad(params) {
+ params['goods_id']=2;
+ this.setData({ params: params });
+ this.init();
+ },
+
+ onShow() {
+ wx.setNavigationBarTitle({ title: app.data.common_pages_title.goods_comment });
+ },
+
+ // 初始化
+ init() {
+ // 获取数据
+ this.goods_score();
+ this.get_data_list();
+ },
+
+ // 获取商品评分
+ goods_score() {
+ wx.request({
+ url: app.get_request_url("goodsscore", "goods"),
+ method: "POST",
+ data: { goods_id: this.data.params.goods_id },
+ dataType: "json",
+ header: { 'content-type': 'application/x-www-form-urlencoded' },
+ success: res => {
+ if (res.data.code == 0) {
+ this.setData({
+ goods_score: res.data.data || null,
+ });
+ } else {
+ app.showToast(res.data.msg);
+ }
+ },
+ fail: () => {
+ app.showToast("服务器请求出错");
+ }
+ });
+ },
+
+ // 获取数据列表
+ get_data_list(is_mandatory) {
+ // 参数校验
+ if ((this.data.params.goods_id || null) == null) {
+ wx.stopPullDownRefresh();
+ this.setData({
+ data_bottom_line_status: false,
+ data_list_loding_status: 2,
+ });
+ } else {
+ var self = this;
+
+ // 分页是否还有数据
+ if ((is_mandatory || 0) == 0) {
+ if (this.data.data_bottom_line_status == true) {
+ return false;
+ }
+ }
+
+ // 加载loding
+ wx.showLoading({ title: "加载中..." });
+ this.setData({
+ data_list_loding_status: 1
+ });
+
+ wx.request({
+ url: app.get_request_url("comment", "goods"),
+ method: "POST",
+ data: { goods_id: this.data.params.goods_id, page: this.data.data_page },
+ dataType: "json",
+ header: { 'content-type': 'application/x-www-form-urlencoded' },
+ success: res => {
+ wx.hideLoading();
+ wx.stopPullDownRefresh();
+ if (res.data.code == 0) {
+ if (res.data.data.data.length > 0) {
+ if (this.data.data_page <= 1) {
+ var temp_data_list = res.data.data.data;
+ } else {
+ var temp_data_list = this.data.data_list;
+ var temp_data = res.data.data.data;
+ for (var i in temp_data) {
+ temp_data_list.push(temp_data[i]);
+ }
+ }
+ this.setData({
+ data_list: temp_data_list,
+ data_total: res.data.data.total,
+ data_page_total: res.data.data.page_total,
+ data_list_loding_status: 3,
+ data_page: this.data.data_page + 1
+ });
+
+ // 是否还有数据
+ if (this.data.data_page > 1 && this.data.data_page > this.data.data_page_total) {
+ this.setData({ data_bottom_line_status: true });
+ } else {
+ this.setData({ data_bottom_line_status: false });
+ }
+ } else {
+ this.setData({
+ data_list_loding_status: 0,
+ });
+ if (this.data.data_page <= 1) {
+ this.setData({
+ data_list: [],
+ data_bottom_line_status: false,
+ });
+ }
+ }
+ } else {
+ this.setData({
+ data_list_loding_status: 0
+ });
+
+ app.showToast(res.data.msg);
+ }
+ },
+ fail: () => {
+ wx.hideLoading();
+ wx.stopPullDownRefresh();
+
+ this.setData({
+ data_list_loding_status: 2
+ });
+ app.showToast("服务器请求出错");
+ }
+ });
+ }
+ },
+
+ // 下拉刷新
+ onPullDownRefresh() {
+ this.setData({
+ data_page: 1
+ });
+ this.get_data_list(1);
+ },
+
+ // 滚动加载
+ scroll_lower(e) {
+ this.get_data_list();
+ },
+
+ // 详情图片查看
+ goods_detail_images_view_event(e) {
+ var value = e.currentTarget.dataset.value || null;
+ if (value != null) {
+ wx.previewImage({
+ current: 0,
+ urls: [value]
+ });
+ }
+ },
+});
diff --git a/public/appmini/old/weixin/pages/goods-comment/goods-comment.json b/public/appmini/old/weixin/pages/goods-comment/goods-comment.json
new file mode 100644
index 0000000000000000000000000000000000000000..8835af0699ccec004cbe685ef938cd2d63ea7037
--- /dev/null
+++ b/public/appmini/old/weixin/pages/goods-comment/goods-comment.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxml b/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxml
new file mode 100644
index 0000000000000000000000000000000000000000..e33735797a845fad9088c444da76d709488d986f
--- /dev/null
+++ b/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxml
@@ -0,0 +1,42 @@
+
+
+
+ 动态评分
+ {{goods_score.avg || '0.0'}}
+
+
+
+ {item.name}}({{item.portion}}%)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxss b/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxss
new file mode 100644
index 0000000000000000000000000000000000000000..ed381922b8545a96ea2ee99f6595949490f42609
--- /dev/null
+++ b/public/appmini/old/weixin/pages/goods-comment/goods-comment.wxss
@@ -0,0 +1,86 @@
+.score-container {
+ padding: 10rpx;
+}
+.score-container .score {
+ width: 180rpx;
+ border-right: 1px solid #eee;
+}
+.score-container .score .value {
+ color: #f03726;
+ font-weight: bold;
+ font-size: 60rpx;
+ line-height: 60rpx;
+ margin-top: 10rpx;
+}
+
+.progress {
+ overflow: hidden;
+ height: 40rpx;
+ margin-top: 40rpx;
+ background-color: #f5f5f5;
+ border-radius: 0;
+ width: calc(100% - 200rpx);
+}
+.progress-bar {
+ float: left;
+ width: 0;
+ height: 100%;
+ font-size: 24rpx;
+ line-height: 40rpx;
+ color: #fff;
+ text-align: center;
+ background-color: #0e90d2;
+}
+.progress-bar-danger {
+ background-color: #dd514c;
+}
+.progress-bar-warning {
+ background-color: #F37B1D;
+}
+.progress-bar-secondary {
+ background-color: #3bb4f2;
+}
+.progress-bar-success {
+ background-color: #5eb95e;
+}
+
+
+.comment-item {
+ padding: 0 10rpx 10rpx 10rpx;
+}
+.comment-item .nav {
+ background: #eee;
+ padding: 10rpx 0;
+}
+.comment-item .avatar {
+ width: 70rpx;
+ height: 70rpx;
+ border-radius: 50%;
+ border: 1px solid #e2e2e2;
+}
+.comment-item .base-nav {
+ width: calc(100% - 90rpx);
+ line-height: 70rpx;
+}
+.comment-item .base-nav text:not(:last-child) {
+ margin-right: 5rpx;
+}
+
+.base-content {
+ padding: 10rpx;
+}
+.base-content .content, .base-content .reply {
+ line-height: 46rpx;
+ font-size: 30rpx;
+}
+.base-content .spec {
+ margin-top: 20rpx;
+ color: #B0B0B0;
+}
+.base-content .reply {
+ margin-top: 20rpx;
+ padding-top: 20rpx;
+}
+.base-content .reply-desc {
+ color: #905602;
+}
\ No newline at end of file
diff --git a/public/appmini/old/weixin/pages/goods-detail/goods-detail.js b/public/appmini/old/weixin/pages/goods-detail/goods-detail.js
index 06077dc95da1565e8c05b8259d0f658889d49bb7..4174dcfeb6a1f9c3e4abf904982bd2b2f40df6cb 100755
--- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.js
+++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.js
@@ -79,6 +79,7 @@ Page({
method: "POST",
data: {goods_id: this.data.params.goods_id},
dataType: "json",
+ header: { 'content-type': 'application/x-www-form-urlencoded' },
success: res => {
wx.stopPullDownRefresh();
wx.hideLoading();
diff --git a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxml b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxml
index 0619f743f5a699e1cceac34f294bedd17b59c83c..47aa17b691022d8dd6a0a976fb4bd850fae3b096 100755
--- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxml
+++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxml
@@ -39,7 +39,7 @@
¥{{goods.original_price}}
-
+
累计销量
{{goods.sales_count}}
@@ -47,7 +47,7 @@
浏览次数
{{goods.access_count}}
-
+
累计评论
{{goods.comments_count}}
diff --git a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss
index 7a08935cf8dd7c58498a78ad057d200969a05772..2f14d449ea2618318dee5b3e4d96e24efc28fa9a 100755
--- a/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss
+++ b/public/appmini/old/weixin/pages/goods-detail/goods-detail.wxss
@@ -210,9 +210,6 @@
.goods-base .base-grid view {
width: calc(33.33% - 1px);
}
-.goods-base .base-grid view:not(:last-child) {
- border-right: 1px solid #f5f5f5;
-}
.goods-base .base-grid view .cr-main {
padding-left: 10rpx;
}