作者 郭盛
1 个管道 的构建 通过 耗费 0 秒

修改商品评价

@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 <project version="4"> 2 <project version="4">
3 <component name="ChangeListManager"> 3 <component name="ChangeListManager">
4 <list default="true" id="0011664b-87e9-41bd-9f37-18792fb15777" name="Default" comment=""> 4 <list default="true" id="0011664b-87e9-41bd-9f37-18792fb15777" name="Default" comment="">
  5 + <change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
5 <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" afterPath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" /> 6 <change type="MODIFICATION" beforePath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" afterPath="$PROJECT_DIR$/api/index/controller/ShopgoodsController.php" />
6 </list> 7 </list>
7 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> 8 <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -72,8 +73,8 @@ @@ -72,8 +73,8 @@
72 <file leaf-file-name="ShopgoodsController.php" pinned="false" current-in-tab="true"> 73 <file leaf-file-name="ShopgoodsController.php" pinned="false" current-in-tab="true">
73 <entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php"> 74 <entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php">
74 <provider selected="true" editor-type-id="text-editor"> 75 <provider selected="true" editor-type-id="text-editor">
75 - <state relative-caret-position="327">  
76 - <caret line="115" column="25" lean-forward="true" selection-start-line="115" selection-start-column="25" selection-end-line="115" selection-end-column="25" /> 76 + <state relative-caret-position="232">
  77 + <caret line="270" column="0" lean-forward="true" selection-start-line="270" selection-start-column="0" selection-end-line="270" selection-end-column="0" />
77 <folding> 78 <folding>
78 <element signature="e#411#604#0#PHP" expanded="false" /> 79 <element signature="e#411#604#0#PHP" expanded="false" />
79 <element signature="e#609#825#0#PHP" expanded="false" /> 80 <element signature="e#609#825#0#PHP" expanded="false" />
@@ -81,37 +82,28 @@ @@ -81,37 +82,28 @@
81 <element signature="e#1334#2102#0#PHP" expanded="false" /> 82 <element signature="e#1334#2102#0#PHP" expanded="false" />
82 <element signature="e#2108#2326#0#PHP" expanded="false" /> 83 <element signature="e#2108#2326#0#PHP" expanded="false" />
83 <element signature="e#2331#2539#0#PHP" expanded="false" /> 84 <element signature="e#2331#2539#0#PHP" expanded="false" />
  85 + <element signature="e#2545#3052#0#PHP" expanded="false" />
  86 + <element signature="e#3057#3575#0#PHP" expanded="false" />
84 <element signature="e#3581#4093#0#PHP" expanded="false" /> 87 <element signature="e#3581#4093#0#PHP" expanded="false" />
85 <element signature="e#4098#4661#0#PHP" expanded="false" /> 88 <element signature="e#4098#4661#0#PHP" expanded="false" />
86 - <element signature="e#4667#5164#0#PHP" expanded="false" />  
87 - <element signature="e#5169#6009#0#PHP" expanded="false" />  
88 - <element signature="e#6015#6333#0#PHP" expanded="false" />  
89 - <element signature="e#6338#6714#0#PHP" expanded="false" />  
90 - <element signature="e#6720#7075#0#PHP" expanded="false" />  
91 - <element signature="e#7080#7489#0#PHP" expanded="false" />  
92 - <element signature="e#7495#7880#0#PHP" expanded="false" />  
93 - <element signature="e#7885#8556#0#PHP" expanded="false" />  
94 - <element signature="e#8562#9008#0#PHP" expanded="false" />  
95 - <element signature="e#9013#9864#0#PHP" expanded="false" />  
96 - <element signature="e#9870#10140#0#PHP" expanded="false" />  
97 - <element signature="e#10145#10621#0#PHP" expanded="false" />  
98 - <element signature="e#10627#11187#0#PHP" expanded="false" />  
99 - <element signature="e#11192#12019#0#PHP" expanded="false" /> 89 + <element signature="e#5262#6260#0#PHP" expanded="false" />
  90 + <element signature="e#6266#6584#0#PHP" expanded="false" />
  91 + <element signature="e#6589#6965#0#PHP" expanded="false" />
  92 + <element signature="e#6971#7326#0#PHP" expanded="false" />
  93 + <element signature="e#7331#7740#0#PHP" expanded="false" />
  94 + <element signature="e#7746#8131#0#PHP" expanded="false" />
  95 + <element signature="e#8136#8807#0#PHP" expanded="false" />
  96 + <element signature="e#8813#9259#0#PHP" expanded="false" />
  97 + <element signature="e#9264#10115#0#PHP" expanded="false" />
  98 + <element signature="e#10121#10391#0#PHP" expanded="false" />
  99 + <element signature="e#10396#10872#0#PHP" expanded="false" />
  100 + <element signature="e#10878#11438#0#PHP" expanded="false" />
  101 + <element signature="e#11443#12270#0#PHP" expanded="false" />
100 </folding> 102 </folding>
101 </state> 103 </state>
102 </provider> 104 </provider>
103 </entry> 105 </entry>
104 </file> 106 </file>
105 - <file leaf-file-name="ShopgoodsModel.php" pinned="false" current-in-tab="false">  
106 - <entry file="file://$PROJECT_DIR$/api/index/model/ShopgoodsModel.php">  
107 - <provider selected="true" editor-type-id="text-editor">  
108 - <state relative-caret-position="381">  
109 - <caret line="30" column="9" lean-forward="true" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" />  
110 - <folding />  
111 - </state>  
112 - </provider>  
113 - </entry>  
114 - </file>  
115 <file leaf-file-name="RestBaseController.php" pinned="false" current-in-tab="false"> 107 <file leaf-file-name="RestBaseController.php" pinned="false" current-in-tab="false">
116 <entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php"> 108 <entry file="file://$PROJECT_DIR$/simplewind/cmf/controller/RestBaseController.php">
117 <provider selected="true" editor-type-id="text-editor"> 109 <provider selected="true" editor-type-id="text-editor">
@@ -231,8 +223,8 @@ @@ -231,8 +223,8 @@
231 </component> 223 </component>
232 <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" /> 224 <component name="PhpWorkspaceProjectConfiguration" backward_compatibility_performed="true" />
233 <component name="ProjectFrameBounds"> 225 <component name="ProjectFrameBounds">
234 - <option name="x" value="292" />  
235 - <option name="y" value="65" /> 226 + <option name="x" value="345" />
  227 + <option name="y" value="54" />
236 <option name="width" value="1582" /> 228 <option name="width" value="1582" />
237 <option name="height" value="969" /> 229 <option name="height" value="969" />
238 </component> 230 </component>
@@ -374,15 +366,15 @@ @@ -374,15 +366,15 @@
374 <workItem from="1575016153150" duration="3315000" /> 366 <workItem from="1575016153150" duration="3315000" />
375 <workItem from="1575246616478" duration="21722000" /> 367 <workItem from="1575246616478" duration="21722000" />
376 <workItem from="1575278769037" duration="7395000" /> 368 <workItem from="1575278769037" duration="7395000" />
377 - <workItem from="1575332430854" duration="2151000" /> 369 + <workItem from="1575332430854" duration="3225000" />
378 </task> 370 </task>
379 <servers /> 371 <servers />
380 </component> 372 </component>
381 <component name="TimeTrackingManager"> 373 <component name="TimeTrackingManager">
382 - <option name="totallyTimeSpent" value="412609000" /> 374 + <option name="totallyTimeSpent" value="413683000" />
383 </component> 375 </component>
384 <component name="ToolWindowManager"> 376 <component name="ToolWindowManager">
385 - <frame x="292" y="65" width="1582" height="969" extended-state="0" /> 377 + <frame x="345" y="54" width="1582" height="969" extended-state="0" />
386 <editor active="true" /> 378 <editor active="true" />
387 <layout> 379 <layout>
388 <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19513798" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> 380 <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.19513798" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
@@ -824,16 +816,16 @@ @@ -824,16 +816,16 @@
824 </entry> 816 </entry>
825 <entry file="file://$PROJECT_DIR$/api/index/model/ShopgoodsModel.php"> 817 <entry file="file://$PROJECT_DIR$/api/index/model/ShopgoodsModel.php">
826 <provider selected="true" editor-type-id="text-editor"> 818 <provider selected="true" editor-type-id="text-editor">
827 - <state relative-caret-position="381">  
828 - <caret line="30" column="9" lean-forward="true" selection-start-line="30" selection-start-column="9" selection-end-line="30" selection-end-column="9" /> 819 + <state relative-caret-position="106">
  820 + <caret line="13" column="34" lean-forward="true" selection-start-line="13" selection-start-column="34" selection-end-line="13" selection-end-column="34" />
829 <folding /> 821 <folding />
830 </state> 822 </state>
831 </provider> 823 </provider>
832 </entry> 824 </entry>
833 <entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php"> 825 <entry file="file://$PROJECT_DIR$/api/index/controller/ShopgoodsController.php">
834 <provider selected="true" editor-type-id="text-editor"> 826 <provider selected="true" editor-type-id="text-editor">
835 - <state relative-caret-position="327">  
836 - <caret line="115" column="25" lean-forward="true" selection-start-line="115" selection-start-column="25" selection-end-line="115" selection-end-column="25" /> 827 + <state relative-caret-position="232">
  828 + <caret line="270" column="0" lean-forward="true" selection-start-line="270" selection-start-column="0" selection-end-line="270" selection-end-column="0" />
837 <folding> 829 <folding>
838 <element signature="e#411#604#0#PHP" expanded="false" /> 830 <element signature="e#411#604#0#PHP" expanded="false" />
839 <element signature="e#609#825#0#PHP" expanded="false" /> 831 <element signature="e#609#825#0#PHP" expanded="false" />
@@ -841,22 +833,23 @@ @@ -841,22 +833,23 @@
841 <element signature="e#1334#2102#0#PHP" expanded="false" /> 833 <element signature="e#1334#2102#0#PHP" expanded="false" />
842 <element signature="e#2108#2326#0#PHP" expanded="false" /> 834 <element signature="e#2108#2326#0#PHP" expanded="false" />
843 <element signature="e#2331#2539#0#PHP" expanded="false" /> 835 <element signature="e#2331#2539#0#PHP" expanded="false" />
  836 + <element signature="e#2545#3052#0#PHP" expanded="false" />
  837 + <element signature="e#3057#3575#0#PHP" expanded="false" />
844 <element signature="e#3581#4093#0#PHP" expanded="false" /> 838 <element signature="e#3581#4093#0#PHP" expanded="false" />
845 <element signature="e#4098#4661#0#PHP" expanded="false" /> 839 <element signature="e#4098#4661#0#PHP" expanded="false" />
846 - <element signature="e#4667#5164#0#PHP" expanded="false" />  
847 - <element signature="e#5169#6009#0#PHP" expanded="false" />  
848 - <element signature="e#6015#6333#0#PHP" expanded="false" />  
849 - <element signature="e#6338#6714#0#PHP" expanded="false" />  
850 - <element signature="e#6720#7075#0#PHP" expanded="false" />  
851 - <element signature="e#7080#7489#0#PHP" expanded="false" />  
852 - <element signature="e#7495#7880#0#PHP" expanded="false" />  
853 - <element signature="e#7885#8556#0#PHP" expanded="false" />  
854 - <element signature="e#8562#9008#0#PHP" expanded="false" />  
855 - <element signature="e#9013#9864#0#PHP" expanded="false" />  
856 - <element signature="e#9870#10140#0#PHP" expanded="false" />  
857 - <element signature="e#10145#10621#0#PHP" expanded="false" />  
858 - <element signature="e#10627#11187#0#PHP" expanded="false" />  
859 - <element signature="e#11192#12019#0#PHP" expanded="false" /> 840 + <element signature="e#5262#6260#0#PHP" expanded="false" />
  841 + <element signature="e#6266#6584#0#PHP" expanded="false" />
  842 + <element signature="e#6589#6965#0#PHP" expanded="false" />
  843 + <element signature="e#6971#7326#0#PHP" expanded="false" />
  844 + <element signature="e#7331#7740#0#PHP" expanded="false" />
  845 + <element signature="e#7746#8131#0#PHP" expanded="false" />
  846 + <element signature="e#8136#8807#0#PHP" expanded="false" />
  847 + <element signature="e#8813#9259#0#PHP" expanded="false" />
  848 + <element signature="e#9264#10115#0#PHP" expanded="false" />
  849 + <element signature="e#10121#10391#0#PHP" expanded="false" />
  850 + <element signature="e#10396#10872#0#PHP" expanded="false" />
  851 + <element signature="e#10878#11438#0#PHP" expanded="false" />
  852 + <element signature="e#11443#12270#0#PHP" expanded="false" />
860 </folding> 853 </folding>
861 </state> 854 </state>
862 </provider> 855 </provider>
@@ -172,6 +172,8 @@ class ShopgoodsController extends RestBaseController @@ -172,6 +172,8 @@ class ShopgoodsController extends RestBaseController
172 * @url /index/Shopgoods/comment 172 * @url /index/Shopgoods/comment
173 * @method GET 173 * @method GET
174 * 174 *
  175 + * @header name:XX-Token require:1 default: desc:token
  176 + *
175 * @param name:shopgood_id type:int require:1 other: desc:商品id 177 * @param name:shopgood_id type:int require:1 other: desc:商品id
176 * @param name:page type:int require:0 other: desc:当前页(默认1) 178 * @param name:page type:int require:0 other: desc:当前页(默认1)
177 * @param name:pageNum type:int require:0 other: desc:每页显示数据个数(默认10) 179 * @param name:pageNum type:int require:0 other: desc:每页显示数据个数(默认10)
@@ -179,12 +181,14 @@ class ShopgoodsController extends RestBaseController @@ -179,12 +181,14 @@ class ShopgoodsController extends RestBaseController
179 * @return id:评价id 181 * @return id:评价id
180 * @return user_id:用户ID 182 * @return user_id:用户ID
181 * @return user_nickname:用户名 183 * @return user_nickname:用户名
  184 + * @return avatar:用户头像
182 * @return num:评价星数 185 * @return num:评价星数
183 * @return content:评价内容 186 * @return content:评价内容
184 * 187 *
185 */ 188 */
186 public function comment() 189 public function comment()
187 { 190 {
  191 + $user_id = $this->getUserId();
188 $goods_id = $this->request->param('shopgood_id',0,'intval'); 192 $goods_id = $this->request->param('shopgood_id',0,'intval');
189 if(empty($goods_id)){ 193 if(empty($goods_id)){
190 $this -> error(['code'=>40005,'msg'=>'缺少必要参数']); 194 $this -> error(['code'=>40005,'msg'=>'缺少必要参数']);
@@ -194,12 +198,13 @@ class ShopgoodsController extends RestBaseController @@ -194,12 +198,13 @@ class ShopgoodsController extends RestBaseController
194 $res = Db::name('shopcomment') 198 $res = Db::name('shopcomment')
195 ->alias('a') 199 ->alias('a')
196 ->join('user b','a.user_id = b.id') 200 ->join('user b','a.user_id = b.id')
197 - ->field('a.*,b.user_nickname') 201 + ->field('a.*,b.user_nickname,b.avatar')
198 ->where('shopgood_id',$goods_id) 202 ->where('shopgood_id',$goods_id)
199 ->page($page,$pageNum) 203 ->page($page,$pageNum)
200 ->select() 204 ->select()
201 ->toArray(); 205 ->toArray();
202 foreach ($res as &$v){ 206 foreach ($res as &$v){
  207 + $v['content'] = strip_tags(cmf_replace_content_file_url(htmlspecialchars_decode($v['content'])));
203 $v['num'] = ceil(($v['speed']+$v['service']+$v['recycle'])/3); 208 $v['num'] = ceil(($v['speed']+$v['service']+$v['recycle'])/3);
204 $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']); 209 $v['create_time'] = date('Y-m-d H:i:s',$v['create_time']);
205 } 210 }