Membercomplain.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712
  1. <?php
  2. /*
  3. * 交易投诉
  4. */
  5. namespace app\api\controller;
  6. use think\facade\Lang;
  7. /**
  8. * ============================================================================
  9. *
  10. * ============================================================================
  11. * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
  12. * 网站地址: https://www.valimart.net/
  13. * ----------------------------------------------------------------------------
  14. *
  15. * ============================================================================
  16. * 投诉控制器
  17. */
  18. class Membercomplain extends MobileMember {
  19. //定义投诉状态常量
  20. const STATE_NEW = 10;
  21. const STATE_APPEAL = 20;
  22. const STATE_TALK = 30;
  23. const STATE_HANDLE = 40;
  24. const STATE_FINISH = 99;
  25. const STATE_UNACTIVE = 1;
  26. const STATE_ACTIVE = 2;
  27. public function initialize() {
  28. parent::initialize();
  29. Lang::load(base_path() . 'home/lang/' . config('lang.default_lang') . '/membercomplain.lang.php');
  30. }
  31. /**
  32. * @api {POST} api/Membercomplain/index 投诉列表
  33. * @apiVersion 1.0.0
  34. * @apiGroup Membercomplain
  35. *
  36. * @apiHeader {String} X-DS-KEY 用户授权token
  37. *
  38. * @apiParam {Int} per_page 每页显示数量
  39. * @apiParam {Int} page 当前页数
  40. *
  41. * @apiSuccess {String} code 返回码,10000为成功
  42. * @apiSuccess {String} message 返回消息
  43. * @apiSuccess {Object} result 返回数据
  44. * @apiSuccess {Object[]} result.complaint_list 投诉列表
  45. * @apiSuccess {Int} result.complaint_list.accused_id 被告ID
  46. * @apiSuccess {String} result.complaint_list.accused_name 被告名称
  47. * @apiSuccess {Int} result.complaint_list.accuser_id 原告ID
  48. * @apiSuccess {String} result.complaint_list.accuser_name 原告用户名
  49. * @apiSuccess {Int} result.complaint_list.appeal_datetime 申诉时间,Unix时间戳
  50. * @apiSuccess {String} result.complaint_list.appeal_message 申诉内容
  51. * @apiSuccess {String} result.complaint_list.appeal_pic1 申诉图片1
  52. * @apiSuccess {String} result.complaint_list.appeal_pic2 申诉图片2
  53. * @apiSuccess {String} result.complaint_list.appeal_pic3 申诉图片3
  54. * @apiSuccess {Int} result.complaint_list.complain_active 投诉是否通过平台审批 1:未通过 2:通过
  55. * @apiSuccess {String} result.complaint_list.complain_content 投诉内容
  56. * @apiSuccess {Int} result.complaint_list.complain_datetime 投诉时间,Unix时间戳
  57. * @apiSuccess {Int} result.complaint_list.complain_handle_datetime 投诉处理时间,Unix时间戳
  58. * @apiSuccess {Int} result.complaint_list.complain_handle_member_id 投诉处理人ID
  59. * @apiSuccess {Int} result.complaint_list.complain_id 投诉ID
  60. * @apiSuccess {String} result.complaint_list.complain_pic1 投诉图片1
  61. * @apiSuccess {String} result.complaint_list.complain_pic2 投诉图片2
  62. * @apiSuccess {String} result.complaint_list.complain_pic3 投诉图片3
  63. * @apiSuccess {Int} result.complaint_list.complain_state 投诉状态 10:新投诉 20:投诉通过转给被投诉人 30:被投诉人已申诉 40:提交仲裁 99:已关闭
  64. * @apiSuccess {String} result.complaint_list.complain_subject_content 投诉主题
  65. * @apiSuccess {Int} result.complaint_list.complain_subject_id 投诉主题id
  66. * @apiSuccess {Int} result.complaint_list.final_handle_datetime 最终处理时间,Unix时间戳
  67. * @apiSuccess {Int} result.complaint_list.final_handle_member_id 最终处理人ID
  68. * @apiSuccess {String} result.complaint_list.final_handle_message 最终处理意见
  69. * @apiSuccess {Int} result.complaint_list.order_goods_id 订单商品ID
  70. * @apiSuccess {Int} result.complaint_list.order_id 订单ID
  71. * @apiSuccess {Object} result.goods_list 投诉商品列表,键为订单商品ID
  72. * @apiSuccess {Int} result.goods_list.buyer_id 买家ID
  73. * @apiSuccess {Float} result.goods_list.commis_rate 商品分类佣金比例
  74. * @apiSuccess {Int} result.goods_list.gc_id 分类ID
  75. * @apiSuccess {Int} result.goods_list.goods_id 商品ID
  76. * @apiSuccess {String} result.goods_list.goods_image 商品图片名称
  77. * @apiSuccess {String} result.goods_list.goods_image_url 商品图片完整地址
  78. * @apiSuccess {String} result.goods_list.goods_name 商品名称
  79. * @apiSuccess {Int} result.goods_list.goods_num 购买数量
  80. * @apiSuccess {Float} result.goods_list.goods_pay_price 商品实际支付金额
  81. * @apiSuccess {Float} result.goods_list.goods_price 商品价格
  82. * @apiSuccess {Int} result.goods_list.goods_type 商品类型 1默认2抢购商品3秒杀商品4组合套装5赠品6拼团7会员等级折扣
  83. * @apiSuccess {Int} result.goods_list.order_id 订单ID
  84. * @apiSuccess {Int} result.goods_list.promotions_id 促销ID
  85. * @apiSuccess {Int} result.goods_list.rec_id 订单商品表自增ID
  86. * @apiSuccess {Int} result.goods_list.store_id 店铺ID
  87. * @apiSuccess {Int} result.page_total 总页数
  88. * @apiSuccess {Boolean} result.hasmore 是否有更多 true是false否
  89. */
  90. public function index() {
  91. /*
  92. * 得到当前用户的投诉列表
  93. */
  94. $complain_model = model('complain');
  95. $condition = array();
  96. $condition[] = array('accuser_id', '=', $this->member_info['member_id']);
  97. switch (intval(input('param.select_complain_state'))) {
  98. case 1:
  99. $condition[] = array('complain_state', '<', 90);
  100. break;
  101. case 2:
  102. $condition[] = array('complain_state', '=', 99);
  103. break;
  104. }
  105. $complain_list = $complain_model->getComplainList($condition, $this->pagesize);
  106. $goods_list = $complain_model->getComplainGoodsList($complain_list);
  107. foreach ($goods_list as $key => $val) {
  108. $goods_list[$key]['goods_image_url'] = goods_thumb($val, 240);
  109. }
  110. $result = array_merge(array('complaint_list' => $complain_list, 'goods_list' => $goods_list), mobile_page($complain_model->page_info));
  111. ds_json_encode(10000, '', $result);
  112. }
  113. public function common_data($order_id, $goods_id) {
  114. //获取投诉类型
  115. $complainsubject_model = model('complainsubject');
  116. $param = array();
  117. $complain_subject_list = $complainsubject_model->getActiveComplainsubject($param);
  118. if (empty($complain_subject_list)) {
  119. ds_json_encode(10001, lang('complain_subject_error'));
  120. }
  121. $condition = array();
  122. $condition[] = array('buyer_id', '=', $this->member_info['member_id']);
  123. $condition[] = array('order_id', '=', $order_id);
  124. $refundreturn_model = model('refundreturn');
  125. $order_info = $refundreturn_model->getRightOrderList($condition, $goods_id);
  126. $order_info['extend_order_goods'] = $order_info['goods_list'];
  127. $order_list[$order_id] = $order_info;
  128. $order_list = $refundreturn_model->getGoodsRefundList($order_list);
  129. if (isset($order_list[$order_id]['extend_complain'][$goods_id]) && intval($order_list[$order_id]['extend_complain'][$goods_id]) == 1) {//退款投诉
  130. $complainsubject_model = model('complainsubject');
  131. $complain_subject = $complainsubject_model->getComplainsubject(array('complainsubject_id' => 1)); //投诉主题
  132. $complain_subject_list = array_merge($complain_subject, $complain_subject_list);
  133. }
  134. return array('subject_list' => $complain_subject_list);
  135. }
  136. /**
  137. * @api {POST} api/Membercomplain/get_common_data 新增/编辑投诉公共数据
  138. * @apiVersion 1.0.0
  139. * @apiGroup Membercomplain
  140. *
  141. * @apiHeader {String} X-DS-KEY 用户授权token
  142. *
  143. * @apiSuccess {String} code 返回码,10000为成功
  144. * @apiSuccess {String} message 返回消息
  145. * @apiSuccess {Object} result 返回数据
  146. * @apiSuccess {Object[]} result.subject_list 投诉主题列表
  147. * @apiSuccess {String} result.subject_list.complainsubject_content 投诉主题内容
  148. * @apiSuccess {String} result.subject_list.complainsubject_desc 投诉主题描述
  149. * @apiSuccess {Int} result.subject_list.complainsubject_id 投诉主题ID
  150. * @apiSuccess {Int} result.subject_list.complainsubject_state 投诉主题状态 1:有效 2:失效
  151. */
  152. public function get_common_data() {
  153. $order_id = intval(input('param.order_id'));
  154. $goods_id = intval(input('param.goods_id'));
  155. $common_data = $this->common_data($order_id, $goods_id);
  156. ds_json_encode(10000, '', $common_data);
  157. }
  158. /**
  159. * @api {POST} api/Membercomplain/complain_show 获取投诉信息
  160. * @apiVersion 1.0.0
  161. * @apiGroup Membercomplain
  162. *
  163. * @apiHeader {String} X-DS-KEY 用户授权token
  164. *
  165. * @apiParam {Int} complain_id 投诉ID
  166. *
  167. * @apiSuccess {String} code 返回码,10000为成功
  168. * @apiSuccess {String} message 返回消息
  169. * @apiSuccess {Object} result 返回数据
  170. * @apiSuccess {String[]} result.appeal_pic 申诉凭证图片列表
  171. * @apiSuccess {String[]} result.complain_pic 投诉凭证图片列表
  172. * @apiSuccess {Object} result.complain_info 投诉信息
  173. * @apiSuccess {Int} result.complain_info.accused_id 被告ID
  174. * @apiSuccess {String} result.complain_info.accused_name 被告名称
  175. * @apiSuccess {Int} result.complain_info.accuser_id 原告ID
  176. * @apiSuccess {String} result.complain_info.accuser_name 原告用户名
  177. * @apiSuccess {Int} result.complain_info.appeal_datetime 申诉时间,Unix时间戳
  178. * @apiSuccess {String} result.complain_info.appeal_message 申诉内容
  179. * @apiSuccess {String} result.complain_info.appeal_pic1 申诉图片1
  180. * @apiSuccess {String} result.complain_info.appeal_pic2 申诉图片2
  181. * @apiSuccess {String} result.complain_info.appeal_pic3 申诉图片3
  182. * @apiSuccess {Int} result.complain_info.complain_active 投诉是否通过平台审批 1:未通过 2:通过
  183. * @apiSuccess {String} result.complain_info.complain_content 投诉内容
  184. * @apiSuccess {Int} result.complain_info.complain_datetime 投诉时间,Unix时间戳
  185. * @apiSuccess {Int} result.complain_info.complain_handle_datetime 投诉处理时间,Unix时间戳
  186. * @apiSuccess {Int} result.complain_info.complain_handle_member_id 投诉处理人ID
  187. * @apiSuccess {Int} result.complain_info.complain_id 投诉ID
  188. * @apiSuccess {String} result.complain_info.complain_pic1 投诉图片1
  189. * @apiSuccess {String} result.complain_info.complain_pic2 投诉图片2
  190. * @apiSuccess {String} result.complain_info.complain_pic3 投诉图片3
  191. * @apiSuccess {Int} result.complain_info.complain_state 投诉状态 10:新投诉 20:投诉通过转给被投诉人 30:被投诉人已申诉 40:提交仲裁 99:已关闭
  192. * @apiSuccess {String} result.complain_info.complain_subject_content 投诉主题
  193. * @apiSuccess {Int} result.complain_info.complain_subject_id 投诉主题id
  194. * @apiSuccess {Int} result.complain_info.final_handle_datetime 最终处理时间,Unix时间戳
  195. * @apiSuccess {Int} result.complain_info.final_handle_member_id 最终处理人ID
  196. * @apiSuccess {String} result.complain_info.final_handle_message 最终处理意见
  197. * @apiSuccess {Int} result.complain_info.order_goods_id 订单商品ID
  198. * @apiSuccess {Int} result.complain_info.order_id 订单ID
  199. * @apiSuccess {Object} result.return_info 退款信息
  200. * @apiSuccess {Int} result.return_info.add_time 退款添加时间
  201. * @apiSuccess {String} result.return_info.buyer_email 买家邮箱
  202. * @apiSuccess {Int} result.return_info.buyer_id 买家ID
  203. * @apiSuccess {String} result.return_info.buyer_name 买家用户名
  204. * @apiSuccess {Int} result.return_info.delay_time 自动收货时间
  205. * @apiSuccess {Int} result.return_info.delete_state 订单删除状态 0:未删除 1:放入回收站 2:彻底删除
  206. * @apiSuccess {Int} result.return_info.evaluation_state 评论状态
  207. * @apiSuccess {Object} result.return_info.extend_order_common 订单公共信息
  208. * @apiSuccess {Int} result.return_info.extend_order_common.daddress_id 发货地址ID
  209. * @apiSuccess {String} result.return_info.extend_order_common.deliver_explain 订单发货备注
  210. * @apiSuccess {Int} result.return_info.extend_order_common.evalseller_state 卖家是否已评价买家
  211. * @apiSuccess {Int} result.return_info.extend_order_common.evalseller_time 卖家评价买家的时间
  212. * @apiSuccess {Int} result.return_info.extend_order_common.evaluation_time 评价时间
  213. * @apiSuccess {String} result.return_info.extend_order_common.invoice_info 订单发票信息
  214. * @apiSuccess {Int} result.return_info.extend_order_common.order_id 订单ID
  215. * @apiSuccess {String} result.return_info.extend_order_common.order_message 订单留言
  216. * @apiSuccess {Int} result.return_info.extend_order_common.order_pointscount 订单赠送积分
  217. * @apiSuccess {String} result.return_info.extend_order_common.promotion_info 订单促销信息备注
  218. * @apiSuccess {Int} result.return_info.extend_order_common.reciver_city_id 收货人市级ID
  219. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info 收货人其它信息
  220. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.address 收货地址
  221. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.area 收货地区
  222. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.mob_phone 收货人手机号
  223. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.phone 收货人联系号码
  224. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.street 街道地址
  225. * @apiSuccess {String} result.return_info.extend_order_common.reciver_info.tel_phone 座机号
  226. * @apiSuccess {String} result.return_info.extend_order_common.reciver_name 收货人姓名
  227. * @apiSuccess {Int} result.return_info.extend_order_common.reciver_province_id 收货地区省ID
  228. * @apiSuccess {Int} result.return_info.extend_order_common.shipping_express_id 配送公司ID
  229. * @apiSuccess {Int} result.return_info.extend_order_common.shipping_time 发货时间
  230. * @apiSuccess {Int} result.return_info.extend_order_common.store_id 店铺ID
  231. * @apiSuccess {String} result.return_info.extend_order_common.voucher_code 代金券编码
  232. * @apiSuccess {Int} result.return_info.extend_order_common.voucher_price 代金券面额
  233. * @apiSuccess {Object} result.return_info.extend_store 店铺信息
  234. * @apiSuccess {String} result.return_info.extend_store.area_info 店铺地区
  235. * @apiSuccess {Int} result.return_info.extend_store.bind_all_gc 是否绑定所有分类 0否1是
  236. * @apiSuccess {String} result.return_info.extend_store.deliver_region 店铺默认配送区域
  237. * @apiSuccess {Int} result.return_info.extend_store.goods_count 商品数量
  238. * @apiSuccess {Int} result.return_info.extend_store.grade_id 等级ID
  239. * @apiSuccess {Int} result.return_info.extend_store.is_platform_store 是否自营店 0否1是
  240. * @apiSuccess {String} result.return_info.extend_store.mb_sliders 手机店铺轮播图序列化字符串
  241. * @apiSuccess {String} result.return_info.extend_store.mb_title_img 手机店铺背景图
  242. * @apiSuccess {Int} result.return_info.extend_store.member_id 店铺用户ID
  243. * @apiSuccess {String} result.return_info.extend_store.member_name 店铺用户名
  244. * @apiSuccess {Int} result.return_info.extend_store.region_id 店铺地区ID
  245. * @apiSuccess {String} result.return_info.extend_store.seller_name 卖家用户名
  246. * @apiSuccess {String} result.return_info.extend_store.store_address 店铺地址
  247. * @apiSuccess {Int} result.return_info.extend_store.store_addtime 店铺添加时间
  248. * @apiSuccess {Object[]} result.return_info.extend_store.store_aftersales 售后列表
  249. * @apiSuccess {String} result.return_info.extend_store.store_aftersales.name 售后名称
  250. * @apiSuccess {String} result.return_info.extend_store.store_aftersales.num 售后账号
  251. * @apiSuccess {String} result.return_info.extend_store.store_aftersales.type 售后类型 1QQ2旺旺3站内IM
  252. * @apiSuccess {Float} result.return_info.extend_store.store_avaliable_deposit 可用保证金
  253. * @apiSuccess {Float} result.return_info.extend_store.store_avaliable_money 可用预存款
  254. * @apiSuccess {String} result.return_info.extend_store.store_avatar 店铺头像
  255. * @apiSuccess {String} result.return_info.extend_store.store_banner 店铺背景图
  256. * @apiSuccess {Int} result.return_info.extend_store.store_baozh 是否已缴保证金 0否1是
  257. * @apiSuccess {Int} result.return_info.extend_store.store_bill_time 上次结算时间
  258. * @apiSuccess {String} result.return_info.extend_store.store_close_info 店铺关闭原因
  259. * @apiSuccess {Int} result.return_info.extend_store.store_collect 店铺收藏数量
  260. * @apiSuccess {String} result.return_info.extend_store.store_company_name 店铺公司名称
  261. * @apiSuccess {Object} result.return_info.extend_store.store_credit 店铺信用信息
  262. * @apiSuccess {String} result.return_info.extend_store.store_credit.store_deliverycredit 发货速度信息
  263. * @apiSuccess {Int} result.return_info.extend_store.store_credit.store_deliverycredit.credit 发货速度评分
  264. * @apiSuccess {String} result.return_info.extend_store.store_credit.store_deliverycredit.text 发货速度描述
  265. * @apiSuccess {Object} result.return_info.extend_store.store_credit.store_desccredit 描述相符信息
  266. * @apiSuccess {Int} result.return_info.extend_store.store_credit.store_desccredit.credit 描述相符评分
  267. * @apiSuccess {String} result.return_info.extend_store.store_credit.store_desccredit.text 描述相符描述
  268. * @apiSuccess {Object} result.return_info.extend_store.store_credit.store_servicecredit 服务态度信息
  269. * @apiSuccess {Int} result.return_info.extend_store.store_credit.store_servicecredit.credit 服务态度评分
  270. * @apiSuccess {String} result.return_info.extend_store.store_credit.store_servicecredit.text 服务态度描述
  271. * @apiSuccess {Int} result.return_info.extend_store.store_credit_average 平均评分
  272. * @apiSuccess {Int} result.return_info.extend_store.store_credit_percent 好评率
  273. * @apiSuccess {Int} result.return_info.extend_store.store_deliverycredit 发货速度评分
  274. * @apiSuccess {Int} result.return_info.extend_store.store_desccredit 描述相符评分
  275. * @apiSuccess {String} result.return_info.extend_store.store_description 店铺SEO描述
  276. * @apiSuccess {Int} result.return_info.extend_store.store_endtime 店铺到期时间
  277. * @apiSuccess {Int} result.return_info.extend_store.store_erxiaoshi 是否两小时发货 0否1是
  278. * @apiSuccess {Int} result.return_info.extend_store.store_free_price 超出该金额免运费 0未设置
  279. * @apiSuccess {Int} result.return_info.extend_store.store_free_time 商家配送时间
  280. * @apiSuccess {Float} result.return_info.extend_store.store_freeze_deposit 冻结保证金
  281. * @apiSuccess {Float} result.return_info.extend_store.store_freeze_money 冻结预存款
  282. * @apiSuccess {Int} result.return_info.extend_store.store_huodaofk 是否支持货到付款 0否1是
  283. * @apiSuccess {Int} result.return_info.extend_store.store_id 店铺ID
  284. * @apiSuccess {String} result.return_info.extend_store.store_keywords 店铺SEO关键字
  285. * @apiSuccess {String} result.return_info.extend_store.store_latitude 纬度
  286. * @apiSuccess {String} result.return_info.extend_store.store_logo 店铺logo
  287. * @apiSuccess {String} result.return_info.extend_store.store_longitude 经度
  288. * @apiSuccess {String} result.return_info.extend_store.store_mainbusiness 主营商品
  289. * @apiSuccess {String} result.return_info.extend_store.store_mgdiscount 序列化会员等级折扣
  290. * @apiSuccess {Int} result.return_info.extend_store.store_mgdiscount_state 店铺是否开启序列化会员等级折扣 0否1是
  291. * @apiSuccess {String} result.return_info.extend_store.store_name 店铺名称
  292. * @apiSuccess {Float} result.return_info.extend_store.store_payable_deposit 应缴保证金
  293. * @apiSuccess {String} result.return_info.extend_store.store_phone 店铺电话
  294. * @apiSuccess {Object[]} result.return_info.extend_store.store_presales 售前列表
  295. * @apiSuccess {String} result.return_info.extend_store.store_presales.name 售前名称
  296. * @apiSuccess {String} result.return_info.extend_store.store_presales.num 售前账号
  297. * @apiSuccess {String} result.return_info.extend_store.store_presales.type 售前类型 1QQ2旺旺3站内IM
  298. * @apiSuccess {String} result.return_info.extend_store.store_printexplain 打印订单页面下方说明文字
  299. * @apiSuccess {String} result.return_info.extend_store.store_qq 店铺QQ
  300. * @apiSuccess {Int} result.return_info.extend_store.store_qtian 是否支持7天退换 0否1是
  301. * @apiSuccess {Int} result.return_info.extend_store.store_recommend 推荐店铺 0否1是
  302. * @apiSuccess {Int} result.return_info.extend_store.store_sales 销量
  303. * @apiSuccess {Int} result.return_info.extend_store.store_servicecredit 服务态度评分
  304. * @apiSuccess {Int} result.return_info.extend_store.store_shiti 实体店认证 0否1是
  305. * @apiSuccess {Int} result.return_info.extend_store.store_shiyong 是否支持试用 0否1是
  306. * @apiSuccess {String} result.return_info.extend_store.store_slide 店铺幻灯片
  307. * @apiSuccess {String} result.return_info.extend_store.store_slide_url 店铺幻灯片链接
  308. * @apiSuccess {Int} result.return_info.extend_store.store_sort 店铺排序
  309. * @apiSuccess {Int} result.return_info.extend_store.store_state 店铺状态 0关闭,1开启,2审核中
  310. * @apiSuccess {Int} result.return_info.extend_store.store_tuihuo 是否支持退货承诺 0否1是
  311. * @apiSuccess {String} result.return_info.extend_store.store_vrcode_prefix 商家兑换码前缀
  312. * @apiSuccess {String} result.return_info.extend_store.store_workingtime 工作时间
  313. * @apiSuccess {String} result.return_info.extend_store.store_ww 店铺旺旺
  314. * @apiSuccess {Int} result.return_info.extend_store.store_xiaoxie 是否消协保证 0否1是
  315. * @apiSuccess {Int} result.return_info.extend_store.store_zhping 是否正品保障 0否1是
  316. * @apiSuccess {String} result.return_info.extend_store.store_zip 邮政编码
  317. * @apiSuccess {Int} result.return_info.extend_store.storeclass_id 店铺分类ID
  318. * @apiSuccess {Int} result.return_info.finnshed_time 订单完成时间
  319. * @apiSuccess {Float} result.return_info.goods_amount 商品总额
  320. * @apiSuccess {Object[]} result.return_info.goods_list 商品列表
  321. * @apiSuccess {Int} result.return_info.goods_list.buyer_id 买家ID
  322. * @apiSuccess {Float} result.return_info.goods_list.commis_rate 佣金比例
  323. * @apiSuccess {Int} result.return_info.goods_list.gc_id 分类ID
  324. * @apiSuccess {Int} result.return_info.goods_list.goods_id 商品ID
  325. * @apiSuccess {String} result.return_info.goods_list.goods_image 商品图片
  326. * @apiSuccess {String} result.return_info.goods_list.goods_name 商品名称
  327. * @apiSuccess {Int} result.return_info.goods_list.goods_num 购买数量
  328. * @apiSuccess {Float} result.return_info.goods_list.goods_pay_price 实际支付金额
  329. * @apiSuccess {Float} result.return_info.goods_list.goods_price 商品金额
  330. * @apiSuccess {Int} result.return_info.goods_list.goods_type 商品类型 1默认2抢购商品3秒杀商品4组合套装5赠品6拼团7会员等级折扣
  331. * @apiSuccess {Int} result.return_info.goods_list.order_id 订单ID
  332. * @apiSuccess {Int} result.return_info.goods_list.promotions_id 促销ID
  333. * @apiSuccess {Int} result.return_info.goods_list.rec_id 订单商品ID
  334. * @apiSuccess {Int} result.return_info.goods_list.store_id 店铺ID
  335. * @apiSuccess {Int} result.return_info.lock_state 锁定状态:0:正常,大于0:锁定
  336. * @apiSuccess {Int} result.return_info.ob_no 结算单号
  337. * @apiSuccess {Float} result.return_info.order_amount 订单总金额
  338. * @apiSuccess {Int} result.return_info.order_from 订单来源,1:PC 2:手机
  339. * @apiSuccess {Int} result.return_info.order_id 订单ID
  340. * @apiSuccess {String} result.return_info.order_sn 订单编号
  341. * @apiSuccess {Int} result.return_info.order_state 订单状态
  342. * @apiSuccess {Int} result.return_info.order_type 订单类型
  343. * @apiSuccess {String} result.return_info.pay_sn 支付单号
  344. * @apiSuccess {String} result.return_info.payment_code 支付方式代码
  345. * @apiSuccess {String} result.return_info.payment_name 支付方式名称
  346. * @apiSuccess {Int} result.return_info.payment_time 支付时间
  347. * @apiSuccess {Float} result.return_info.pd_amount 使用预存款金额
  348. * @apiSuccess {Float} result.return_info.rcb_amount 使用充值卡金额
  349. * @apiSuccess {Float} result.return_info.refund_amount 退款金额
  350. * @apiSuccess {Int} result.return_info.refund_state 退款状态 0:无退款 1:部分退款 2:全部退款
  351. * @apiSuccess {String} result.return_info.shipping_code 发货运单号
  352. * @apiSuccess {Float} result.return_info.shipping_fee 运费
  353. * @apiSuccess {String} result.return_info.state_desc 状态描述
  354. * @apiSuccess {Int} result.return_info.store_id 店铺ID
  355. * @apiSuccess {String} result.return_info.store_name 店铺名称
  356. */
  357. public function complain_show() {
  358. $complain_id = intval(input('complain_id'));
  359. //获取投诉详细信息
  360. $complain_info = $this->get_complain_info($complain_id);
  361. $complain_pic = array();
  362. $appeal_pic = array();
  363. for ($i = 1; $i <= 3; $i++) {
  364. if (!empty($complain_info['complain_pic' . $i])) {
  365. $complain_pic[] = ds_get_pic( ATTACH_PATH . DIRECTORY_SEPARATOR . 'complain' , $complain_info['complain_pic' . $i]);
  366. }
  367. if (!empty($complain_info['appeal_pic' . $i])) {
  368. $appeal_pic[] = ds_get_pic( ATTACH_PATH . DIRECTORY_SEPARATOR . 'complain' , $complain_info['appeal_pic' . $i]);
  369. }
  370. }
  371. $condition = array();
  372. $condition[] = array('buyer_id', '=', $this->member_info['member_id']);
  373. $condition[] = array('order_id', '=', $complain_info['order_id']);
  374. $refundreturn_model = model('refundreturn');
  375. $return_info = $refundreturn_model->getRightOrderList($condition, $complain_info['order_goods_id']);
  376. ds_json_encode(10000, '', array('appeal_pic' => $appeal_pic, 'complain_pic' => $complain_pic, 'return_info' => $return_info, 'complain_info' => $complain_info));
  377. }
  378. /**
  379. * @api {POST} api/Membercomplain/complain_save 保存用户提交的投诉
  380. * @apiVersion 1.0.0
  381. * @apiGroup Membercomplain
  382. *
  383. * @apiHeader {String} X-DS-KEY 用户授权token
  384. *
  385. * @apiParam {Int} input_order_id 订单ID
  386. * @apiParam {Int} input_goods_id 订单商品ID
  387. * @apiParam {String} pic_name 投诉凭证 用,分隔多个投诉凭证
  388. * @apiParam {String} input_complain_subject 投诉主题
  389. * @apiParam {String} input_complain_content 投诉内容
  390. *
  391. * @apiSuccess {String} code 返回码,10000为成功
  392. * @apiSuccess {String} message 返回消息
  393. */
  394. public function complain_save() {
  395. //获取输入的投诉信息
  396. $input = array();
  397. $input['order_id'] = intval(input('post.input_order_id'));
  398. $input['order_goods_id'] = intval(input('post.input_goods_id'));
  399. $pic_name = input('post.pic_name/a');
  400. $condition = array();
  401. $condition[] = array('buyer_id', '=', $this->member_info['member_id']);
  402. $condition[] = array('order_id', '=', $input['order_id']);
  403. $order_model = model('order');
  404. $order_info = $order_model->getOrderInfo($condition);
  405. $if_complain = $order_model->getOrderOperateState('complain', $order_info); //检查订单是否可以投诉
  406. if ($if_complain < 1) {
  407. ds_json_encode(10001, lang('param_error'));
  408. }
  409. //检查是不是正在进行投诉
  410. if ($this->check_complain_exist($input['order_goods_id'])) {
  411. ds_json_encode(10001, lang('complain_repeat'));
  412. }
  413. list($input['complain_subject_id'], $input['complain_subject_content']) = explode(',', trim(input('post.input_complain_subject')));
  414. $input_complain_content=trim(input('post.input_complain_content'));
  415. $res=word_filter($input_complain_content);
  416. if(!$res['code']){
  417. ds_json_encode(10001,$res['msg']);
  418. }
  419. $input_complain_content=$res['data']['text'];
  420. $input['complain_content'] = $input_complain_content;
  421. $input['accuser_id'] = $order_info['buyer_id'];
  422. $input['accuser_name'] = $order_info['buyer_name'];
  423. $input['accused_id'] = $order_info['store_id'];
  424. $input['accused_name'] = $order_info['store_name'];
  425. $input['complain_datetime'] = TIMESTAMP;
  426. $input['complain_state'] = self::STATE_NEW;
  427. $input['complain_active'] = self::STATE_UNACTIVE;
  428. $input['complain_pic1'] = isset($pic_name[0]) ? $pic_name[0] : '';
  429. $input['complain_pic2'] = isset($pic_name[1]) ? $pic_name[1] : '';
  430. $input['complain_pic3'] = isset($pic_name[2]) ? $pic_name[2] : '';
  431. $complain_model = model('complain');
  432. $state = $complain_model->addComplain($input); //保存投诉信息
  433. if ($state) {
  434. ds_json_encode(10000, lang('complain_submit_success'));
  435. } else {
  436. ds_json_encode(10001, lang('ds_common_op_fail'));
  437. }
  438. }
  439. /**
  440. * @api {POST} api/Membercomplain/complain_cancel 取消用户提交的投诉
  441. * @apiVersion 1.0.0
  442. * @apiGroup Membercomplain
  443. *
  444. * @apiHeader {String} X-DS-KEY 用户授权token
  445. *
  446. * @apiParam {Int} complain_id 投诉ID
  447. *
  448. * @apiSuccess {String} code 返回码,10000为成功
  449. * @apiSuccess {String} message 返回消息
  450. */
  451. public function complain_cancel() {
  452. $complain_id = intval(input('param.complain_id'));
  453. $complain_info = $this->get_complain_info($complain_id);
  454. if (intval($complain_info['complain_state']) === 10) {
  455. $pics = array();
  456. if (!empty($complain_info['complain_pic1']))
  457. $pics[] = $complain_info['complain_pic1'];
  458. if (!empty($complain_info['complain_pic2']))
  459. $pics[] = $complain_info['complain_pic2'];
  460. if (!empty($complain_info['complain_pic3']))
  461. $pics[] = $complain_info['complain_pic3'];
  462. if (!empty($pics)) {//删除图片
  463. foreach ($pics as $pic) {
  464. $pic = BASE_UPLOAD_PATH . DIRECTORY_SEPARATOR . ATTACH_PATH . DIRECTORY_SEPARATOR . 'complain' . DIRECTORY_SEPARATOR . $pic;
  465. if (file_exists($pic)) {
  466. @unlink($pic);
  467. }
  468. }
  469. }
  470. $complain_model = model('complain');
  471. $complain_model->delComplain(array('complain_id' => $complain_id));
  472. ds_json_encode(10000, lang('complain_cancel_success'));
  473. } else {
  474. ds_json_encode(10001, lang('complain_cancel_fail'));
  475. }
  476. }
  477. /**
  478. * @api {POST} api/Membercomplain/apply_handle 处理用户申请仲裁
  479. * @apiVersion 1.0.0
  480. * @apiGroup Membercomplain
  481. *
  482. * @apiHeader {String} X-DS-KEY 用户授权token
  483. *
  484. * @apiParam {Int} input_complain_id 投诉ID
  485. *
  486. * @apiSuccess {String} code 返回码,10000为成功
  487. * @apiSuccess {String} message 返回消息
  488. */
  489. public function apply_handle() {
  490. $complain_id = intval(input('post.input_complain_id'));
  491. //获取投诉详细信息
  492. $complain_info = $this->get_complain_info($complain_id);
  493. $complain_state = intval($complain_info['complain_state']);
  494. //检查当前是不是投诉状态
  495. if ($complain_state < self::STATE_TALK || $complain_state === 99) {
  496. ds_json_encode(10001, lang('param_error'));
  497. }
  498. $update_array = array();
  499. $update_array['complain_state'] = self::STATE_HANDLE;
  500. $condition = array();
  501. $condition[] = array('complain_id', '=', $complain_id);
  502. //保存投诉信息
  503. $complain_model = model('complain');
  504. $complain_model->editComplain($update_array, $condition);
  505. ds_json_encode(10000, lang('handle_submit_success'));
  506. }
  507. /**
  508. * @api {POST} api/Membercomplain/get_complain_talk 根据投诉id获取投诉对话
  509. * @apiVersion 1.0.0
  510. * @apiGroup Membercomplain
  511. *
  512. * @apiHeader {String} X-DS-KEY 用户授权token
  513. *
  514. * @apiParam {Int} complain_id 投诉ID
  515. *
  516. * @apiSuccess {String} code 返回码,10000为成功
  517. * @apiSuccess {String} message 返回消息
  518. * @apiSuccess {Object} result 返回数据
  519. * @apiSuccess {Object[]} result.talk_list 对话列表
  520. * @apiSuccess {String} result.talk_list.css 对话类型 admin管理员,accused被告人,accuser原告人
  521. * @apiSuccess {String} result.talk_list.talk 对话内容
  522. */
  523. public function get_complain_talk() {
  524. $complain_id = intval(input('post.complain_id'));
  525. $complain_info = $this->get_complain_info($complain_id);
  526. $complaintalk_model = model('complaintalk');
  527. $param = array();
  528. $param['complain_id'] = $complain_id;
  529. $complain_talk_list = $complaintalk_model->getComplaintalkList($param);
  530. $talk_list = array();
  531. $i = 0;
  532. foreach ($complain_talk_list as $talk) {
  533. $talk_list[$i]['css'] = $talk['talk_member_type'];
  534. $talk_list[$i]['talk'] = date("Y-m-d H:i:s", $talk['talk_datetime']);
  535. switch ($talk['talk_member_type']) {
  536. case 'accuser':
  537. $talk_list[$i]['talk'] .= lang('complain_accuser');
  538. break;
  539. case 'accused':
  540. $talk_list[$i]['talk'] .= lang('complain_accused');
  541. break;
  542. case 'admin':
  543. $talk_list[$i]['talk'] .= lang('complain_admin');
  544. break;
  545. default:
  546. $talk_list[$i]['talk'] .= lang('complain_unknow');
  547. }
  548. if (intval($talk['talk_state']) === 2) {
  549. $talk['talk_content'] = lang('talk_forbit_message');
  550. }
  551. $talk_list[$i]['talk'] .= '(' . $talk['talk_member_name'] . ')' . lang('complain_text_say') . ':' . $talk['talk_content'];
  552. $i++;
  553. }
  554. ds_json_encode(10000, '', array('talk_list' => $talk_list));
  555. }
  556. /**
  557. * @api {POST} api/Membercomplain/publish_complain_talk 根据发布投诉对话
  558. * @apiVersion 1.0.0
  559. * @apiGroup Membercomplain
  560. *
  561. * @apiHeader {String} X-DS-KEY 用户授权token
  562. *
  563. * @apiParam {Int} complain_id 投诉ID
  564. * @apiParam {String} complain_talk 对话内容
  565. *
  566. * @apiSuccess {String} code 返回码,10000为成功
  567. * @apiSuccess {String} message 返回消息
  568. */
  569. public function publish_complain_talk() {
  570. $complain_id = intval(input('post.complain_id'));
  571. $complain_talk = trim(input('post.complain_talk'));
  572. $talk_len = strlen($complain_talk);
  573. if ($talk_len > 0 && $talk_len < 255) {
  574. $complain_info = $this->get_complain_info($complain_id);
  575. $complain_state = intval($complain_info['complain_state']);
  576. //检查投诉是否是可发布对话状态
  577. if ($complain_state > self::STATE_APPEAL && $complain_state < self::STATE_FINISH) {
  578. $complaintalk_model = model('complaintalk');
  579. $param = array();
  580. $param['complain_id'] = $complain_id;
  581. $param['talk_member_id'] = $complain_info['accuser_id'];
  582. $param['talk_member_name'] = $complain_info['accuser_name'];
  583. $param['talk_member_type'] = $complain_info['member_status'];
  584. $param['talk_content'] = $complain_talk;
  585. $param['talk_state'] = 1;
  586. $param['talk_admin'] = 0;
  587. $param['talk_datetime'] = TIMESTAMP;
  588. if ($complaintalk_model->addComplaintalk($param)) {
  589. ds_json_encode(10000, ('talk_send_success'));
  590. } else {
  591. ds_json_encode(10001, ('talk_send_fail'));
  592. }
  593. } else {
  594. ds_json_encode(10001, lang('talk_state_error'));
  595. }
  596. } else {
  597. ds_json_encode(10001, lang('talk_null'));
  598. }
  599. }
  600. /*
  601. * 获取投诉信息
  602. */
  603. private function get_complain_info($complain_id) {
  604. $complain_model = model('complain');
  605. $complain_info = $complain_model->getOneComplain($complain_id);
  606. if ($complain_info['accuser_id'] != $this->member_info['member_id']) {
  607. ds_json_encode(10001, lang('param_error'));
  608. }
  609. $complain_info['member_status'] = 'accuser';
  610. $complain_info['complain_state_text'] = $this->get_complain_state_text($complain_info['complain_state']);
  611. return $complain_info;
  612. }
  613. /*
  614. * 检查投诉是否已经存在
  615. */
  616. private function check_complain_exist($goods_id) {
  617. $complain_model = model('complain');
  618. $param = array();
  619. $param[] = array('order_goods_id', '=', $goods_id);
  620. $param[] = array('accuser_id', '=', $this->member_info['member_id']);
  621. $param[] = array('complain_state', '<', 90);
  622. return $complain_model->isComplainExist($param);
  623. }
  624. /*
  625. * 获得投诉状态文本
  626. */
  627. private function get_complain_state_text($complain_state) {
  628. switch (intval($complain_state)) {
  629. case self::STATE_NEW:
  630. return lang('complain_state_new');
  631. break;
  632. case self::STATE_APPEAL:
  633. return lang('complain_state_appeal');
  634. break;
  635. case self::STATE_TALK:
  636. return lang('complain_state_talk');
  637. break;
  638. case self::STATE_HANDLE:
  639. return lang('complain_state_handle');
  640. break;
  641. case self::STATE_FINISH:
  642. return lang('complain_state_finish');
  643. break;
  644. default:
  645. ds_json_encode(10001, lang('param_error'));
  646. }
  647. }
  648. /**
  649. * @api {POST} api/Membercomplain/upload_pic 上传凭证
  650. * @apiVersion 1.0.0
  651. * @apiGroup Membercomplain
  652. *
  653. * @apiHeader {String} X-DS-KEY 用户授权token
  654. *
  655. * @apiParam {File} complain_pic 投诉凭证
  656. *
  657. * @apiSuccess {String} code 返回码,10000为成功
  658. * @apiSuccess {String} message 返回消息
  659. * @apiSuccess {Object} result 返回数据
  660. * @apiSuccess {String} result.file_name 文件名称
  661. * @apiSuccess {String} result.pic 文件完整路径
  662. */
  663. public function upload_pic() {
  664. if (!empty($_FILES['complain_pic']['name'])) {
  665. $file_name = $this->member_info['member_id'] . '_' . date('YmdHis') . rand(10000, 99999) . '.png';
  666. $res = ds_upload_pic(ATTACH_PATH . DIRECTORY_SEPARATOR . 'complain', 'complain_pic', $file_name);
  667. if ($res['code']) {
  668. $file_name = $res['data']['file_name'];
  669. } else {
  670. ds_json_encode(10001, $res['msg']);
  671. }
  672. $pic = ds_get_pic( ATTACH_PATH . DIRECTORY_SEPARATOR . 'complain' , $file_name);
  673. ds_json_encode(10000, '', array('file_name' => $file_name, 'pic' => $pic));
  674. } else {
  675. ds_json_encode(10001, lang('file_empty'));
  676. }
  677. }
  678. }
  679. ?>