|
@@ -9,9 +9,12 @@
|
|
|
|
|
|
require_once (BASE_ROOT_PATH . "/helper/goods_helper.php");
|
|
|
require_once (BASE_ROOT_PATH . "/helper/activity_helper.php");
|
|
|
+require_once (BASE_ROOT_PATH . '/helper/special_helper.php');
|
|
|
|
|
|
class goods_commonControl extends mobileControl
|
|
|
{
|
|
|
+ const pic_path = '/data/upload/shop/member';
|
|
|
+
|
|
|
public function __construct()
|
|
|
{
|
|
|
parent::__construct();
|
|
@@ -41,6 +44,68 @@ class goods_commonControl extends mobileControl
|
|
|
return self::outerr(errcode::ErrParamter,"请输入正确的参数.");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ private function format_image($member_id,$image)
|
|
|
+ {
|
|
|
+ $images = explode(',',$image);
|
|
|
+ if(empty($images)) {
|
|
|
+ return array();
|
|
|
+ }
|
|
|
+
|
|
|
+ $result = [];
|
|
|
+ foreach ($images as $img) {
|
|
|
+ $path = BASE_SITE_URL . self::pic_path . "/{$member_id}/" . $img;
|
|
|
+ $result[] = $path;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $result;
|
|
|
+ }
|
|
|
+
|
|
|
+ private function format_comment($items)
|
|
|
+ {
|
|
|
+ $blocks = special_helper::format_comments($items);
|
|
|
+ $comments = [];
|
|
|
+ foreach ($items as $item)
|
|
|
+ {
|
|
|
+ $val['geval_id'] = intval($item['geval_id']);
|
|
|
+ $val['order_id'] = intval($item['geval_orderid']);
|
|
|
+ $val['order_sn'] = $item['geval_orderno'];
|
|
|
+ $val['goods_id'] = intval($item['geval_goodsid']);
|
|
|
+ $val['goods_name'] = $item['geval_goodsname'];
|
|
|
+ $val['goodsprice'] = doubleval($item['geval_goodsprice']);
|
|
|
+ $val['goodsimage'] = $item['geval_goodsimage'];
|
|
|
+ $val['scores'] = $item['geval_scores'];
|
|
|
+ $val['anonymous'] = $item['geval_isanonymous'];
|
|
|
+
|
|
|
+ $val['addtime'] = intval($item['geval_addtime']);
|
|
|
+ $val['storeid'] = intval($item['geval_storeid']);
|
|
|
+ $val['storename'] = $item['geval_storename'];
|
|
|
+ $member_id = intval($item['geval_frommemberid']);
|
|
|
+
|
|
|
+ $val['frommemberid'] = $member_id;
|
|
|
+ $val['frommembername'] = $item['geval_frommembername'];
|
|
|
+ $val['remark'] = $item['geval_remark'];
|
|
|
+ $val['images'] = $this->format_image($member_id,$item['geval_image']);
|
|
|
+
|
|
|
+ $comments[] = $val;
|
|
|
+ }
|
|
|
+
|
|
|
+ return array('blocks' => $blocks,'comments' => $comments);
|
|
|
+ }
|
|
|
+
|
|
|
+ public function commentsOp()
|
|
|
+ {
|
|
|
+ $common_id = intval($_GET['goods_commonid']);
|
|
|
+ if($common_id <= 0) {
|
|
|
+ return self::outerr(errcode::ErrParamter,"参数信息错误");
|
|
|
+ }
|
|
|
+ $mod_eva = Model('evaluate_goods');
|
|
|
+ $items = $mod_eva->getEvaluateGoodsList(array('geval_commonid' => $common_id),$this->page_size());
|
|
|
+ $page_count = $mod_eva->gettotalpage();
|
|
|
+ $result = $this->format_comment($items);
|
|
|
+
|
|
|
+ return self::outsuccess(array('comments' => $result,'mobile_page' =>mobile_page($page_count)));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class tpl_detail
|