Memberevaluate.php 14 KB

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