| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- <?php
- namespace app\controller\api;
- use app\extra\basic\Base;
- use app\middleware\AuthMiddleware;
- use app\model\saas\SaasStore;
- use app\model\system\SystemUser;
- use LinFly\Annotation\Attributes\Route\Controller;
- use LinFly\Annotation\Attributes\Route\GetMapping;
- use LinFly\Annotation\Attributes\Route\Middleware;
- use LinFly\Annotation\Attributes\Route\PostMapping;
- use support\Request;
- use support\Response;
- #[Controller("/dy/service"),Middleware(AuthMiddleware::class)]
- class Service extends Base
- {
- /**
- * 获取客服列表-已聊过的
- * @param Request $request
- * @return Response|void
- */
- #[GetMapping("list")]
- public function getServiceList(Request $request)
- {
- try {
-
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- /**
- * 分配客服
- * @param Request $request
- * @return Response
- */
- #[PostMapping("shareout")]
- public function shareUser2Mer(Request $request): Response
- {
- try {
- $param = $request->all();
- $store = (new SaasStore)->where("poi_id",$param['poi'])->findOrEmpty();
- if ($store->isEmpty()) return error("店铺不存在");
- // 获取在线客服
- $service = (new SystemUser)->where("store_id",$param['poi'])->where("type",3)->where("is_line",1)->findOrEmpty();
- if ($service->isEmpty()) return $this->encode("ok",['store' => $store,'code' => 3]); // 无客服在线
- return $this->encode("ok",['store' => $store,'code' => 1]); // 客服在线
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|