Commit 264c3d40 by 朱继来

调整离职人员订单分配

parent 75b5192a
...@@ -6,6 +6,7 @@ use Illuminate\Http\Request; ...@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Model\OrderModel; use App\Model\OrderModel;
use App\Model\UserMainModel; use App\Model\UserMainModel;
use App\Model\UserCompanyModel;
use App\Model\OrderActionLogModel; use App\Model\OrderActionLogModel;
use App\Model\PayLogModel; use App\Model\PayLogModel;
use DB; use DB;
...@@ -140,7 +141,7 @@ class SpecialController extends Controller ...@@ -140,7 +141,7 @@ class SpecialController extends Controller
array_shift($excel); // 删除第一行 array_shift($excel); // 删除第一行
$OrderModel = new OrderModel(); $OrderModel = new OrderModel();
// 记录到日志 // 记录到日志
$monolog = Log::getMonolog(); $monolog = Log::getMonolog();
...@@ -181,21 +182,24 @@ class SpecialController extends Controller ...@@ -181,21 +182,24 @@ class SpecialController extends Controller
// 获取客户最近的订单 // 获取客户最近的订单
public function getLastOrderId($account) public function getLastOrderId($account)
{ {
$UserMainModel = new UserMainModel(); $UserMainModel = new UserMainModel();
$OrderModel = new OrderModel(); $UserCompanyModel = new UserCompanyModel();
$OrderModel = new OrderModel();
if (strpos($account, '@') === false) { if (strpos($account, '@') !== false) { // 邮箱
$where['mobile'] = $account;
} else {
$where['email'] = strtolower($account); $where['email'] = strtolower($account);
} $user_info = $UserMainModel->where($where)->select('user_id')->first();
} else if (preg_match('/\d{11}/', $account)) { // 手机号码
$user = $UserMainModel->where($where)->select('user_id')->first(); $where['mobile'] = $account;
$user_info = $UserMainModel->where($where)->select('user_id')->first();
} else { // 公司名称
$user_info = $UserCompanyModel->where('com_name', $account)->select('user_id')->first();
}
if (!$user) return false; if (!$user_info) return false;
// 查找最近的订单 // 查找最近的订单
$order = $OrderModel->where('user_id', $user['user_id'])->where('is_type', 0)->select('order_id')->orderBy('order_id', 'desc')->first(); $order = $OrderModel->where('user_id', $user_info['user_id'])->where('is_type', 0)->select('order_id')->orderBy('order_id', 'desc')->first();
if (!$order) return false; if (!$order) return false;
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
use Request;
use Excel;
use DB;
class UserCompanyModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_user_company';
protected $primaryKey = 'com_id';
public $timestamps = false;
}
\ No newline at end of file
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