Commit 98075aaa by 朱继来

合并平台和ERP订单

parent c4544dfa
......@@ -193,6 +193,8 @@ function getOrderSource($order_id, $order_type=1)
}
return $source;
} else if ($order_type == 2) {
return 'ERP';
} else if ($order_type == 3) {
return '京东';
} else if ($order_type == 4) {
......@@ -365,7 +367,7 @@ Class OrderController extends Controller
public function orderList(Request $request)
{
$info = $this->getOrderInfo($request, 1);
$info['title'] = '平台订单';
$info['title'] = '订单列表';
// 若为京东自营、自营客服角色,则跳转到自营列表
if (in_array($info['role'], [6, 7, 11, 12])) {
......@@ -416,8 +418,8 @@ Class OrderController extends Controller
$map['check_jd_order'] = 1; // 只允许查看京东自营订单
}
// 非调账号显示真实数据
if ($info['username'] != 'vpadmin@ichunt.com') {
// 非调账号显示真实数据
if ($info['role'] != 13) {
$map['is_fake'] = 0;
} else {
$map['vp_time_set'] = strtotime(Config('website.vp_time_set')); // 竞调账号根据时间展示订单
......@@ -427,7 +429,7 @@ Class OrderController extends Controller
$size = 10;
if ($tid == 1) {
$map['order_type_filter'] = [1];
$map['order_type_filter'] = in_array($info['role'], [1, 13]) ? [1, 2, 3] : [1]; // 管理员和尽调账号可以查看平台、ERP、京东订单
} else if ($tid == 2) {
$size = 20;
$map['order_type_filter'] = [1, 3, 4]; // 1.网站 3.京东 4.象牙宝
......
......@@ -8,10 +8,26 @@
class PermController extends Controller
{
protected $roles = [
'管理员' => 1,
'经理' => 2,
'交易员' => 3,
'客服' => 4,
'测试' => 5,
'京东自营' => 6,
'自营客服' => 7,
'运营助理' => 8,
'财务' => 9,
'自营客服主管' => 10,
'自营客服主管助理' => 11,
'自营内部采购' => 12,
'尽调' => 13,
];
// 检查用户是否具有系统访问权限
public function checkAccess($request)
{
$user_id = $request->user->userId;
$user_id = $request->user->userId;
$role = $this->getUserRole($request);
if ($role == 1) return true; // 超级管理员或系统管理员直接进入
......@@ -70,33 +86,7 @@
foreach ($role as $v) {
$department = DB::table('t_role_perm')->where(['roleId' => $v, 'bid' => $bid])->first();
if ($department->name == '管理员') {
return 1;
} else if ($department->name == '经理') {
return 2;
} else if ($department->name == '交易员') {
return 3;
} else if ($department->name == '客服') {
return 4;
} else if ($department->name == '测试') {
return 5;
} else if ($department->name == '京东自营') {
return 6;
} else if ($department->name == '自营客服') {
return 7;
} else if ($department->name == '运营助理') {
return 8;
} else if ($department->name == '财务') {
return 9;
} else if ($department->name == '自营客服主管') {
return 10;
} else if ($department->name == '自营客服主管助理') {
return 11;
} else if ($department->name == '自营内部采购') {
return 12;
} else {
return 0;
}
return in_array($department->name, array_keys($this->roles)) ? array_get($this->roles, $department->name) : 0;
}
}
}
......
......@@ -68,6 +68,7 @@ class CheckLogin
$perm = new PermController;
$access = $perm->checkAccess($request);
$business = $perm->getBusinessInfo();
if (!$access) {
......
......@@ -51,13 +51,19 @@ class OrderModel extends Model
}
/* 临时添加 所有人只能查看线上订单 */
$map['online_order'] = 1;
// $map['online_order'] = 1;
// 非竞调账号,则查看真实数据
if ($info['username'] != 'vpadmin@ichunt.com') {
if ($info['role'] != 13) {
$map['is_fake'] = 0;
}
if ($map['order_goods_type'] == 1) {
$map['order_type_filter'] = in_array($info['role'], [1, 13]) ? [1, 2, 3] : [1]; // 管理员和尽调账号可以查看平台、ERP、京东订单
} else {
$map['order_type_filter'] = [1, 3, 4]; // 1.网站 3.京东 4.象牙宝
}
$list = $this->from('lie_order_items as it')
->leftJoin('lie_order as o', 'it.order_id', '=', 'o.order_id')
->leftJoin('lie_pay_log as p', 'it.order_id', '=', 'p.order_id')
......@@ -149,6 +155,9 @@ class OrderModel extends Model
case '4':
$string .= "o.order_type = 3 OR ";
break;
case '5':
$string .= "o.order_type = 2 OR ";
break;
}
}
......@@ -175,11 +184,9 @@ class OrderModel extends Model
}
})
->where(function ($query) use ($map) {
if ($map['order_goods_type'] == 2) { // 自营获取线上、京东、象牙宝订单
$query->whereIn('o.order_type', [1, 3, 4]);
} else if (isset($map['online_order'])) { // 线上订单
$query->where('o.order_type', '=', $map['online_order']);
}
if ($map['order_type_filter']) { // 自营获取线上、京东、象牙宝订单
$query->whereIn('o.order_type', $map['order_type_filter']);
}
})
->where(function ($query) use ($map) {
// 同步状态
......@@ -442,6 +449,8 @@ class OrderModel extends Model
}
return $source;
} else if ($order_type == 2) {
return 'ERP';
} else if ($order_type == 3) {
return '京东';
} else if ($order_type == 4) {
......
......@@ -16,6 +16,8 @@ return [
'order_url' => 'http://order.liexin.net',
// API项目
'api_domain' => 'http://api.liexin.com/',
// 权限系统
'perm_url' => 'http://perm.liexin.net',
// 获取用户权限接口
'perm_api' => 'http://perm.liexin.net/api/perms/',
// 获取用户许可权限接口
......
......@@ -18,7 +18,7 @@
<h2 class="font-bold">禁止访问</h2>
<div class="error-desc">
暂时没有系统访问权限,请到权限系统申请该系统访问权限......<br/>
<a href="http://perm.ichunt.net/business/{{$bid}}/request" style="font-size: 18px;"><i class="fa fa-mail-reply"></i>申请</a>
<a href="{{ Config('website.perm_url') }}/business/{{$bid}}/request" style="font-size: 18px;"><i class="fa fa-mail-reply"></i>申请</a>
</div>
</div>
</body>
......
......@@ -129,6 +129,8 @@
<option value="1">PC端</option>
<option value="2">移动端</option>
<option value="3">后台</option>
<option value="4">京东</option>
<option value="5">ERP</option>
<option value="6">小程序</option>
</select>
</dd>
......@@ -278,7 +280,7 @@
<td class="show-list"><?php print_r(App\Http\Controllers\getSalesName($v['sale_id'])); ?></td>
@if ($username != 'vpadmin@ichunt.com')
<td class="show-list"><?php echo App\Http\Controllers\getOrderSource($v['order_id']); ?></td>
<td class="show-list"><?php echo App\Http\Controllers\getOrderSource($v['order_id'], $v['order_type']); ?></td>
<td class="show-list">
<?php
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment