1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace 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
- ]
- ];
- //https://h5.wanyuewellness.com.cn
- $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc6274da7198e3eb4&redirect_uri=".getenv('QRCODE_SCAN_DOMAIN')."%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);
- }
- }
- }
|