// +---------------------------------------------------------------------- declare (strict_types=1); namespace app\store\controller\card; use think\response\Json; use app\store\controller\Controller; use app\store\model\card\CardPrint as CardPrintModel; use cores\exception\BaseException; /** * 实体卡打印下载控制器 * Class CardPrint * @package app\store\controller\order */ class CardPrint extends Controller { /** * 订单导出记录 * @return Json * @throws \think\db\exception\DbException */ public function list(): Json { $model = new CardPrintModel; $list = $model->getList($this->request->param()); return $this->renderSuccess(compact('list')); } /** * 修改打印记录下载状态 * @return Json */ public function changeState(): Json { $post = $this->postData(); $is_download = $post['state']?1:0; // 商品详情 foreach ((array)$post['printIds'] as $print_id) { $model = CardPrintModel::detail($print_id); if (!$model->changeStatus($is_download)) { return $this->renderError('修改状态失败'); } } return $this->renderSuccess($post); } }