Memberevaluate.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <?php
  2. namespace app\api\controller;
  3. /**
  4. * ============================================================================
  5. *
  6. * ============================================================================
  7. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  8. * 网站地址: https://www.valimart.net/
  9. * ----------------------------------------------------------------------------
  10. *
  11. * ============================================================================
  12. * 评论制器
  13. */
  14. class Memberevaluate extends MobileMember
  15. {
  16. public function initialize()
  17. {
  18. parent::initialize(); // TODO: Change the autogenerated stub
  19. }
  20. /**
  21. * @api {POST} api/Memberevaluate/get_goodsevallist 获取当前用户的所有商品评论列表
  22. * @apiVersion 1.0.0
  23. * @apiGroup Memberevaluate
  24. *
  25. * @apiHeader {String} X-DS-KEY 用户授权token
  26. *
  27. * @apiParam {String} per_page 每页显示数量
  28. * @apiParam {String} page 当前页数
  29. *
  30. * @apiSuccess {String} code 返回码,10000为成功
  31. * @apiSuccess {String} message 返回消息
  32. * @apiSuccess {Object} result 返回数据
  33. * @apiSuccess {Object[]} result.goodsevallist 评论列表
  34. * @apiSuccess {Int} result.goodsevallist.geval_addtime 评论时间
  35. * @apiSuccess {Int} result.goodsevallist.geval_content 评论内容
  36. * @apiSuccess {Int} result.goodsevallist.geval_explain 评论回复
  37. * @apiSuccess {Int} result.goodsevallist.geval_frommemberid 评论用户ID
  38. * @apiSuccess {Int} result.goodsevallist.geval_frommembername 评论用户名称
  39. * @apiSuccess {Int} result.goodsevallist.geval_goodsid 评论商品ID
  40. * @apiSuccess {Int} result.goodsevallist.geval_goodsimage 评论商品图片
  41. * @apiSuccess {Int} result.goodsevallist.geval_goodsname 评论商品名称
  42. * @apiSuccess {Int} result.goodsevallist.geval_goodsprice 评论商品价格
  43. * @apiSuccess {Int} result.goodsevallist.geval_id 评论ID
  44. * @apiSuccess {Int} result.goodsevallist.geval_image 评论晒图
  45. * @apiSuccess {Int} result.goodsevallist.geval_isanonymous 是否匿名 0否1是
  46. * @apiSuccess {Int} result.goodsevallist.geval_ordergoodsid 订单商品ID
  47. * @apiSuccess {Int} result.goodsevallist.geval_orderid 订单ID
  48. * @apiSuccess {Int} result.goodsevallist.geval_orderno 订单编号
  49. * @apiSuccess {Int} result.goodsevallist.geval_remark 管理员对评价的处理备注
  50. * @apiSuccess {Int} result.goodsevallist.geval_scores 评分
  51. * @apiSuccess {Int} result.goodsevallist.geval_state 评论状态 0为正常 1为禁止显示
  52. * @apiSuccess {Int} result.goodsevallist.geval_storeid 店铺ID
  53. * @apiSuccess {Int} result.goodsevallist.geval_storename 店铺名称
  54. * @apiSuccess {Int} result.page_total 总页数
  55. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  56. */
  57. public function get_goodsevallist() {
  58. $evaluategoods_model = model('evaluategoods');
  59. $condition = array();
  60. $condition[] = array('geval_frommemberid','=',$this->member_info['member_id']);
  61. $goodsevallist = $evaluategoods_model->getEvaluategoodsList($condition, 5, 'geval_id desc');
  62. foreach ($goodsevallist as $key => $goodseval) {
  63. $goodsevallist[$key]['geval_goodsimage'] = goods_cthumb($goodseval['geval_goodsimage'],240);
  64. }
  65. $result = array_merge(array('goodsevallist' => $goodsevallist), mobile_page($evaluategoods_model->page_info));
  66. ds_json_encode(10000, lang('ds_common_op_succ'), $result);
  67. }
  68. /**
  69. * @api {POST} api/Memberevaluate/save 评论列表
  70. * @apiVersion 1.0.0
  71. * @apiGroup Memberevaluate
  72. *
  73. * @apiHeader {String} X-DS-KEY 用户授权token
  74. *
  75. * @apiParam {Int} order_id 订单号
  76. *
  77. * @apiSuccess {String} code 返回码,10000为成功
  78. * @apiSuccess {String} message 返回消息
  79. * @apiSuccess {Object} result 返回数据
  80. * @apiSuccess {Object[]} result.order_goods 订单商品列表
  81. * @apiSuccess {Int} result.order_goods.buyer_id 买家ID
  82. * @apiSuccess {Int} result.order_goods.commis_rate 佣金比例
  83. * @apiSuccess {Int} result.order_goods.gc_id 分类ID
  84. * @apiSuccess {Int} result.order_goods.goods_id 商品ID
  85. * @apiSuccess {String} result.order_goods.goods_image 商品图片名称
  86. * @apiSuccess {String} result.order_goods.goods_image_url 商品图片完整路径
  87. * @apiSuccess {Int} result.order_goods.goods_name 商品名称
  88. * @apiSuccess {Int} result.order_goods.goods_num 购买数量
  89. * @apiSuccess {Float} result.order_goods.goods_pay_price 实际支付金额
  90. * @apiSuccess {Float} result.order_goods.goods_price 商品价格
  91. * @apiSuccess {Int} result.order_goods.goods_type 商品类别 1默认2抢购商品3秒杀商品4组合套装5赠品6拼团7会员等级折扣
  92. * @apiSuccess {Int} result.order_goods.order_id 订单ID
  93. * @apiSuccess {Int} result.order_goods.promotions_id 促销ID
  94. * @apiSuccess {Int} result.order_goods.rec_id 订单商品ID
  95. * @apiSuccess {Int} result.order_goods.store_id 店铺ID
  96. * @apiSuccess {Object} result.store_info 店铺信息
  97. * @apiSuccess {Int} result.store_info.is_platform_store 是否自营店铺 0否1是
  98. * @apiSuccess {Int} result.store_info.store_id 店铺ID
  99. * @apiSuccess {String} result.store_info.store_name 店铺名称
  100. */
  101. public function index()
  102. {
  103. $order_id = intval(input('param.order_id'));
  104. $return = model('memberevaluate','logic')->validation($order_id, $this->member_info['member_id']);
  105. if (isset($return['state'])) {
  106. ds_json_encode(10001,$return['msg']);
  107. }
  108. extract($return['data']);
  109. $store = array();
  110. $store['store_id'] = $store_info['store_id'];
  111. $store['store_name'] = $store_info['store_name'];
  112. $store['is_platform_store'] = $store_info['is_platform_store'];
  113. ds_json_encode(10000,'',array('store_info' => $store, 'order_goods' => $order_goods));
  114. }
  115. /**
  116. * @api {POST} api/Memberevaluate/save 评论保存
  117. * @apiVersion 1.0.0
  118. * @apiGroup Memberevaluate
  119. *
  120. * @apiHeader {String} X-DS-KEY 用户授权token
  121. *
  122. * @apiParam {Int} order_id 订单号
  123. * @apiParam {Array} goods 订单商品rec_id为键的含score商品评分、comment评论、evaluate_image晒图、anony匿名的对象数组
  124. * @apiParam {Int} store_desccredit 店铺描述评分
  125. * @apiParam {Int} store_servicecredit 店铺服务评分
  126. * @apiParam {Int} store_deliverycredit 店铺配送评分
  127. *
  128. * @apiSuccess {String} code 返回码,10000为成功
  129. * @apiSuccess {String} message 返回消息
  130. */
  131. public function save()
  132. {
  133. $order_id = intval(input('post.order_id'));
  134. $return = model('memberevaluate','logic')->validation($order_id, $this->member_info['member_id']);
  135. if (isset($return['state'])) {
  136. ds_json_encode(10001,$return['msg']);
  137. }
  138. extract($return['data']);
  139. $return = model('memberevaluate','logic')->saveorderevaluate( $order_info, $store_info, $order_goods, $this->member_info['member_id'], $this->member_info['member_name']);
  140. if ($return == true) {
  141. ds_json_encode(10000,lang('ds_common_op_succ'));
  142. }
  143. else {
  144. ds_json_encode(10001,lang('ds_common_op_fail'));
  145. }
  146. }
  147. /**
  148. * 追评
  149. */
  150. public function again()
  151. {
  152. $order_id = intval(input('param.order_id'));
  153. $return = model('memberevaluate','logic')->validationAgain($order_id, $this->member_info['member_id']);
  154. if (!$return['state']) {
  155. ds_json_encode(10001,$return['msg']);
  156. }
  157. extract($return['data']);
  158. $store = array();
  159. $store['store_id'] = $store_info['store_id'];
  160. $store['store_name'] = $store_info['store_name'];
  161. $store['is_platform_store'] = $store_info['is_platform_store'];
  162. ds_json_encode(10000,'',array('store_info' => $store, 'evaluate_goods' => $evaluate_goods));
  163. }
  164. /**
  165. * 追加评价保存
  166. */
  167. public function save_again()
  168. {
  169. $order_id = intval(input('post.order_id'));
  170. $return = model('memberevaluate','logic')->validationAgain($order_id, $this->member_info['member_id']);
  171. if (!$return['state']) {
  172. ds_json_encode(10001,$return['msg']);
  173. }
  174. extract($return['data']);
  175. $return = model('memberevaluate','logic')->saveAgain(input('post.'), $order_info, $evaluate_goods);
  176. if (!$return['state']) {
  177. ds_json_encode(10000,'',$return['msg']);
  178. }
  179. else {
  180. ds_json_encode(10001,lang('ds_common_op_fail'));
  181. }
  182. }
  183. /**
  184. * @api {POST} api/Memberevaluate/vr 虚拟订单评价
  185. * @apiVersion 1.0.0
  186. * @apiGroup Memberevaluate
  187. *
  188. * @apiHeader {String} X-DS-KEY 用户授权token
  189. *
  190. * @apiParam {Int} order_id 订单号
  191. *
  192. * @apiSuccess {String} code 返回码,10000为成功
  193. * @apiSuccess {String} message 返回消息
  194. * @apiSuccess {Object} result 返回数据
  195. * @apiSuccess {Object} result.order_info 订单信息
  196. * @apiSuccess {Int} result.order_info.add_time 下单时间
  197. * @apiSuccess {Int} result.order_info.buyer_id 买家ID
  198. * @apiSuccess {String} result.order_info.buyer_msg 订单留言
  199. * @apiSuccess {String} result.order_info.buyer_name 买家用户名
  200. * @apiSuccess {String} result.order_info.buyer_phone 接收手机号
  201. * @apiSuccess {String} result.order_info.close_reason 虚拟订单关闭原因
  202. * @apiSuccess {Int} result.order_info.close_time 关闭时间
  203. * @apiSuccess {Int} result.order_info.commis_rate 佣金比例
  204. * @apiSuccess {Int} result.order_info.delete_state 删除状态 0:未删除1:放入回收站2:彻底删除
  205. * @apiSuccess {Boolean} result.order_info.evaluate_able 是否可评 true是false否
  206. * @apiSuccess {Int} result.order_info.evaluation_state 评论状态 0:默认 1:已评价 2:禁止评价
  207. * @apiSuccess {Int} result.order_info.evaluation_time 评论时间
  208. * @apiSuccess {Int} result.order_info.finnshed_time 完成时间
  209. * @apiSuccess {Int} result.order_info.gc_id 分类ID
  210. * @apiSuccess {Int} result.order_info.goods_id 商品ID
  211. * @apiSuccess {String} result.order_info.goods_image 商品图片名称
  212. * @apiSuccess {String} result.order_info.goods_image_url 商品图片完整路径
  213. * @apiSuccess {String} result.order_info.goods_name 商品名称
  214. * @apiSuccess {Int} result.order_info.goods_num 购买数量
  215. * @apiSuccess {Float} result.order_info.goods_price 商品价格
  216. * @apiSuccess {Int} result.order_info.ob_no 结算单号
  217. * @apiSuccess {Float} result.order_info.order_amount 订单总价
  218. * @apiSuccess {Int} result.order_info.order_from 订单来源 1:PC 2:手机
  219. * @apiSuccess {Int} result.order_info.order_id 订单ID
  220. * @apiSuccess {Int} result.order_info.order_promotion_type 订单促销类型
  221. * @apiSuccess {String} result.order_info.order_sn 订单编号
  222. * @apiSuccess {Int} result.order_info.order_state 订单状态
  223. * @apiSuccess {String} result.order_info.order_state_text 订单状态描述
  224. * @apiSuccess {String} result.order_info.payment_code 支付方式代码
  225. * @apiSuccess {String} result.order_info.payment_name 支付方式名称
  226. * @apiSuccess {Int} result.order_info.payment_time 支付时间
  227. * @apiSuccess {Float} result.order_info.pd_amount 预存款支付金额
  228. * @apiSuccess {Int} result.order_info.promotions_id 促销ID
  229. * @apiSuccess {Float} result.order_info.rcb_amount 充值卡支付金额
  230. * @apiSuccess {Float} result.order_info.refund_amount 退款金额
  231. * @apiSuccess {Int} result.order_info.refund_state 退款状态
  232. * @apiSuccess {String} result.order_info.state_desc 订单状态html描述
  233. * @apiSuccess {Int} result.order_info.store_id 店铺ID
  234. * @apiSuccess {String} result.order_info.store_name 店铺名称
  235. * @apiSuccess {String} result.order_info.trade_no 第三方平台交易号
  236. * @apiSuccess {Int} result.order_info.use_state 使用状态 0:未使用 1:已使用
  237. * @apiSuccess {Int} result.order_info.vr_indate 虚拟订单有效期
  238. * @apiSuccess {Int} result.order_info.vr_invalid_refund 允许过期退款 1:是 0:否
  239. * @apiSuccess {Int} result.order_info.vr_send_times 兑换码发送次数
  240. */
  241. public function vr()
  242. {
  243. $order_id = intval(input('param.order_id'));
  244. $return = model('memberevaluate','logic')->validationVr($order_id, $this->member_info['member_id']);
  245. if (isset($return['state'])) {
  246. ds_json_encode(10001,$return['msg']);
  247. }
  248. extract($return['data']);
  249. ds_json_encode(10000,'',array('order_info' => $order_info));
  250. }
  251. /**
  252. * @api {POST} api/Memberevaluate/save_vr 虚拟订单评价保存
  253. * @apiVersion 1.0.0
  254. * @apiGroup Memberevaluate
  255. *
  256. * @apiHeader {String} X-DS-KEY 用户授权token
  257. *
  258. * @apiParam {Int} order_id 订单号
  259. * @apiParam {Array} goods 订单商品rec_id为键的含score商品评分、comment评论、evaluate_image晒图、anony匿名的对象数组
  260. *
  261. * @apiSuccess {String} code 返回码,10000为成功
  262. * @apiSuccess {String} message 返回消息
  263. */
  264. public function save_vr()
  265. {
  266. $order_id = intval(input('post.order_id'));
  267. $return = model('memberevaluate','logic')->validationVr($order_id, $this->member_info['member_id']);
  268. if (isset($return['state'])) {
  269. ds_json_encode(10001,$return['msg']);
  270. }
  271. extract($return['data']);
  272. $return = model('memberevaluate','logic')->saveVr($order_info, $store_info, array($order_info), $this->member_info['member_id'], $this->member_info['member_name']);
  273. if (!$return['state']) {
  274. ds_json_encode(10000,'',$return['msg']);
  275. }
  276. else {
  277. ds_json_encode(10001,lang('ds_common_op_fail'));
  278. }
  279. }
  280. }