123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291 |
- <?php
- namespace app\api\controller;
- /**
-
- *
-
- *
- * ----------------------------------------------------------------------------
- *
-
- * 评论制器
- */
- class Memberevaluate extends MobileMember
- {
- public function initialize()
- {
- parent::initialize(); // TODO: Change the autogenerated stub
- }
- /**
- * @api {POST} api/Memberevaluate/get_goodsevallist 获取当前用户的所有商品评论列表
- * @apiVersion 1.0.0
- * @apiGroup Memberevaluate
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {String} per_page 每页显示数量
- * @apiParam {String} page 当前页数
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- * @apiSuccess {Object[]} result.goodsevallist 评论列表
- * @apiSuccess {Int} result.goodsevallist.geval_addtime 评论时间
- * @apiSuccess {Int} result.goodsevallist.geval_content 评论内容
- * @apiSuccess {Int} result.goodsevallist.geval_explain 评论回复
- * @apiSuccess {Int} result.goodsevallist.geval_frommemberid 评论用户ID
- * @apiSuccess {Int} result.goodsevallist.geval_frommembername 评论用户名称
- * @apiSuccess {Int} result.goodsevallist.geval_goodsid 评论商品ID
- * @apiSuccess {Int} result.goodsevallist.geval_goodsimage 评论商品图片
- * @apiSuccess {Int} result.goodsevallist.geval_goodsname 评论商品名称
- * @apiSuccess {Int} result.goodsevallist.geval_goodsprice 评论商品价格
- * @apiSuccess {Int} result.goodsevallist.geval_id 评论ID
- * @apiSuccess {Int} result.goodsevallist.geval_image 评论晒图
- * @apiSuccess {Int} result.goodsevallist.geval_isanonymous 是否匿名 0否1是
- * @apiSuccess {Int} result.goodsevallist.geval_ordergoodsid 订单商品ID
- * @apiSuccess {Int} result.goodsevallist.geval_orderid 订单ID
- * @apiSuccess {Int} result.goodsevallist.geval_orderno 订单编号
- * @apiSuccess {Int} result.goodsevallist.geval_remark 管理员对评价的处理备注
- * @apiSuccess {Int} result.goodsevallist.geval_scores 评分
- * @apiSuccess {Int} result.goodsevallist.geval_state 评论状态 0为正常 1为禁止显示
- * @apiSuccess {Int} result.goodsevallist.geval_storeid 店铺ID
- * @apiSuccess {Int} result.goodsevallist.geval_storename 店铺名称
- * @apiSuccess {Int} result.page_total 总页数
- * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
- */
- public function get_goodsevallist()
- {
- $evaluategoods_model = model('evaluategoods');
- $condition = array();
- $condition[] = array('geval_frommemberid', '=', $this->member_info['member_id']);
- $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, 5, 'geval_id desc');
- foreach ($goodsevallist as $key => $goodseval) {
- $goodsevallist[$key]['geval_goodsimage'] = goods_cthumb($goodseval['geval_goodsimage'], 240);
- }
- $result = array_merge(array('goodsevallist' => $goodsevallist), mobile_page($evaluategoods_model->page_info));
- ds_json_encode(10000, lang('ds_common_op_succ'), $result);
- }
- /**
- * @api {POST} api/Memberevaluate/save 评论列表
- * @apiVersion 1.0.0
- * @apiGroup Memberevaluate
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {Int} order_id 订单号
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- * @apiSuccess {Object[]} result.order_goods 订单商品列表
- * @apiSuccess {Int} result.order_goods.buyer_id 买家ID
- * @apiSuccess {Int} result.order_goods.commis_rate 佣金比例
- * @apiSuccess {Int} result.order_goods.gc_id 分类ID
- * @apiSuccess {Int} result.order_goods.goods_id 商品ID
- * @apiSuccess {String} result.order_goods.goods_image 商品图片名称
- * @apiSuccess {String} result.order_goods.goods_image_url 商品图片完整路径
- * @apiSuccess {Int} result.order_goods.goods_name 商品名称
- * @apiSuccess {Int} result.order_goods.goods_num 购买数量
- * @apiSuccess {Float} result.order_goods.goods_pay_price 实际支付金额
- * @apiSuccess {Float} result.order_goods.goods_price 商品价格
- * @apiSuccess {Int} result.order_goods.goods_type 商品类别 1默认2抢购商品3秒杀商品4组合套装5赠品6拼团7会员等级折扣
- * @apiSuccess {Int} result.order_goods.order_id 订单ID
- * @apiSuccess {Int} result.order_goods.promotions_id 促销ID
- * @apiSuccess {Int} result.order_goods.rec_id 订单商品ID
- * @apiSuccess {Int} result.order_goods.store_id 店铺ID
- * @apiSuccess {Object} result.store_info 店铺信息
- * @apiSuccess {Int} result.store_info.is_platform_store 是否自营店铺 0否1是
- * @apiSuccess {Int} result.store_info.store_id 店铺ID
- * @apiSuccess {String} result.store_info.store_name 店铺名称
- */
- public function index()
- {
- $order_id = intval(input('param.order_id'));
- $return = model('memberevaluate', 'logic')->validation($order_id, $this->member_info['member_id']);
- if (isset($return['state'])) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- $store = array();
- $store['store_id'] = $store_info['store_id'];
- $store['store_name'] = $store_info['store_name'];
- $store['is_platform_store'] = $store_info['is_platform_store'];
- ds_json_encode(10000, '', array('store_info' => $store, 'order_goods' => $order_goods));
- }
- /**
- * @api {POST} api/Memberevaluate/save 评论保存
- * @apiVersion 1.0.0
- * @apiGroup Memberevaluate
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {Int} order_id 订单号
- * @apiParam {Array} goods 订单商品rec_id为键的含score商品评分、comment评论、evaluate_image晒图、anony匿名的对象数组
- * @apiParam {Int} store_desccredit 店铺描述评分
- * @apiParam {Int} store_servicecredit 店铺服务评分
- * @apiParam {Int} store_deliverycredit 店铺配送评分
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- */
- public function save()
- {
- $order_id = intval(input('post.order_id'));
- $return = model('memberevaluate', 'logic')->validation($order_id, $this->member_info['member_id']);
- if (isset($return['state'])) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- $return = model('memberevaluate', 'logic')->saveorderevaluate($order_info, $store_info, $order_goods, $this->member_info['member_id'], $this->member_info['member_name']);
- if ($return == true) {
- ds_json_encode(10000, lang('ds_common_op_succ'));
- } else {
- ds_json_encode(10001, lang('ds_common_op_fail'));
- }
- }
- /**
- * 追评
- */
- public function again()
- {
- $order_id = intval(input('param.order_id'));
- $return = model('memberevaluate', 'logic')->validationAgain($order_id, $this->member_info['member_id']);
- if (!$return['state']) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- $store = array();
- $store['store_id'] = $store_info['store_id'];
- $store['store_name'] = $store_info['store_name'];
- $store['is_platform_store'] = $store_info['is_platform_store'];
- ds_json_encode(10000, '', array('store_info' => $store, 'evaluate_goods' => $evaluate_goods));
- }
- /**
- * 追加评价保存
- */
- public function save_again()
- {
- $order_id = intval(input('post.order_id'));
- $return = model('memberevaluate', 'logic')->validationAgain($order_id, $this->member_info['member_id']);
- if (!$return['state']) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- $return = model('memberevaluate', 'logic')->saveAgain(input('post.'), $order_info, $evaluate_goods);
- if (!$return['state']) {
- ds_json_encode(10000, '', $return['msg']);
- } else {
- ds_json_encode(10001, lang('ds_common_op_fail'));
- }
- }
- /**
- * @api {POST} api/Memberevaluate/vr 虚拟订单评价
- * @apiVersion 1.0.0
- * @apiGroup Memberevaluate
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {Int} order_id 订单号
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- * @apiSuccess {Object} result 返回数据
- * @apiSuccess {Object} result.order_info 订单信息
- * @apiSuccess {Int} result.order_info.add_time 下单时间
- * @apiSuccess {Int} result.order_info.buyer_id 买家ID
- * @apiSuccess {String} result.order_info.buyer_msg 订单留言
- * @apiSuccess {String} result.order_info.buyer_name 买家用户名
- * @apiSuccess {String} result.order_info.buyer_phone 接收手机号
- * @apiSuccess {String} result.order_info.close_reason 虚拟订单关闭原因
- * @apiSuccess {Int} result.order_info.close_time 关闭时间
- * @apiSuccess {Int} result.order_info.commis_rate 佣金比例
- * @apiSuccess {Int} result.order_info.delete_state 删除状态 0:未删除1:放入回收站2:彻底删除
- * @apiSuccess {Boolean} result.order_info.evaluate_able 是否可评 true是false否
- * @apiSuccess {Int} result.order_info.evaluation_state 评论状态 0:默认 1:已评价 2:禁止评价
- * @apiSuccess {Int} result.order_info.evaluation_time 评论时间
- * @apiSuccess {Int} result.order_info.finnshed_time 完成时间
- * @apiSuccess {Int} result.order_info.gc_id 分类ID
- * @apiSuccess {Int} result.order_info.goods_id 商品ID
- * @apiSuccess {String} result.order_info.goods_image 商品图片名称
- * @apiSuccess {String} result.order_info.goods_image_url 商品图片完整路径
- * @apiSuccess {String} result.order_info.goods_name 商品名称
- * @apiSuccess {Int} result.order_info.goods_num 购买数量
- * @apiSuccess {Float} result.order_info.goods_price 商品价格
- * @apiSuccess {Int} result.order_info.ob_no 结算单号
- * @apiSuccess {Float} result.order_info.order_amount 订单总价
- * @apiSuccess {Int} result.order_info.order_from 订单来源 1:PC 2:手机
- * @apiSuccess {Int} result.order_info.order_id 订单ID
- * @apiSuccess {Int} result.order_info.order_promotion_type 订单促销类型
- * @apiSuccess {String} result.order_info.order_sn 订单编号
- * @apiSuccess {Int} result.order_info.order_state 订单状态
- * @apiSuccess {String} result.order_info.order_state_text 订单状态描述
- * @apiSuccess {String} result.order_info.payment_code 支付方式代码
- * @apiSuccess {String} result.order_info.payment_name 支付方式名称
- * @apiSuccess {Int} result.order_info.payment_time 支付时间
- * @apiSuccess {Float} result.order_info.pd_amount 预存款支付金额
- * @apiSuccess {Int} result.order_info.promotions_id 促销ID
- * @apiSuccess {Float} result.order_info.rcb_amount 充值卡支付金额
- * @apiSuccess {Float} result.order_info.refund_amount 退款金额
- * @apiSuccess {Int} result.order_info.refund_state 退款状态
- * @apiSuccess {String} result.order_info.state_desc 订单状态html描述
- * @apiSuccess {Int} result.order_info.store_id 店铺ID
- * @apiSuccess {String} result.order_info.store_name 店铺名称
- * @apiSuccess {String} result.order_info.trade_no 第三方平台交易号
- * @apiSuccess {Int} result.order_info.use_state 使用状态 0:未使用 1:已使用
- * @apiSuccess {Int} result.order_info.vr_indate 虚拟订单有效期
- * @apiSuccess {Int} result.order_info.vr_invalid_refund 允许过期退款 1:是 0:否
- * @apiSuccess {Int} result.order_info.vr_send_times 兑换码发送次数
- */
- public function vr()
- {
- $order_id = intval(input('param.order_id'));
- $return = model('memberevaluate', 'logic')->validationVr($order_id, $this->member_info['member_id']);
- if (isset($return['state'])) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- ds_json_encode(10000, '', array('order_info' => $order_info));
- }
- /**
- * @api {POST} api/Memberevaluate/save_vr 虚拟订单评价保存
- * @apiVersion 1.0.0
- * @apiGroup Memberevaluate
- *
- * @apiHeader {String} X-DS-KEY 用户授权token
- *
- * @apiParam {Int} order_id 订单号
- * @apiParam {Array} goods 订单商品rec_id为键的含score商品评分、comment评论、evaluate_image晒图、anony匿名的对象数组
- *
- * @apiSuccess {String} code 返回码,10000为成功
- * @apiSuccess {String} message 返回消息
- */
- public function save_vr()
- {
- $order_id = intval(input('post.order_id'));
- $return = model('memberevaluate', 'logic')->validationVr($order_id, $this->member_info['member_id']);
- if (isset($return['state'])) {
- ds_json_encode(10001, $return['msg']);
- }
- extract($return['data']);
- $return = model('memberevaluate', 'logic')->saveVr($order_info, $store_info, array($order_info), $this->member_info['member_id'], $this->member_info['member_name']);
- if (!$return['state']) {
- ds_json_encode(10000, '', $return['msg']);
- } else {
- ds_json_encode(10001, lang('ds_common_op_fail'));
- }
- }
- }
|