vr-shopxo-source/app/api/controller/Orderaftersale.php

148 lines
4.0 KiB
PHP
Raw Normal View History

2019-10-04 12:50:14 +00:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
2019-10-04 12:50:14 +00:00
// +----------------------------------------------------------------------
2021-03-16 02:34:52 +00:00
// | Licensed ( https://opensource.org/licenses/mit-license.php )
2019-10-04 12:50:14 +00:00
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\api\controller;
2021-07-20 15:45:54 +00:00
use app\service\ApiService;
2021-04-11 07:51:06 +00:00
use app\service\SystemBaseService;
2019-10-04 12:50:14 +00:00
use app\service\OrderAftersaleService;
2021-01-27 14:21:04 +00:00
use app\service\ResourcesService;
2019-10-04 12:50:14 +00:00
/**
* 订单售后
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2019-10-04T21:51:08+0800
*/
class Orderaftersale extends Common
{
/**
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-11-30
* @desc description
*/
public function __construct()
{
parent::__construct();
// 是否登录
$this->IsLogin();
}
/**
2026-03-04 02:21:47 +00:00
* 列表
2019-10-04 12:50:14 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-28
* @desc description
*/
public function Index()
{
// 参数
$params = $this->data_request;
2019-10-04 12:50:14 +00:00
$params['user'] = $this->user;
$params['user_type'] = 'user';
// 条件
2019-10-07 09:25:46 +00:00
$where = OrderAftersaleService::OrderAftersaleListWhere($params);
2019-10-04 12:50:14 +00:00
// 获取总数
$total = OrderAftersaleService::OrderAftersaleTotal($where);
2023-08-27 08:59:15 +00:00
$page_total = ceil($total/$this->page_size);
$start = intval(($this->page-1)*$this->page_size);
2019-10-04 12:50:14 +00:00
// 获取列表
2023-08-27 08:59:15 +00:00
$data_params = [
2026-03-04 02:21:47 +00:00
'm' => $start,
'n' => $this->page_size,
'where' => $where,
2023-08-27 08:59:15 +00:00
];
2019-10-04 12:50:14 +00:00
$data = OrderAftersaleService::OrderAftersaleList($data_params);
// 返回数据
$result = [
2021-01-06 13:26:19 +00:00
'total' => $total,
'page_total' => $page_total,
'data' => $data['data'],
2019-10-04 12:50:14 +00:00
];
2021-07-20 15:45:54 +00:00
return ApiService::ApiDataReturn(SystemBaseService::DataReturn($result));
2019-10-04 12:50:14 +00:00
}
/**
2026-03-04 02:21:47 +00:00
* 详情
2019-10-04 12:50:14 +00:00
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-05-21
* @desc description
*/
2026-03-04 02:21:47 +00:00
public function Detail()
2019-10-04 12:50:14 +00:00
{
2026-03-04 02:21:47 +00:00
$params = $this->data_request;
$params['user'] = $this->user;
$ret = OrderAftersaleService::OrderAftersaleDetailData($params);
2019-10-04 12:50:14 +00:00
if($ret['code'] == 0)
{
2026-03-04 02:21:47 +00:00
$ret = SystemBaseService::DataReturn($ret['data'], $ret['msg'], $ret['code']);
2019-10-04 12:50:14 +00:00
}
2021-07-20 15:45:54 +00:00
return ApiService::ApiDataReturn($ret);
2019-10-04 12:50:14 +00:00
}
/**
* 申请售后创建
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-05-23
* @desc description
*/
public function Create()
{
$params = $this->data_request;
2019-10-04 12:50:14 +00:00
$params['user'] = $this->user;
2021-07-20 15:45:54 +00:00
return ApiService::ApiDataReturn(OrderAftersaleService::AftersaleCreate($params));
2019-10-04 12:50:14 +00:00
}
/**
* 用户退货
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2019-05-23
* @desc description
*/
public function Delivery()
{
$params = $this->data_request;
2019-10-04 12:50:14 +00:00
$params['user'] = $this->user;
2021-07-20 15:45:54 +00:00
return ApiService::ApiDataReturn(OrderAftersaleService::AftersaleDelivery($params));
2019-10-04 12:50:14 +00:00
}
/**
* 订单取消
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-09-30
* @desc description
*/
public function Cancel()
{
$params = $this->data_request;
2019-10-04 12:50:14 +00:00
$params['user'] = $this->user;
2021-07-20 15:45:54 +00:00
return ApiService::ApiDataReturn(OrderAftersaleService::AftersaleCancel($params));
2019-10-04 12:50:14 +00:00
}
}
?>