Commit a95946d4 by 朱继来

Merge branch 'master' of http://119.23.72.7/zhujilai/Order into zjl_form_duplicate_submit_20191031

parents 088d588f ea2a2ef7
......@@ -250,19 +250,19 @@ class CronController extends Controller
/**
* 推送新用户活动短信
*
* 条件:前天注册,未下单的用户或下单未支付一笔订单的用户
* 条件:前15天注册,未下单的用户或下单未支付一笔订单的用户
*
* 推送时间:每天上午10点 (0 10 * * * /usr/bin/curl http://order.ichunt.net/act/sendactmsg)
*/
public function sendActMsg()
{
$start_time = strtotime(date('Y-m-d', strtotime('-1 day'))); // 前一天0点
$start_time = strtotime(date('Y-m-d', strtotime('-15 day'))); // 前15天0点
$last_time = strtotime(date('Y-m-d')) - 1; // 前一天23:59:59
$UserMainModel = new UserMainModel;
$OrderModel = new OrderModel;
// 获取前一天新注册用户
// 获取前15天注册用户
$user = $UserMainModel->where('is_type', 0)
->where('is_test', 0)
->whereBetween('create_time', [$start_time, $last_time])
......
......@@ -430,17 +430,30 @@ Class OrderController extends Controller
if (strpos($info['role'], ',') !== false) { // 多角色情况下
$res = $perm->checkUserRoles($request, $info['role']);
if ($res) {
$info['role'] = $res['role_id'];
$res['sale_id'] && $map['sale_id'] = $res['sale_id'];
$info['role'] = $res['role_id'];
// 若无指定客服,则返回客服组里的所有订单
if (!$map['order_send']) {
$map['sale_id'] = $res['sale_id'];
} else if (!in_array($map['order_send'], $res['sale_id'])) { // 若指定客服不存在与客服组,则不能筛选
$map['sale_id'] = -1;
} else {
$map['sale_id'] = $map['order_send'];
}
} else {
if (in_array($info['role'], Config('perm_args.kefu_order'))) { // 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
$map['sale_id'] = $request->user->userId; // 筛选自己的订单
} else if (in_array($info['role'], Config('perm_args.manager_order'))) { // 线销一组、二组、三组主管(查看自己及其下组员的订单)
$map['sale_id'] = $perm->getGroupSalesId($request, $info['role']);
} else if (in_array($info['role'], Config('perm_args.kefu_order'))) { // 交易员、联营客服(线销一组、二组、三组客服)、自营客服、自营内部采购
$map['sale_id'] = $request->user->userId; // 筛选自己的订单
} else if (in_array($info['role'], Config('perm_args.manager_order'))) { // 线销一组、二组、三组主管(查看自己及其下组员的订单)
$sale_ids = $perm->getGroupSalesId($request, $info['role']);
// 若无指定客服,则返回客服组里的所有订单
if (!$map['order_send']) {
$map['sale_id'] = $sale_ids;
} else if (!in_array($map['order_send'], $sale_ids)) { // 若指定客服不存在与客服组,则不能筛选
$map['sale_id'] = -1;
} else {
$map['sale_id'] = $map['order_send'];
}
}
}
// 自营客服权限
if ($tid == 2 && $info['role'] == 6) {
......
......@@ -29,6 +29,9 @@ class OrderModel extends Model
if ($request->isMethod('get')) {
$map['order_type'] = $request->input('order_type', '');
$map['order_contain'] = $request->input('order_contain', '');
$map['order_sn'] = $request->input('order_sn', '');
$map['erp_sn'] = $request->input('erp_sn', '');
$map['goods_name'] = $request->input('goods_name', '');
$map['time_start'] = $request->input('time_start', '');
$map['time_end'] = $request->input('time_end', '');
$map['order_status'] = $request->input('order_status', '');
......@@ -80,24 +83,38 @@ class OrderModel extends Model
->where(function ($query) use ($map) {
// 查询类型
if (!empty($map['order_contain'])) {
if ($map['order_type'] == 1) { // 会员账号
if ($map['order_type'] == 3) { // 发票抬头
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) { // 会员ID
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 会员账号
if (preg_match('/@/', $map['order_contain'])) {
$query->where('u.email', '=', $map['order_contain']);
} else {
$query->where('u.mobile', '=', $map['order_contain']);
}
} else if ($map['order_type'] == 2) { // 型号名称
$query->where('it.goods_name', '=', $map['order_contain']);
} else if ($map['order_type'] == 3) { // 发票抬头
$query->where('i.tax_title', '=', $map['order_contain']);
} else if($map['order_type'] == 4) {
$query->where('o.user_id', '=', $map['order_contain']);
} else { // 订单编号
$query->where('o.order_sn', '=', $map['order_contain']);
}
}
}
})
->where(function ($query) use ($map) {
// 订单编号
if (!empty($map['order_sn'])) {
$query->where('o.order_sn', '=', $map['order_sn']);
}
})
->where(function ($query) use ($map) {
// ERP订单编号
if (!empty($map['erp_sn'])) {
$query->where('oe.erp_sn', '=', $map['erp_sn']);
}
})
->where(function ($query) use ($map) {
// 型号
if (!empty($map['goods_name'])) {
$query->where('it.goods_name', '=', $map['goods_name']);
}
})
->where(function ($query) use ($map) {
// 创建时间
if (!empty($map['time_start']) && !empty($map['time_end'])) {
$query->whereBetween('o.create_time', [$map['time_start'], $map['time_end']]);
......
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