kefu.php 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. use app\http\middleware\InstallMiddleware;
  12. use think\Response;
  13. use think\facade\Route;
  14. use think\facade\Config;
  15. use app\http\middleware\AllowOriginMiddleware;
  16. use app\http\middleware\kefu\KefuAuthTokenMiddleware;
  17. /**
  18. * 客服端路由配置
  19. */
  20. Route::group('kefuapi', function () {
  21. Route::any('ticket/[:appid]', 'Login/ticket');
  22. //获取去版权信息
  23. Route::get('copyright', 'Common/getCopyright')->name('getCopyright');
  24. Route::group(function () {
  25. Route::post('login', 'Login/login')->name('kefuLogin');//账号登录
  26. Route::get('key', 'Login/getLoginKey')->name('getLoginKey');//获取扫码登录key
  27. Route::get('scan/:key', 'Login/scanLogin')->name('scanLogin');//检测扫码情况
  28. Route::get('config', 'Login/getAppid')->name('getAppid');//获取配置
  29. Route::get('wechat', 'Login/wechatAuth')->name('wechatAuth');//微信扫码登录
  30. Route::group(function () {
  31. Route::post('upload', 'User/upload')->name('upload');//上传图片
  32. //获取ERP开关配置
  33. Route::get('erp/config', 'Common/getErpConfig')->option(['real_name' => '获取ERP开关配置']);
  34. })->middleware(KefuAuthTokenMiddleware::class);
  35. Route::group('user', function () {
  36. Route::get('record', 'User/recordList')->name('recordList');//和客服聊天过的用户
  37. Route::get('info/:uid', 'User/userInfo')->name('getUserInfo');//用户详细信息
  38. Route::get('label/:uid', 'User/getUserLabel')->name('getUserLabel');//用户标签
  39. Route::put('label/:uid', 'User/setUserLabel')->name('setUserLabel');//设置用户标签
  40. Route::get('group', 'User/getUserGroup')->name('getUserGroup');//退出登录
  41. Route::put('group/:uid/:id', 'User/setUserGroup')->name('setUserGroup');//退出登录
  42. Route::post('logout', 'User/logout')->name('logout');//退出登录
  43. })->middleware(KefuAuthTokenMiddleware::class);
  44. Route::group('order', function () {
  45. Route::get('list/:uid', 'Order/getUserOrderList')->name('getUserOrderList');//订单列表
  46. Route::get('refund/detail/:id', 'Order/refundDetail')->name('refundDetail');//退款订单详情
  47. Route::post('delivery/:id', 'Order/delivery_keep')->name('orderDeliveryKeep');//订单发货
  48. Route::put('update/:id', 'Order/update')->name('orderUpdate');//订单修改
  49. Route::post('refund', 'Order/refund')->name('orderRefund');//订单退款
  50. Route::get('refund_form/:id', 'Order/refund')->name('orderRefund');//主动订单退款
  51. Route::get('edit/:id', 'Order/edit')->name('orderEdit');//订单退款
  52. Route::post('remark', 'Order/remark')->name('remark');//订单备注
  53. Route::get('info/:id', 'Order/orderInfo')->name('orderInfo');//获取订单详情
  54. Route::get('export', 'Order/export')->name('export');//获取订单详情
  55. Route::get('temp', 'Order/getExportTemp')->name('getExportTemp');//获取物流公司模板
  56. Route::get('delivery_all', 'Order/getDeliveryAll')->name('getDeliveryAll');//获取配送员列表全部
  57. Route::get('delivery_info', 'Order/getDeliveryInfo')->name('getDeliveryInfo');//获取配送员列表全部
  58. Route::get('verific/:id', 'Order/order_verific')->name('orderVerific');//单个订单号进行核销
  59. Route::get('writeOff/cartInfo', 'Order/orderCartInfo')->name('writeOrderCartInfo');//获取核销订单商品信息
  60. Route::put('write_update/:order_id', 'Order/wirteoff')->name('writeOrderUpdate');//订单号核销
  61. Route::get('split_cart_info/:id', 'Order/split_cart_info')->name('StoreOrderSplitCartInfo');//获取订单可拆分商品列表
  62. Route::put('split_delivery/:id', 'Order/split_delivery')->name('StoreOrderSplitDelivery');//拆单发送货
  63. })->middleware(KefuAuthTokenMiddleware::class);
  64. Route::group('product', function () {
  65. Route::get('hot/:uid', 'Product/getProductHotSale')->name('getProductHotSale');//热销商品
  66. Route::get('visit/:uid', 'Product/getVisitProductList')->name('getVisitProductList');//商品足记
  67. Route::get('cart/:uid', 'Product/getCartProductList')->name('getCartProductList');//购买记录
  68. Route::get('info/:id', 'Product/getProductInfo')->name('getProductInfo');//商品详情
  69. })->middleware(KefuAuthTokenMiddleware::class);
  70. Route::group('service', function () {
  71. Route::get('list', 'Service/getChatList')->name('getChatList');//聊天记录
  72. Route::get('info', 'Service/getServiceInfo')->name('getServiceInfo');//客服详细信息
  73. Route::get('speechcraft', 'Service/getSpeechcraftList')->name('getSpeechcraftList');//客服话术
  74. Route::post('transfer', 'Service/transfer')->name('transfer');//客服转接
  75. Route::get('transfer_list', 'Service/getServiceList')->name('getServiceList');//客服转接
  76. Route::get('cate', 'Service/getCateList')->name('getCateList');//分类列表
  77. Route::post('cate', 'Service/saveCate')->name('saveCate');//保存分类
  78. Route::put('cate/:id', 'Service/editCate')->name('editCate');//编辑分类
  79. Route::delete('cate/:id', 'Service/deleteCate')->name('deleteCate');//删除分类
  80. Route::post('speechcraft', 'Service/saveSpeechcraft')->name('saveSpeechcraft');//添加话术
  81. Route::put('speechcraft/:id', 'Service/editSpeechcraft')->name('editSpeechcraft');//修改话术
  82. Route::delete('speechcraft/:id', 'Service/deleteSpeechcraft')->name('deleteSpeechcraft');//删除话术
  83. })->middleware(KefuAuthTokenMiddleware::class);
  84. Route::group('tourist', function () {
  85. Route::get('user', 'Common/getServiceUser')->name('getServiceUser');//随机客服信息
  86. Route::get('adv', 'Common/getKfAdv')->name('getKfAdv');//获取客服广告
  87. Route::post('feedback', 'Common/saveFeedback')->name('saveFeedback');//保存客服反馈内容
  88. Route::get('feedback', 'Common/getFeedbackInfo')->name('getFeedbackInfo');//获取反馈页面广告位内容
  89. Route::get('order/:order_id', 'Common/getOrderInfo')->name('getOrderInfo');//获取订单信息
  90. Route::get('product/:id', 'Common/getProductInfo')->name('getProductInfo');//获取商品信息
  91. Route::get('chat', 'Common/getChatList')->name('getChatList');//获取聊天记录
  92. Route::post('upload', 'Common/upload')->name('upload');//图片上传
  93. });
  94. /**
  95. * 售后 相关路由
  96. */
  97. Route::group('refund', function () {
  98. //售后列表
  99. Route::get('list', 'RefundOrder/getRefundList')->option(['real_name' => '售后订单列表']);
  100. //商家同意退款,等待用户退货
  101. Route::get('agree/:order_id', 'RefundOrder/agreeRefund')->option(['real_name' => '商家同意退款,等待用户退货']);
  102. //售后订单备注
  103. Route::post('remark/:id', 'RefundOrder/remark')->option(['real_name' => '售后订单备注']);
  104. //售后订单退款表单
  105. Route::get('refund/:id', 'RefundOrder/refund')->name('StoreOrderRefund')->option(['real_name' => '售后订单退款表单']);
  106. //售后订单退款
  107. Route::put('refund/:id', 'RefundOrder/update_refund')->name('StoreOrderUpdateRefund')->option(['real_name' => '售后订单退款']);
  108. })->middleware(KefuAuthTokenMiddleware::class);
  109. })->middleware(AllowOriginMiddleware::class);
  110. Route::miss(function () {
  111. if (app()->request->isOptions()) {
  112. $header = Config::get('cookie.header');
  113. $header['Access-Control-Allow-Origin'] = app()->request->header('origin');
  114. return Response::create('ok')->code(200)->header($header);
  115. } else
  116. return Response::create()->code(404);
  117. });
  118. })->prefix('kefu.')->middleware(InstallMiddleware::class);