| 12345678910111213141516171819202122232425262728293031323334 | <?phpnamespace app\api\controller\scan;use app\model\SysDept;use support\Request;class QrcodeController{    public function index(Request $request)    {        $tableId = $request->get('tid','');        if (!empty($tableId)){            $table = SysDept::where('dept_id',$tableId)->where('dept_category','桌台')->first();            if (!$table){                echo "桌台不存在";                exit();            }            $qrcodeContent = [                'action'=>'scan-dishes',                'data'=>[                    'premises'=>$table->dept_super_id,                    'table'=>$table->dept_name,                    'dept'=>$table->dept_id                ]            ];            $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc6274da7198e3eb4&redirect_uri=https%3A%2F%2Fh5.wanyuewellness.com.cn%2F%23%2Fpages%2Findex%2FWeChatGuide?scan="            . urlencode(json_encode($qrcodeContent)).            "&response_type=code&scope=snsapi_base&connect_redirect=1&state=#wechat_redirect";            return redirect($url,302);        }    }}
 |