155 lines
3.9 KiB
PHP
155 lines
3.9 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller\retail;
|
|
|
|
|
|
use app\admin\controller\BaseAdminController;
|
|
use app\admin\lists\retail\CashierclassLists;
|
|
use app\admin\logic\retail\CashierclassLogic;
|
|
use app\admin\logic\retail\CashierinfoLogic;
|
|
use app\admin\validate\retail\CashierclassValidate;
|
|
use app\common\model\retail\Cashierclass;
|
|
use Webman\RedisQueue\Redis;
|
|
|
|
/**
|
|
* 零售订单控制器
|
|
* Class CashierclassController
|
|
* @package app\admin\controller\retail
|
|
*/
|
|
class CashierclassController extends BaseAdminController
|
|
{
|
|
|
|
|
|
/**
|
|
* @notes 获取零售订单列表
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function lists()
|
|
{
|
|
return $this->dataLists(new CashierclassLists());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 添加零售订单
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function add()
|
|
{
|
|
$params = (new CashierclassValidate())->post()->goCheck('add');
|
|
$result = CashierclassLogic::add($params);
|
|
if (true === $result) {
|
|
return $this->success('添加成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CashierclassLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 编辑零售订单
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function edit()
|
|
{
|
|
$params = (new CashierclassValidate())->post()->goCheck('edit');
|
|
$result = CashierclassLogic::edit($params);
|
|
if (true === $result) {
|
|
return $this->success('编辑成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CashierclassLogic::getError());
|
|
}
|
|
|
|
/**
|
|
* @notes 审核零售订单
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function auditing()
|
|
{
|
|
$params = (new CashierclassValidate())->post()->goCheck('auditing');
|
|
$result = CashierclassLogic::auditing($params, $this->adminId);
|
|
if (true === $result) {
|
|
return $this->success('审核成功', [], 1, 1);
|
|
}
|
|
return $this->fail(CashierclassLogic::getError());
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除零售订单
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function delete()
|
|
{
|
|
$params = (new CashierclassValidate())->post()->goCheck('delete');
|
|
CashierclassLogic::delete($params);
|
|
return $this->success('删除成功', [], 1, 1);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 获取零售订单详情
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function detail()
|
|
{
|
|
$params =$this->request->get();
|
|
$result = CashierclassLogic::detail($params);
|
|
return $this->data($result);
|
|
}
|
|
|
|
/**
|
|
* @notes 设置打印
|
|
* @return \think\response\Json
|
|
* @author likeadmin
|
|
* @date 2024/04/24 09:57
|
|
*/
|
|
public function set_print()
|
|
{
|
|
$id = $this->request->get('id');
|
|
if ($id) {
|
|
$res = Cashierclass::where('id', $id)->update(['is_print' => 1]);
|
|
if ($res) {
|
|
return $this->success('设置成功');
|
|
}
|
|
}
|
|
return $this->success('设置失败');
|
|
}
|
|
|
|
/**
|
|
* @notes 打印小票
|
|
* @return \think\response\Json
|
|
*/
|
|
public function prints()
|
|
{
|
|
$id = $this->request->get('id');
|
|
$is_push = $this->request->get('is_push',0);
|
|
if (!$id) {
|
|
return $this->fail('参数错误');
|
|
}
|
|
if($is_push==0){
|
|
Redis::send('push-platform-print', ['order_id' => $id]);
|
|
return $this->success('正在打印中');
|
|
}else{
|
|
$res=CashierclassLogic::prints($id);
|
|
if(CashierclassLogic::hasError()){
|
|
return $this->fail('打印失败');
|
|
}else{
|
|
return $this->success('ok',$res);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|