Commit f3f88798 by 朱继来

Merge branch 'zjl_erp_20190923'

parents e6a52b0e 264c3d40
......@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Model\OrderModel;
use App\Model\UserMainModel;
use App\Model\UserCompanyModel;
use App\Model\OrderActionLogModel;
use App\Model\PayLogModel;
use DB;
......@@ -182,20 +183,23 @@ class SpecialController extends Controller
public function getLastOrderId($account)
{
$UserMainModel = new UserMainModel();
$UserCompanyModel = new UserCompanyModel();
$OrderModel = new OrderModel();
if (strpos($account, '@') === false) {
$where['mobile'] = $account;
} else {
if (strpos($account, '@') !== false) { // 邮箱
$where['email'] = strtolower($account);
$user_info = $UserMainModel->where($where)->select('user_id')->first();
} else if (preg_match('/\d{11}/', $account)) { // 手机号码
$where['mobile'] = $account;
$user_info = $UserMainModel->where($where)->select('user_id')->first();
} else { // 公司名称
$user_info = $UserCompanyModel->where('com_name', $account)->select('user_id')->first();
}
$user = $UserMainModel->where($where)->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;
......
<?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