// +---------------------------------------------------------------------- namespace app\controller\out; use app\Request; use app\services\out\OutAccountServices; use crmeb\basic\BaseController; use app\validate\out\LoginValidate; use think\facade\App; /** * Class Login * @package app\kefu\controller */ class OutAccount extends BaseController { /** * Login constructor. * @param App $app * @param OutAccountServices $services */ public function __construct(App $app, OutAccountServices $services) { parent::__construct($app); $this->services = $services; } /** * 客服登录 * @param Request $request * @return mixed * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException */ public function getToken(Request $request) { [$appid, $appsecret] = $request->postMore([ ['appid', ''], ['appsecret', ''], ], true); $this->validate(['appid' => $appid, 'appsecret' => $appsecret], LoginValidate::class); $token = $this->services->authLogin($appid, $appsecret); return $this->success('获取成功', $token); } }