57 lines
1.8 KiB
PHP
57 lines
1.8 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
|
|
// +----------------------------------------------------------------------
|
|
// | Author: 萤火科技 <admin@yiovo.com>
|
|
// +----------------------------------------------------------------------
|
|
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);
|
|
}
|
|
} |