glhcp/server/app/admin/controller/integral/IntegralOrder.php

161 lines
5.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<?php
// +----------------------------------------------------------------------
// | likeshop开源商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | gitee下载https://gitee.com/likeshop_gitee
// | github下载https://github.com/likeshop-github
// | 访问官网https://www.likeshop.cn
// | 访问社区https://home.likeshop.cn
// | 访问手册http://doc.likeshop.cn
// | 微信公众号likeshop技术社区
// | likeshop系列产品在gitee、github等公开渠道开源版本可免费商用未经许可不能去除前后端官方版权标识
// | likeshop系列产品收费版本务必购买商业授权购买去版权授权后方可去除前后端官方版权标识
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | likeshop团队版权所有并拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshop.cn.team
// +----------------------------------------------------------------------
namespace app\admin\controller\integral;
use app\admin\logic\integral\IntegralOrderLogic;
use app\admin\validate\integral\IntegralOrderValidate;
use app\common\basics\AdminBase;
use app\common\enum\IntegralGoodsEnum;
use app\common\enum\IntegralOrderEnum;
use app\common\server\JsonServer;
class IntegralOrder extends AdminBase
{
/**
* @notes 兑换订单列表
* @return \think\response\Json|\think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/3 10:38 上午
*/
public function lists()
{
if ($this->request->isAjax()) {
$get = $this->request->get();
return JsonServer::success('', IntegralOrderLogic::lists($get));
}
// 订单状态
$order_status = IntegralOrderEnum::getOrderStatus(true);
// 兑换类型
$type = IntegralGoodsEnum::getTypeDesc(true);
return view('', [
'order_status' => $order_status,
'type' => $type,
]);
}
/**
* @notes 兑换订单详情
* @return \think\response\View
* @author ljj
* @date 2022/3/3 11:10 上午
*/
public function detail()
{
$id = $this->request->get('id');
$detail = IntegralOrderLogic::detail($id);
return view('', [
'detail' => $detail,
]);
}
/**
* @notes 发货详情
* @return \think\response\View
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author ljj
* @date 2022/3/3 11:48 上午
*/
public function delivery()
{
$id = $this->request->get('id');
$detail = IntegralOrderLogic::deliveryDetail($id);
$express = IntegralOrderLogic::express();
return view('', [
'detail' => $detail,
'express' => $express
]);
}
/**
* @notes 发货操作
* @return \think\response\Json|void
* @author ljj
* @date 2022/3/3 2:53 下午
*/
public function deliveryHandle()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
(new IntegralOrderValidate())->goCheck('deliveryHandle', $post);
$result = IntegralOrderLogic::deliveryHandle($post,$this->adminId);
if (true !== $result) {
return JsonServer::error($result);
}
return JsonServer::success('发货成功');
}
}
/**
* @notes 物流信息
* @return \think\response\View
* @author ljj
* @date 2022/3/3 3:32 下午
*/
public function express()
{
$id = $this->request->get('id');
$detail = IntegralOrderLogic::detail($id);
$detail['shipping'] = IntegralOrderLogic::shippingInfo($detail['id']);
return view('', [
'detail' => $detail
]);
}
/**
* @notes 确认收货
* @return \think\response\Json|void
* @author ljj
* @date 2022/3/3 3:39 下午
*/
public function confirm()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
(new IntegralOrderValidate())->goCheck('confirm', $post);
IntegralOrderLogic::confirm($post['id'],$this->adminId);
return JsonServer::success('确认成功');
}
}
/**
* @notes 取消订单
* @return \think\response\Json|void
* @author 段誉
* @date 2022/3/3 18:00
*/
public function cancel()
{
if ($this->request->isAjax()) {
$post = $this->request->post();
(new IntegralOrderValidate())->goCheck('cancel', $post);
IntegralOrderLogic::cancel($post['id']);
return JsonServer::success('取消成功');
}
}
}