GoodsorderrefundController.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * 退款协商历史
  4. */
  5. namespace app\appapi\controller;
  6. use cmf\controller\HomeBaseController;
  7. use think\facade\Db;
  8. class GoodsorderrefundController extends HomebaseController{
  9. function index(){
  10. $data = $this->request->param();
  11. $uid=isset($data['uid']) ? $data['uid']: '';
  12. $token=isset($data['token']) ? $data['token']: '';
  13. $orderid=isset($data['orderid']) ? $data['orderid']: '';
  14. $user_type=isset($data['user_type']) ? $data['user_type']: ''; //用户身份 buyer 买家 seller 卖家 platform 平台
  15. $uid=(int)checkNull($uid);
  16. $token=checkNull($token);
  17. $orderid=checkNull($orderid);
  18. if($user_type!='platform'){
  19. if( !$uid || !$token || checkToken($uid,$token)==700 ){
  20. $reason=lang('您的登陆状态失效,请重新登陆!');
  21. $this->assign('reason', $reason);
  22. return $this->fetch(':error');
  23. }
  24. }
  25. if(!$orderid || !$user_type ||!in_array($user_type, ['buyer','seller','platform'])){
  26. $reason=lang('参数错误');
  27. $this->assign('reason', $reason);
  28. return $this->fetch(':error');
  29. }
  30. $where=[];
  31. if($user_type=='buyer'){
  32. $where=array(
  33. 'id'=>$orderid,
  34. 'uid'=>$uid,
  35. );
  36. $where1=array(
  37. 'uid'=>$uid,
  38. 'orderid'=>$orderid
  39. );
  40. }else if($user_type=='sellers'){
  41. $where=array(
  42. 'id'=>$orderid,
  43. 'shop_uid'=>$uid,
  44. );
  45. $where1=array(
  46. 'orderid'=>$orderid,
  47. 'shop_uid'=>$uid,
  48. );
  49. }else{
  50. $where=array(
  51. 'id'=>$orderid
  52. );
  53. $where1=array(
  54. 'orderid'=>$orderid
  55. );
  56. }
  57. $orderinfo=getShopOrderInfo($where,"total");
  58. if(!$orderinfo){
  59. $reason=lang('订单不存在');
  60. $this->assign('reason', $reason);
  61. return $this->fetch(':error');
  62. }
  63. $refund_info=getShopOrderRefundInfo($where1);
  64. if(!$refund_info){
  65. $reason=lang('订单没有发起退款申请');
  66. $this->assign('reason', $reason);
  67. return $this->fetch(':error');
  68. }
  69. //查询退款协商历史
  70. $refund_list=getShopOrderRefundList(['orderid'=>$orderid]);
  71. $refund_info['total']=$orderinfo['total'];
  72. $this->assign("refund_info",$refund_info);
  73. $this->assign("refund_list",$refund_list); //协商历史
  74. $this->assign("uid",$uid);
  75. $this->assign("token",$token);
  76. return $this->fetch();
  77. }
  78. }