first(); $affiche = []; if ($data->affiche) { $affiche[] = imgtxt($data->affiche); } if ($data->affiche_one) { $affiche[] = imgtxt($data->affiche_one); } if ($data->affiche_two) { $affiche[] = imgtxt($data->affiche_two); } if ($data->affiche_three) { $affiche[] = imgtxt($data->affiche_three); } $articledata = Db::table('wa_article') ->where('article_type_id', 2) ->select(['id', 'name', 'describe', 'img', 'created_at']) ->orderBy('id') ->get()->toArray(); return success([ 'association' => imgtxt($data->association), 'service' => $data->service, 'affiche' => $affiche, 'mp4' => getenv('MP4'), 'company_introduction' => imgtxt($data->company_introduction), 'corporate_governance' => imgtxt($data->corporate_governance), 'public_policy' => imgtxt($data->public_policy), 'compliance_and_integrity' => imgtxt($data->compliance_and_integrity), 'intelligent_world' => imgtxt($data->intelligent_world), 'micro_chat' => $data->micro_chat, 'booster_potato' => $data->booster_potato, 'service_txt' => imgtxt($data->service_txt), 'article_data' => $articledata, ]); } #[Apidoc\Title("新闻列表")] #[Apidoc\Url("api/config/article.html")] #[Apidoc\Method("POST")] #[Apidoc\Param("page", type: "int", require: true, desc: "页面", mock: 1)] #[Apidoc\Param("limit", type: "int", require: true, desc: "输出条数", mock: 10)] #[Apidoc\Returned(name: "id", type: "int", require: true, desc: '文章ID', default: '')] #[Apidoc\Returned(name: "name", type: "string", require: true, desc: '文章标题', default: '')] #[Apidoc\Returned(name: "describe", type: "string", require: true, desc: '文章描述', default: '')] #[Apidoc\Returned(name: "img", type: "string", require: true, desc: '文章封面图', default: '')] #[Apidoc\Returned(name: "created_at", type: "string", require: true, desc: '创建时间', default: '')] #[Apidoc\Returned(name: "article_type_id", type: "string", require: true, desc: '1=新闻中心,2=热门话题', default: '')] public function article(Request $request) { try { $param = $request->param_data; Validator::input($param, [ 'page' => Validator::notEmpty()->intType()->setName('页面'), 'limit' => Validator::notEmpty()->intType()->setName('输出条数'), ]); $data = Db::table('wa_article') ->where('article_type_id', 1) ->select(['id', 'name', 'describe', 'img', 'created_at']) ->orderBy('id') ->paginate(Arr::get($param, 'limit', 10))->toArray(); foreach ($data['data'] as $k => $v) { $data['data'][$k]->img = imageToBase64( $v->img); } } catch (\Throwable $exception) { return error($exception->getMessage()); } return success($data); } #[Apidoc\Title("新闻详情")] #[Apidoc\Url("api/config/articledetails.html")] #[Apidoc\Method("POST")] #[Apidoc\Param("id", type: "int", require: true, desc: "文章ID", mock: 20)] #[Apidoc\Returned(name: "name", type: "string", require: true, desc: '文章标题', default: '')] #[Apidoc\Returned(name: "txt", type: "string", require: true, desc: '文章详情【富文本内容】', default: '')] public function articleDetails(Request $request) { try { $param = $request->param_data; Validator::input($param, [ 'id' => Validator::notEmpty()->intType()->setName('文章ID'), ]); $data = Db::table('wa_article')->where('id', $param['id'])->select(['txt', 'name'])->first(); $data->txt = imgtxt($data->txt); } catch (\Throwable $exception) { return error($exception->getMessage()); } return success($data); } #[Apidoc\Title("支付通道")] #[Apidoc\Url("api/config/pay_aisle.html")] #[Apidoc\Method("POST")] #[Apidoc\Returned(name: "name", type: "string", require: true, desc: '名称', default: '支付宝')] #[Apidoc\Returned(name: "characteristic", type: "int", require: true, desc: '支付标识', default: '1')] #[Apidoc\Returned(name: "type", type: "int", require: true, desc: '渠道类型', default: '1')] #[Apidoc\Returned(name: "img", type: "string", require: true, desc: '图标', default: '')] public function payAisle() { $data = Db::table('wa_pay_aisle')->where('state', 1)->orderBy('sort')->select(['name', 'characteristic', 'type', 'img'])->get(); foreach ($data as $k => $v) { $data[$k]->img = imageToBase64($v->img); } return success($data); } }