<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 接口情況 作者:ncgis 時間:20150422 作用:獲取商品評論 提交方法:GET 提交參數 ~~~ good_id:商品id limit:每頁數量默認10[可選] page:當前頁 默認1 [可選] ~~~ 所在文件:product 接口地址:http://test.lingsq.com/index.php/api?method=lingsqapi.api.product.commentdetail&good_id=[good\_id]&limit=[limit]&page=[page] 返回數據樣式: ~~~ { "status":false, "comment_count":1, "data": [ { "author":"\u4e70\u5bb6\uff1ab****6", "time":"2015-04-22 08:56:42", "comment":"\u5f88\u597d\u6211\u6536\u5230\u8d27\u4e86", "items": [ {"author":"b****6","time":"2015-04-22 08:57:35","comment":"\u4e0d\u9519\u54e6"} ] } ], "goods_point": { "avg_num":"5.00", "avg":5, "count":"1" } } ~~~ 數據說明 ~~~ status:用戶登錄狀態 comment_count:評論數量 author:評論用戶 time:評論時間 comment:評論 items:追加評論項 avg_num:平均數 avg:(不曉得和上面的有什么區別) count:評論總數 ~~~ ## 實現代碼 ~~~ public function commentdetail() { if(empty($_GET["good_id"])) { $back["errNo"]=20005; $back["errMsg"]=$this->errMsg($back["errNo"]); return $back; } $page=empty($_GET["page"])?1:$_GET["page"]; $limit=$_GET["limit"]; $page = intval($page); $gid = intval($_GET["good_id"]); $limit = $limit?intval($limit):10; $offset = ($page-1)*$limit; $aData = array(); $aData['status'] = $this->member_id?true:false; $objComment = &app::get('b2c')->model('member_comments'); $filter = array('type_id'=>$gid,'object_type'=>'discuss','for_comment_id'=>0,'display'=>'true','comments_type'=>'1','comment|noequal'=>'','comment|noequal'=>null); $aData['comment_count'] = $objComment->count($filter); $sql = " select c.comment_id,c.author,c.time,c.comment,c.addon,c.author_id,m.name as author_alias from sdb_b2c_member_comments as c left join sdb_b2c_members as m on c.author_id=m.member_id left join sdb_b2c_order_items as i on c.order_id=i.order_id and c.type_id=i.goods_id where c.object_type='discuss' and c.for_comment_id=0 and c.type_id=".intval($gid)." and c.display='true' and c.comments_type='1' and c.comment is not null and c.comment != '' group by comment_id,i.goods_id order by time desc limit {$offset},{$limit}"; $aData['data'] = array(); $aId = array(); foreach((array)$objComment->db->select($sql) as $val){ $val['addon'] = unserialize($val['addon']); if(!empty($val['author_alias'])) $val['author'] = $val['author_alias']; if(isset($val['addon']['hidden_name']) && $val['addon']['hidden_name'] == 'YES' && ($val['author_id'] !=0 || $val['author_id'] !=1)){ $val['author'] = mb_substr($val['author'], 0, 1, 'UTF-8').'****'.mb_substr($val['author'], mb_strlen($string, 'UTF-8')-1, 1, 'UTF-8'); } $val['author'] = '買家:'.$val['author']; $val['time'] = date('Y-m-d H:i:s',$val['time']); $aId[] = $val['comment_id']; unset($val['author_alias'],$val['author_id'],$val['addon']); $aData['data'][] = $val; } if(!empty($aId)){ $addition = array(); $temp = $objComment->getList('comment_id,for_comment_id',array('for_comment_id' => $aId,'comments_type'=>'3','display' => 'true')); foreach((array)$temp as $rows){ $aId[] = $rows['comment_id']; $addition[$rows['for_comment_id']][] = $rows['comment_id']; } $aReply = (array)kernel::single('business_message_disask')->getCommentsReply($aId, true); foreach((array)$aData['data'] as $key => $rows){ foreach($aReply as $rkey => $rrows){ $condition1 = $rows['comment_id'] == $rrows['for_comment_id']; $condition2 = !empty($addition) && isset($addition[$rows['comment_id']]) && in_array($rrows['for_comment_id'],$addition[$rows['comment_id']]); if($condition1 || $condition2){ $aData['data'][$key]['items'][] = array( 'author' => ($aReply[$rkey]['comments_type']==0&&$aReply[$rkey]['author']!='管理員')?'掌柜':$aReply[$rkey]['author'], 'time' => date('Y-m-d H:i:s',$aReply[$rkey]['time']), 'comment' => $aReply[$rkey]['comment'], ); } } unset($aData['data'][$key]['comment_id']); } } $args = array($gid,$page); $objGoods = app::get('b2c')->model('goods'); $objPoint = app::get('business')->model('comment_goods_point'); $aGoods_list = $objGoods->getRow('avg_point,comments_count',array('goods_id'=>$gid,'store_id|than'=>0)); $aData['goods_point'] = array('avg_num'=>$aGoods_list['avg_point'],'avg'=>$objPoint->star_class($aGoods_list['avg_point']),'count'=>$aGoods_list['comments_count']); return $aData; } ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看