You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
3.4 KiB
128 lines
3.4 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | Niucloud-admin 企业快速开发的多应用管理平台
|
|
// +----------------------------------------------------------------------
|
|
// | 官方网址:https://www.niucloud.com
|
|
// +----------------------------------------------------------------------
|
|
// | niucloud团队 版权所有 开源版本可自由商用
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Niucloud Team
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service\api\apiService;
|
|
|
|
use app\model\campus\Campus;
|
|
use app\model\campus_person_role\CampusPersonRole;
|
|
use app\model\chat_friends\ChatFriends;
|
|
use app\model\chat_messages\ChatMessages;
|
|
use app\model\dict\Dict;
|
|
use app\model\order_table\OrderTable;
|
|
use core\base\BaseApiService;
|
|
use think\facade\Db;
|
|
|
|
/**
|
|
* 订单管理-控制器服务层
|
|
* Class MemberService
|
|
* @package app\service\api\member
|
|
*/
|
|
class OrderTableService extends BaseApiService
|
|
{
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
//查询列表
|
|
public function getList(array $where)
|
|
{
|
|
$page_params = $this->getPageParam();//获取请求参数中的页码+分页数
|
|
$page = $page_params['page'];
|
|
$limit = $page_params['limit'];
|
|
|
|
$model = new OrderTable();
|
|
//员工表id
|
|
if (!empty($where['staff_id'])) {
|
|
$model = $model->where('staff_id', $where['staff_id']);
|
|
}
|
|
|
|
//客户资源表id
|
|
if (!empty($where['resource_id'])) {
|
|
$model = $model->where('resource_id', $where['resource_id']);
|
|
}
|
|
|
|
$data = $model
|
|
->append([
|
|
'customerResources',
|
|
'course',
|
|
'classGrade',
|
|
'personnel'
|
|
])
|
|
->order('id','desc')
|
|
->paginate([
|
|
'list_rows' => $limit,
|
|
'page' => $page,
|
|
])->toArray();
|
|
|
|
return $data;
|
|
}
|
|
|
|
//查询详情
|
|
public function getInfo(array $where)
|
|
{
|
|
$model = new OrderTable();
|
|
//判断用没有员工id
|
|
if (!empty($where['staff_id'])) {
|
|
$model = $model->where('staff_id', $where['staff_id']);
|
|
}
|
|
//判断用没有客户资源id
|
|
if (!empty($where['resource_id'])) {
|
|
$model = $model->where('resource_id', $where['resource_id']);
|
|
}
|
|
$data = $model
|
|
->append([
|
|
'customerResources',
|
|
'course',
|
|
'classGrade',
|
|
'personnel'
|
|
])
|
|
->find();
|
|
|
|
|
|
if ($data) {
|
|
$data = $data->toArray();
|
|
$res = [
|
|
'code' => 1,
|
|
'msg' => '操作成功',
|
|
'data' => $data
|
|
];
|
|
return $res;
|
|
} else {
|
|
$res = [
|
|
'code' => 0,
|
|
'msg' => '暂无数据',
|
|
'data' => []
|
|
];
|
|
return $res;
|
|
}
|
|
}
|
|
|
|
//创建订单
|
|
public function addData(array $data)
|
|
{
|
|
$success = OrderTable::create($data);
|
|
|
|
$res = [
|
|
'code' => 1,
|
|
'msg' => '操作成功',
|
|
'data' => []
|
|
];
|
|
if (!$success) {
|
|
$res = [
|
|
'code' => 0,
|
|
'msg' => '操作失败',
|
|
'data' => []
|
|
];
|
|
}
|
|
return $res;
|
|
}
|
|
}
|
|
|