_valid([ "goods.require" => trans("empty.require"), "spm.default" => "", "option.default" => "" ],$request->method()); if (!is_array($param)) return error($param); $data = $this->model->where("goods_id",$param['goods'])->with(['poi' => function ($query) { $query->field("poi_id,poi_name,poi_address,longitude,latitude,service_mobile,start_at,end_at,status"); },'skuSpecs'])->append(['otherImg'])->withAttr(['otherImg' => function ($qu,$resp) { $img = json_decode($resp['image_list'],true); return array_map(function ($v) { return $v['url']; }, $img); }])->findOrEmpty(); if ($data->isEmpty()) return errorTrans("empty.data"); if ($data['poi']['status'] <> 1) return error("该店铺已关闭,请联系管理员"); if (!empty($data['content'])) { $data['content'] = filterHtmlTags($data['content'],[ 'img' => [ 'remove' => ['width', 'height'], 'style' => ['width' => '100%'] ], 'p' => [ 'style' => ['margin' => '0'] ] ]); } return $this->encode("success",$data->toArray()); } catch (\Throwable $th) { return error($th->getMessage()); } } #[GetMapping("check")] public function checkGoodsUser (Request $request): Response { try { $user = (new SaasUserOpen)->where(['openid' => $request->user['openid']])->findOrEmpty(); if ($user->isEmpty()) return error("数据错误"); $userState = 1; if (empty($user['avatar'])) { $userState = 0; } return success("ok",['user' => $userState]); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } }