Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f2f7ae2f
authored
Oct 22, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
调整db
parent
aecbf32a
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
184 additions
and
180 deletions
app/Model/InvoiceComUserModel.php
app/Model/UserAmountModel.php
app/Model/UserGroupJoinModel.php
app/Model/UserGroupModel.php
app/Model/UserInfoModel.php
app/Model/UserSampleApplyModel.php
app/Model/UserSampleInviteModel.php
app/Model/InvoiceComUserModel.php
View file @
f2f7ae2f
...
@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
...
@@ -5,7 +5,7 @@ use Illuminate\Database\Eloquent\Model;
class
InvoiceComUserModel
extends
Model
class
InvoiceComUserModel
extends
Model
{
{
protected
$connection
=
'
order
'
;
protected
$connection
=
'
web
'
;
protected
$table
=
'lie_invoice_com_user'
;
protected
$table
=
'lie_invoice_com_user'
;
protected
$guarded
=
[
'id'
];
protected
$guarded
=
[
'id'
];
protected
$primaryKey
=
'id'
;
protected
$primaryKey
=
'id'
;
...
...
app/Model/UserAmountModel.php
View file @
f2f7ae2f
<?php
<?php
namespace
App\Model
;
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Request
;
use
Excel
;
use
Excel
;
use
DB
;
use
DB
;
class
UserAmountModel
extends
Model
class
UserAmountModel
extends
Model
{
{
protected
$connection
=
'
order'
;
protected
$connection
=
'
web'
;
protected
$table
=
'lie_user_amount'
;
protected
$table
=
'lie_user_amount'
;
protected
$guarded
=
[
'amount_id'
];
protected
$guarded
=
[
'amount_id'
];
protected
$primaryKey
=
'amount_id'
;
protected
$primaryKey
=
'amount_id'
;
public
$timestamps
=
true
;
public
$timestamps
=
true
;
const
CREATED_AT
=
'create_time'
;
const
CREATED_AT
=
'create_time'
;
const
UPDATED_AT
=
'update_time'
;
const
UPDATED_AT
=
'update_time'
;
public
function
fromDateTime
(
$value
)
public
function
fromDateTime
(
$value
)
{
{
return
strtotime
(
parent
::
fromDateTime
(
$value
));
return
strtotime
(
parent
::
fromDateTime
(
$value
));
}
}
// 获取排名前十的用户总额
// 获取排名前十的用户总额
public
function
getUserAmount
()
public
function
getUserAmount
()
{
{
return
$this
->
select
(
'amount_id'
,
'user_id'
,
'account'
,
'amount'
)
->
orderBy
(
'amount'
,
'desc'
)
->
take
(
10
)
->
get
()
->
toArray
();
return
$this
->
select
(
'amount_id'
,
'user_id'
,
'account'
,
'amount'
)
->
orderBy
(
'amount'
,
'desc'
)
->
take
(
10
)
->
get
()
->
toArray
();
}
}
}
}
\ No newline at end of file
app/Model/UserGroupJoinModel.php
View file @
f2f7ae2f
<?php
<?php
namespace
App\Model
;
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Request
;
class
UserGroupJoinModel
extends
Model
class
UserGroupJoinModel
extends
Model
{
{
protected
$connection
=
'
order'
;
protected
$connection
=
'
web'
;
protected
$table
=
'lie_user_group_join'
;
protected
$table
=
'lie_user_group_join'
;
protected
$primaryKey
=
'id'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
public
$timestamps
=
false
;
}
}
\ No newline at end of file
app/Model/UserGroupModel.php
View file @
f2f7ae2f
<?php
<?php
namespace
App\Model
;
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
class
UserGroupModel
extends
Model
class
UserGroupModel
extends
Model
{
{
protected
$connection
=
'
order'
;
protected
$connection
=
'
web'
;
protected
$table
=
'lie_user_group'
;
protected
$table
=
'lie_user_group'
;
protected
$primaryKey
=
'id'
;
protected
$primaryKey
=
'id'
;
protected
$guarded
=
[
'id'
];
protected
$guarded
=
[
'id'
];
public
$timestamps
=
false
;
public
$timestamps
=
false
;
// 获取客服
// 获取客服
public
function
lists
(
$request
,
$export
=
''
)
public
function
lists
(
$request
,
$export
=
''
)
{
{
$page
=
$request
->
input
(
'page'
,
1
);
$page
=
$request
->
input
(
'page'
,
1
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$limit
=
$request
->
input
(
'limit'
,
10
);
$map
[
'account'
]
=
$request
->
input
(
'account'
,
''
);
// 用户账号
$map
[
'account'
]
=
$request
->
input
(
'account'
,
''
);
// 用户账号
$map
[
'status'
]
=
$request
->
input
(
'status'
,
''
);
// 状态
$map
[
'status'
]
=
$request
->
input
(
'status'
,
''
);
// 状态
$map
[
'begin_time'
]
=
$request
->
input
(
'begin_time'
,
''
)
?
strtotime
(
$request
->
input
(
'begin_time'
))
:
''
;
$map
[
'begin_time'
]
=
$request
->
input
(
'begin_time'
,
''
)
?
strtotime
(
$request
->
input
(
'begin_time'
))
:
''
;
$map
[
'end_time'
]
=
$request
->
input
(
'end_time'
,
''
)
?
strtotime
(
$request
->
input
(
'end_time'
))
+
86399
:
''
;
$map
[
'end_time'
]
=
$request
->
input
(
'end_time'
,
''
)
?
strtotime
(
$request
->
input
(
'end_time'
))
+
86399
:
''
;
$list
=
$this
->
where
(
function
(
$query
)
use
(
$map
)
{
$list
=
$this
->
where
(
function
(
$query
)
use
(
$map
)
{
// 客服名称
// 客服名称
if
(
$map
[
'account'
])
{
if
(
$map
[
'account'
])
{
$query
->
where
(
'account'
,
'like'
,
$map
[
'account'
]
.
'%'
);
$query
->
where
(
'account'
,
'like'
,
$map
[
'account'
]
.
'%'
);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 邮箱
// 邮箱
if
(
$map
[
'status'
])
{
if
(
$map
[
'status'
])
{
$query
->
where
(
'status'
,
'='
,
$map
[
'status'
]);
$query
->
where
(
'status'
,
'='
,
$map
[
'status'
]);
}
}
})
->
where
(
function
(
$query
)
use
(
$map
)
{
})
->
where
(
function
(
$query
)
use
(
$map
)
{
// 创建时间
// 创建时间
if
(
!
empty
(
$map
[
'begin_time'
])
&&
!
empty
(
$map
[
'end_time'
]))
{
if
(
!
empty
(
$map
[
'begin_time'
])
&&
!
empty
(
$map
[
'end_time'
]))
{
$query
->
whereBetween
(
'create_time'
,
[
$map
[
'begin_time'
],
$map
[
'end_time'
]]);
$query
->
whereBetween
(
'create_time'
,
[
$map
[
'begin_time'
],
$map
[
'end_time'
]]);
}
}
else
if
(
!
empty
(
$map
[
'begin_time'
]))
{
else
if
(
!
empty
(
$map
[
'begin_time'
]))
{
$query
->
where
(
'create_time'
,
'>='
,
$map
[
'begin_time'
]);
$query
->
where
(
'create_time'
,
'>='
,
$map
[
'begin_time'
]);
}
}
else
if
(
!
empty
(
$map
[
'end_time'
]))
{
else
if
(
!
empty
(
$map
[
'end_time'
]))
{
$query
->
where
(
'create_time'
,
'<='
,
$map
[
'end_time'
]);
$query
->
where
(
'create_time'
,
'<='
,
$map
[
'end_time'
]);
}
}
})
})
->
orderBy
(
'create_time'
,
'desc'
)
->
orderBy
(
'create_time'
,
'desc'
)
->
orderBy
(
'id'
,
'desc'
);
->
orderBy
(
'id'
,
'desc'
);
if
(
$export
)
{
if
(
$export
)
{
$list
=
$list
->
get
()
->
toArray
();
$list
=
$list
->
get
()
->
toArray
();
if
(
empty
(
$list
))
{
if
(
empty
(
$list
))
{
echo
'<script>alert("导出数据为空");history.go(-1);</script>'
;
die
;
echo
'<script>alert("导出数据为空");history.go(-1);</script>'
;
die
;
}
}
return
$list
;
return
$list
;
}
else
{
}
else
{
$list
=
$list
->
paginate
(
$limit
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$list
=
$list
->
paginate
(
$limit
,
[
'*'
],
'page'
,
$page
)
->
toArray
();
$data
=
$this
->
handle
(
$list
[
'data'
]);
$data
=
$this
->
handle
(
$list
[
'data'
]);
return
[
0
,
'获取成功'
,
$data
,
$list
[
'total'
]];
return
[
0
,
'获取成功'
,
$data
,
$list
[
'total'
]];
}
}
}
}
// 处理数据
// 处理数据
public
function
handle
(
$data
)
public
function
handle
(
$data
)
{
{
if
(
!
$data
)
return
false
;
if
(
!
$data
)
return
false
;
$UserGroupJoinModel
=
new
UserGroupJoinModel
();
$UserGroupJoinModel
=
new
UserGroupJoinModel
();
foreach
(
$data
as
&
$v
)
{
foreach
(
$data
as
&
$v
)
{
// 若已参团,且非系统分配,则查询参团表
// 若已参团,且非系统分配,则查询参团表
if
(
$v
[
'status'
]
==
1
)
{
if
(
$v
[
'status'
]
==
1
)
{
$join
=
$UserGroupJoinModel
->
where
(
'group_id'
,
$v
[
'id'
])
->
first
();
$join
=
$UserGroupJoinModel
->
where
(
'group_id'
,
$v
[
'id'
])
->
first
();
$v
[
'join_user_id'
]
=
$join
[
'user_id'
];
$v
[
'join_user_id'
]
=
$join
[
'user_id'
];
$v
[
'join_account'
]
=
$join
[
'account'
];
$v
[
'join_account'
]
=
$join
[
'account'
];
$v
[
'join_order_id'
]
=
$join
[
'order_id'
];
$v
[
'join_order_id'
]
=
$join
[
'order_id'
];
$v
[
'join_order_sn'
]
=
$join
[
'order_sn'
];
$v
[
'join_order_sn'
]
=
$join
[
'order_sn'
];
$v
[
'join_time'
]
=
date
(
'Y-m-d H:i:s'
,
$join
[
'join_time'
]);
$v
[
'join_time'
]
=
date
(
'Y-m-d H:i:s'
,
$join
[
'join_time'
]);
}
else
{
}
else
{
$v
[
'join_user_id'
]
=
''
;
$v
[
'join_user_id'
]
=
''
;
$v
[
'join_account'
]
=
''
;
$v
[
'join_account'
]
=
''
;
$v
[
'join_order_id'
]
=
''
;
$v
[
'join_order_id'
]
=
''
;
$v
[
'join_order_sn'
]
=
''
;
$v
[
'join_order_sn'
]
=
''
;
$v
[
'join_time'
]
=
''
;
$v
[
'join_time'
]
=
''
;
}
}
$v
[
'limited_time'
]
=
$v
[
'limited_time'
]
?
date
(
'Y-m-d H:i:s'
,
$v
[
'limited_time'
])
:
''
;
$v
[
'limited_time'
]
=
$v
[
'limited_time'
]
?
date
(
'Y-m-d H:i:s'
,
$v
[
'limited_time'
])
:
''
;
$v
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$v
[
'create_time'
]);
$v
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$v
[
'create_time'
]);
}
}
return
$data
;
return
$data
;
}
}
}
}
\ No newline at end of file
app/Model/UserInfoModel.php
View file @
f2f7ae2f
<?php
<?php
namespace
App\Model
;
namespace
App\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Illuminate\Database\Eloquent\Model
;
use
Request
;
use
Request
;
use
Excel
;
use
Excel
;
use
DB
;
use
DB
;
class
UserInfoModel
extends
Model
class
UserInfoModel
extends
Model
{
{
protected
$connection
=
'
order'
;
protected
$connection
=
'
web'
;
protected
$table
=
'lie_user_info'
;
protected
$table
=
'lie_user_info'
;
protected
$primaryKey
=
'ui_id'
;
protected
$primaryKey
=
'ui_id'
;
public
$timestamps
=
false
;
public
$timestamps
=
false
;
// 获取用户样片领取机会
// 获取用户样片领取机会
public
function
getUserApplyCount
(
$user_id
)
public
function
getUserApplyCount
(
$user_id
)
{
{
$user_info
=
$this
->
where
(
'user_id'
,
$user_id
)
->
select
(
'apply_count'
)
->
first
();
$user_info
=
$this
->
where
(
'user_id'
,
$user_id
)
->
select
(
'apply_count'
)
->
first
();
if
(
!
$user_info
)
return
0
;
if
(
!
$user_info
)
return
0
;
return
$user_info
->
apply_count
;
return
$user_info
->
apply_count
;
}
}
// 获取用户职务
// 获取用户职务
public
function
getWorkFunction
(
$user_id
)
public
function
getWorkFunction
(
$user_id
)
{
{
$work_function
=
$this
->
where
(
'user_id'
,
$user_id
)
->
value
(
'work_function'
);
$work_function
=
$this
->
where
(
'user_id'
,
$user_id
)
->
value
(
'work_function'
);
if
(
!
$work_function
)
return
''
;
if
(
!
$work_function
)
return
''
;
$work_function_val
=
Config
(
'params.work_function'
);
$work_function_val
=
Config
(
'params.work_function'
);
return
isset
(
$work_function_val
[
$work_function
])
?
$work_function_val
[
$work_function
]
:
''
;
return
isset
(
$work_function_val
[
$work_function
])
?
$work_function_val
[
$work_function
]
:
''
;
}
}
}
}
\ No newline at end of file
app/Model/UserSampleApplyModel.php
View file @
f2f7ae2f
...
@@ -8,7 +8,7 @@ use DB;
...
@@ -8,7 +8,7 @@ use DB;
class
UserSampleApplyModel
extends
Model
class
UserSampleApplyModel
extends
Model
{
{
protected
$connection
=
'
order
'
;
protected
$connection
=
'
web
'
;
protected
$table
=
'lie_user_sample_apply'
;
protected
$table
=
'lie_user_sample_apply'
;
protected
$primaryKey
=
'apply_id'
;
protected
$primaryKey
=
'apply_id'
;
public
$timestamps
=
true
;
public
$timestamps
=
true
;
...
...
app/Model/UserSampleInviteModel.php
View file @
f2f7ae2f
...
@@ -8,7 +8,7 @@ use DB;
...
@@ -8,7 +8,7 @@ use DB;
class
UserSampleInviteModel
extends
Model
class
UserSampleInviteModel
extends
Model
{
{
protected
$connection
=
'
order
'
;
protected
$connection
=
'
web
'
;
protected
$table
=
'lie_user_sample_invite'
;
protected
$table
=
'lie_user_sample_invite'
;
protected
$primaryKey
=
'invite_id'
;
protected
$primaryKey
=
'invite_id'
;
public
$timestamps
=
true
;
public
$timestamps
=
true
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment