12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\api\controller;
- use app\api\controller\Base;
- use think\Db;
- use hg\apidoc\annotation as Apidoc;
- /**
- * @Apidoc\Title("申购模块")
- * @Apidoc\Group("api")
- */
- class Subscribe extends Base
- {
- public function initialize()
- {
- parent::initialize();
- parent::checkLogin();
- }
- /**
- * @Apidoc\Title("获取商品导入模板地址")
- * @Apidoc\Desc("获取审批流程")
- * @Apidoc\Method("GET")
- * @Apidoc\Author("HG")
- * @Apidoc\Tag("")
- * @Apidoc\Returned("", type="string", desc="模板链接地址")
- */
- public function template_url()
- {
- $url = 'https://'.$_SERVER['HTTP_HOST'].'/template.xlsx';
- $this->success('获取成功',$url);
- }
- /**
- * @Apidoc\Title("获取商品导入后的商品信息")
- * @Apidoc\Desc("获取审批流程")
- * @Apidoc\Method("GET")
- * @Apidoc\Author("HG")
- * @Apidoc\Tag("")
- * @Apidoc\Query("url", type="string", desc="导入文件上传后的路径")
- * @Apidoc\Returned("", type="string", desc="模板链接地址")
- */
- public function goods_info()
- {
- $url = input('url');
- $import_path = $_SERVER['DOCUMENT_ROOT'].'/upload/excel/template.xlsx';
- $objReader =\PHPExcel_IOFactory::createReader('Excel2007');
- $objExcel = $objReader->load($import_path);
- $list = $objExcel->getActiveSheet()->toArray();
- var_dump($list);exit();
- $this->success('获取成功',$url);
- }
- }
|