12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace app\controller;
- use app\BaseController;
- use app\service\GridService;
- use app\service\ProPchService;
- use app\validate\GridAdd;
- use app\validate\Id;
- use app\validate\ProPchAdd;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\annotation\Route;
- use think\annotation\route\Middleware;
- use hg\apidoc\annotation as Apidoc;
- use think\exception\ValidateException;
- use think\response\Json;
- /**
- * @Apidoc\Title("批次号信息")
- * @Apidoc\Group("pch")
- * @Apidoc\Sort(16)
- */
- class ProPch extends BaseController
- {
- use ResponseJson;
- //新增方法
- /**
- * @Apidoc\Author("ruicu")
- * @throws ModelNotFoundException
- * @throws DataNotFoundException
- * @throws DbException
- * @Apidoc\Title("生成批次号信息")
- * @Apidoc\Tag("生成批次号信息")
- * @Apidoc\Method ("POST")
- * @Route("/addpch",method="POST")
- * @Middleware({"jwt"})
- */
- public function addGrid(): Json
- {
- $info = $this->request->post();
- try {
- validate(ProPchAdd::class)->check($info);
- $info['creation_time'] = date('Y-m-d h:i:s', time());
- $info['last_update_time'] = date('Y-m-d h:i:s', time());
- $result = ProPchService::addProPch($info,$this->uuid());
- if (!$result){
- return $this->JsonError(1002);
- }
- }catch (ValidateException $e){
- return $this->JsonError($e->getError(),0);
- }
- return $this->JsonResponse(200,"success","");
- }
- }
|