| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\api\controller\ps;
- use app\common\controller\Api;
- use app\common\library\ps\FactoryContext;
- use think\Db;
- /**
- * 工厂端 AI 识版
- */
- class AiJob extends Api
- {
- protected $noNeedRight = '*';
- public function _initialize()
- {
- parent::_initialize();
- if (!FactoryContext::id()) {
- $this->error('账号未绑定工厂');
- }
- }
- /**
- * 上传后的原稿提交识版。视觉模型要 1~3 分钟,后台跑完后前端轮询 status。
- */
- public function recognize()
- {
- $this->error('模板上传和识版已改到管理后台,工厂端不再上传模板');
- }
- /**
- * 查询识版进度
- */
- public function status()
- {
- $id = $this->request->request('id/d');
- $job = Db::name('ps_ai_job')
- ->where('id', $id)
- ->where('factory_id', FactoryContext::id())
- ->find();
- if (!$job) {
- $this->error(__('No Results were found'));
- }
- $this->success('', [
- 'id' => (int)$job['id'],
- 'status' => (string)$job['status'],
- 'template_id' => (int)$job['template_id'],
- 'error_msg' => (string)$job['error_msg'],
- ]);
- }
- }
|