Files
duolamaojiazhen/application/api/controller/AfterSale.php
2025-12-22 13:59:40 +08:00

113 lines
3.4 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
// +----------------------------------------------------------------------
// | likeshop100%开源免费商用商城系统
// +----------------------------------------------------------------------
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
// | 开源版本可自由商用可去除界面版权logo
// | 商业版本务必购买商业授权,以免引起法律纠纷
// | 禁止对系统程序代码以任何目的,任何形式的再发布
// | 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团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | author: likeshopTeam
// +----------------------------------------------------------------------
namespace app\api\controller;
use think\Db;
use app\api\logic\AfterSaleLogic;
/**
* 售后
* Class Order
* @package app\api\controller
*/
class AfterSale extends ApiBase
{
public function lists()
{
$type = $this->request->get('type', 'normal');
$lists = AfterSaleLogic::lists($this->user_id, $type, $this->page_no, $this->page_size);
$this->_success('',$lists);
}
public function add()
{
$post = $this->request->post();
$post['user_id'] = $this->user_id;
$check = $this->validate($post, 'app\api\validate\AfterSale.add');
if (true !== $check) {
$this->_error($check);
}
return AfterSaleLogic::add($post, $this->user_id);
}
//售后商品信息
public function goodsInfo()
{
$get = $this->request->get();
$check = $this->validate($get, 'app\api\validate\AfterSale.info');
if (true !== $check) {
$this->_error($check);
}
$this->_success('', AfterSaleLogic::info($get['item_id'], $get['order_id']));
}
public function express()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\AfterSale.express');
if (true !== $check) {
$this->_error($check);
}
return AfterSaleLogic::express($this->user_id, $post);
}
public function cancel()
{
$post = $this->request->post();
$check = $this->validate($post, 'app\api\validate\AfterSale.cancel');
if (true !== $check) {
$this->_error($check);
}
AfterSaleLogic::cancel($this->user_id, $post);
$this->_success('撤销成功');
}
public function detail()
{
$get = $this->request->get();
$this->_success('', AfterSaleLogic::detail($get));
}
public function again()
{
$post = $this->request->post();
$order=Db::name('order')->where('id',$post['id'])->find();
if($order['refund_status']==2){
$this->_error('退款申请之中');
}
if($order['pay_status']!=1){
$this->_error('订单未支付,无法申请退款');
}
if($order['code']==0){
$this->_error('订单已完成,无法申请退款');
}
$ref=Db::name('order')->where('id',$post['id'])->update(['refund_status'=>2]);
$this->_success('申请成功');
}
}