123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?php
- namespace app\api\controller;
- use think\facade\Lang;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 店铺评论控制器
- */
- class Sellerevaluate extends MobileSeller
- {
- public function initialize()
- {
- parent::initialize();
- Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/memberevaluate.lang.php');
- }
- /**
- * @api {POST} api/Sellerevaluate/evaluate_list 评价列表
- * @apiVersion 1.0.0
- * @apiGroup Sellerevaluate
- *
- * @apiHeader {String} X-DS-KEY 卖家授权token
- *
- * @apiParam {String} goods_name 商品名称
- * @apiParam {String} member_name 会员名称
- * @apiParam {String} page 页码
- * @apiParam {String} pagesize 每页显示数量
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- * @apiSuccess {Object[]} result.goodsevallist 评论列表 (返回字段参考evaluategoods表)
- * @apiSuccess {String} result.goodsevallist.geval_goodsimage_url 商品图片完整路径
- * @apiSuccess {Int} result.page_total 总页数
- * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
- */
- public function evaluate_list()
- {
- $evaluategoods_model = model('evaluategoods');
- $condition = array();
- $goods_name = input('param.goods_name');
- if (!empty($goods_name)) {
- $condition[] = array('geval_goodsname', 'like', '%' . $goods_name . '%');
- }
- $member_name = input('param.member_name');
- if (!empty($member_name)) {
- $condition[] = array('geval_frommembername', 'like', '%' . $member_name . '%');
- }
- $condition[] = array('geval_storeid', '=', $this->store_info['store_id']);
- $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, 5, 'geval_id desc');
- foreach ($goodsevallist as $key => $val) {
- $goodsevallist[$key]['geval_goodsimage_url'] = goods_cthumb($val['geval_goodsimage']);
- }
- $result = array_merge(array('goodsevallist' => $goodsevallist), mobile_page($evaluategoods_model->page_info));
- ds_json_encode(10000, '', $result);
- }
- /**
- * @api {POST} api/Sellerevaluate/explain_save 解释来自买家的评价
- * @apiVersion 1.0.0
- * @apiGroup Sellerevaluate
- *
- * @apiHeader {String} X-DS-KEY 卖家授权token
- *
- * @apiParam {Int} geval_id 评论ID
- * @apiParam {String} geval_explain 解释
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- */
- public function explain_save()
- {
- $geval_id = intval(input('post.geval_id'));
- $geval_explain = trim(input('post.geval_explain'));
- //验证表单
- if (!$geval_explain) {
- ds_json_encode(10001, lang('member_evaluation_explain_nullerror'));
- }
- $data = array();
- $data['result'] = true;
- $evaluategoods_model = model('evaluategoods');
- $evaluate_info = $evaluategoods_model->getEvaluategoodsInfoByID($geval_id, $this->store_info['store_id']);
- if (empty($evaluate_info)) {
- ds_json_encode(10001, lang('param_error'));
- }
- $update = array('geval_explain' => $geval_explain);
- $condition = array('geval_id' => $geval_id);
- $result = $evaluategoods_model->editEvaluategoods($update, $condition);
- if ($result) {
- ds_json_encode(10000, lang('ds_common_op_succ'));
- } else {
- ds_json_encode(10001, lang('ds_common_op_fail'));
- }
- }
- }
|