user['agent_id']}-pay.jpg"; if (!is_file(public_path().$qrcodePath)) { (new Link([ "appid" => sConf("wechat.mini_appid"), "appsecret" => sConf("wechat.mini_secret") ]))->createQrcodeWx("/pages/shop/pay","shop={$request->user['agent_id']}",$qrcodePath); } $qrcode = 'data:image/png;base64,'.base64_encode(file_get_contents(public_path().$qrcodePath)); $shop = $this->model->where("shop_id",$request->user['agent_id'])->field("shop_name,shop_mobile,start_at,end_at,vip_end,shop_status,shop_notice,line_time,status,shop_address")->withAttr(['vip_end' => function($query,$data) { return date("Y-m-d",strtotime($data['vip_end'])); },'qrcode' => function () use ($qrcode){ return $qrcode; }])->findOrEmpty(); if ($shop->isEmpty()) return errorTrans("empty.data"); return success("ok",$shop->toArray()); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } #[Route(path: "save",methods: "post")] public function setData(Request $request) { try { $param = $request->post(); $shop = $this->model->where("shop_id",$request->user['agent_id'])->findOrEmpty(); if ($shop->isEmpty()) return errorTrans("empty.data"); $state = $shop->save($param); if (!$state) return errorTrans("error.data"); return successTrans("success.data"); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }