Memberevaluate.php 14 KB

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