| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?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\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
- */
- #[PostMapping("shareout")]
- public function shareUser2Mer(Request $request)
- {
- 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]); // 无客服在线
- } catch (\Throwable $throwable) {
- return error($throwable->getMessage());
- }
- }
- }
|