添加商品咨询页面中常见问题的数据获取接口
Code Review By Rock Zhang
Showing
3 changed files
with
51 additions
and
0 deletions
@@ -88,6 +88,20 @@ class DetailData | @@ -88,6 +88,20 @@ class DetailData | ||
88 | } | 88 | } |
89 | 89 | ||
90 | /** | 90 | /** |
91 | + * 常见问题列表 | ||
92 | + * | ||
93 | + * @return array | ||
94 | + */ | ||
95 | + public static function commonConsultList() | ||
96 | + { | ||
97 | + $param = Yohobuy::param(); | ||
98 | + $param['method'] = 'app.consult.common'; | ||
99 | + $param['client_secret'] = Sign::getSign($param); | ||
100 | + | ||
101 | + return Yohobuy::get(Yohobuy::API_URL, $param); | ||
102 | + } | ||
103 | + | ||
104 | + /** | ||
91 | * 评论内容列表 | 105 | * 评论内容列表 |
92 | * | 106 | * |
93 | * @param int $productId 产品ID | 107 | * @param int $productId 产品ID |
@@ -584,6 +584,24 @@ class DetailModel | @@ -584,6 +584,24 @@ class DetailModel | ||
584 | } | 584 | } |
585 | 585 | ||
586 | /** | 586 | /** |
587 | + * 获取常见问题列表 | ||
588 | + * | ||
589 | + * @return array | ||
590 | + */ | ||
591 | + public static function getCommonConsults() | ||
592 | + { | ||
593 | + $result = array(); | ||
594 | + | ||
595 | + $consults = DetailData::commonConsultList(); | ||
596 | + if (isset($consults['code']) && $consults['code'] === 200) { | ||
597 | + $result['commonConsults'] = $consults['data']; | ||
598 | + $consults = array(); | ||
599 | + } | ||
600 | + | ||
601 | + return $result; | ||
602 | + } | ||
603 | + | ||
604 | + /** | ||
587 | * 咨询点赞 | 605 | * 咨询点赞 |
588 | * | 606 | * |
589 | * @param int $uid 用户ID | 607 | * @param int $uid 用户ID |
@@ -167,6 +167,25 @@ class DetailController extends AbstractAction | @@ -167,6 +167,25 @@ class DetailController extends AbstractAction | ||
167 | } | 167 | } |
168 | 168 | ||
169 | /* | 169 | /* |
170 | + * 异步获取咨询常见问题 | ||
171 | + */ | ||
172 | + public function commonconsultsAction() | ||
173 | + { | ||
174 | + $result = array(); | ||
175 | + | ||
176 | + if ($this->isAjax()) { | ||
177 | + $result = \Product\DetailModel::getCommonConsults(); | ||
178 | + } | ||
179 | + | ||
180 | + if (empty($result)) { | ||
181 | + echo ' '; | ||
182 | + } else { | ||
183 | + print_r($result); | ||
184 | + $this->_view->display('common-consults', $result); | ||
185 | + } | ||
186 | + } | ||
187 | + | ||
188 | + /* | ||
170 | * 咨询点赞 | 189 | * 咨询点赞 |
171 | */ | 190 | */ |
172 | public function consultupvoteAction() | 191 | public function consultupvoteAction() |
-
Please register or login to post a comment