Commit a4d8aec0 by 朱继来

调整订单导出

parent 77307efb
...@@ -3,6 +3,8 @@ namespace App\Http\Controllers; ...@@ -3,6 +3,8 @@ namespace App\Http\Controllers;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use DB; use DB;
use Illuminate\Support\Facades\Redis as Redis;
use App\Model\RegionModel;
class RegionController extends Controller class RegionController extends Controller
{ {
...@@ -38,11 +40,47 @@ class RegionController extends Controller ...@@ -38,11 +40,47 @@ class RegionController extends Controller
); );
} }
//获取省市县名称 //获取省市县名称
public function getRegionName($region_id){ public function getRegionName($region_id)
{
if (empty($region_id)){ if (empty($region_id)){
return ""; return "";
} }
$list = DB::connection('order')->table('lie_region')->select("region_name")->where("region_id",$region_id)->get(); $list = DB::connection('order')->table('lie_region')->select("region_name")->where("region_id",$region_id)->get();
return !$list ? "" : current(objectToArray($list))['region_name']; return !$list ? "" : current(objectToArray($list))['region_name'];
} }
// 初始化地址缓存
public function cache()
{
$RegionModel = new RegionModel();
$province = $RegionModel->getRegion(1); // 获取省
S_str('oms:province', json_encode($province));
$city = $RegionModel->getRegion(2); // 获取城市
foreach($city as $c) {
S_hash('oms:city:'.$c['parent_id'], $c['region_id'], json_encode($c));
}
$district = $RegionModel->getRegion(3); // 获取区
foreach($district as $d) {
S_hash('oms:district:'.$d['parent_id'], $d['region_id'], json_encode($d));
}
echo '设置地址缓存成功';
}
// 清除缓存
public function clear()
{
Redis::del('oms:province');
Redis::del(Redis::keys('oms:city:*'));
Redis::del(Redis::keys('oms:district:*'));
echo '清除地址缓存成功';
}
} }
\ No newline at end of file
...@@ -444,4 +444,42 @@ function Autograph(){ ...@@ -444,4 +444,42 @@ function Autograph(){
// // Session::forget($token); // 验证完毕后删除token // // Session::forget($token); // 验证完毕后删除token
// // return true; // // return true;
// } // }
\ No newline at end of file
// 读取Redis缓存
function S_str($key, $value='')
{
static $redis = null;
if ($redis == null) $redis = new \App\Model\RedisModel();
if ($value === '') return json_decode($redis->get($key), true);
return $redis->set($key, $value);
}
function S_hash($key, $field='', $value='')
{
static $redis = null;
if ($redis == null) $redis = new \App\Model\RedisModel();
if ($value === '') {
$data = $field === '' ? $redis->hgetAll($key) : $redis->hget($key, $field);
$datas = [];
if (is_array($data)) {
foreach ($data as $v) {
$datas[] = json_decode($v, true);
}
} else {
$datas = json_decode($data, true);
}
return $datas;
}
return $redis->hset($key, $field, $value);
}
\ No newline at end of file
...@@ -39,9 +39,10 @@ class CheckLogin ...@@ -39,9 +39,10 @@ class CheckLogin
$cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey; $cookie = 'oa_user_id=' . $userId . '; oa_skey=' . $skey;
$client = new \GuzzleHttp\Client(); $client = new \GuzzleHttp\Client();
$rsp = $client->request('GET', $login['check'], [ $rsp = $client->request('GET', $login['check'], [
'headers' => ['Cookie' => $cookie], 'headers' => ['Cookie' => $cookie],
'connect_timeout' => 1, 'connect_timeout' => 1,
'timeout' => 3 'timeout' => 10,
'verify' => false,
]); ]);
if ($rsp->getStatusCode() != 200) { if ($rsp->getStatusCode() != 200) {
......
...@@ -54,6 +54,8 @@ Route::group(['middleware' => 'web'], function () { ...@@ -54,6 +54,8 @@ Route::group(['middleware' => 'web'], function () {
Route::match(['get', 'post'], '/changeShipping/{id?}', 'OrderController@changeShipping'); Route::match(['get', 'post'], '/changeShipping/{id?}', 'OrderController@changeShipping');
Route::post('/region/getAll', 'RegionController@getAll'); Route::post('/region/getAll', 'RegionController@getAll');
Route::get('/region/cache', 'RegionController@cache');
Route::get('/region/clear', 'RegionController@clear');
Route::match(['get', 'post'], '/changeInvoice/{id?}', 'OrderController@changeInvoice'); Route::match(['get', 'post'], '/changeInvoice/{id?}', 'OrderController@changeInvoice');
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class OrderAddressModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_address';
protected $primaryKey = 'order_address_id';
public $timestamps = false;
}
\ No newline at end of file
...@@ -26,19 +26,18 @@ class OrderModel extends Model ...@@ -26,19 +26,18 @@ class OrderModel extends Model
$map['limit'] = isset($map['limit']) ? $map['limit'] : 100; $map['limit'] = isset($map['limit']) ? $map['limit'] : 100;
$map['p'] = isset($map['p']) ? $map['p'] : 1; $map['p'] = isset($map['p']) ? $map['p'] : 1;
$list = $this->from('lie_order_items as it') $list = $this->from('lie_order as o')
->leftJoin('lie_order as o', 'it.order_id', '=', 'o.order_id') ->join('lie_order_items as it', 'o.order_id', '=', 'it.order_id')
->leftJoin('lie_pay_log as p', 'it.order_id', '=', 'p.order_id') ->leftJoin('lie_order_invoice as i', 'o.order_id', '=', 'i.order_id')
->leftJoin('lie_order_invoice as i', 'it.order_id', '=', 'i.order_id') ->join('lie_order_extend as oe', 'o.order_id', '=', 'oe.order_id')
->leftJoin('lie_order_extend as oe', 'oe.order_id', '=', 'i.order_id') // ->leftJoin('lie_order_address as a', function($join) {
->leftJoin('lie_order_address as a', function($join) { // $join->on('o.order_id', '=', 'a.order_id')->where('a.address_type', '=', 1);
$join->on('it.order_id', '=', 'a.order_id')->where('a.address_type', '=', 1); // })
}) // ->leftJoin('lie_order_shipping as s', function($join) {
->leftJoin('lie_order_shipping as s', function($join) { // $join->on('o.order_id', '=', 's.order_id')->where('s.shipping_type', '=', 1);
$join->on('it.order_id', '=', 's.order_id')->where('s.shipping_type', '=', 1); // })
}) ->join('lie_user_main as u', 'o.user_id', '=', 'u.user_id')
->leftJoin('lie_user_main as u', 'it.user_id', '=', 'u.user_id') // ->leftJoin('lie_user_company as c', 'o.user_id', '=', 'c.user_id')
->leftJoin('lie_user_company as c', 'it.user_id', '=', 'c.user_id')
->where(function ($query) use ($map) { ->where(function ($query) use ($map) {
// 查询类型 // 查询类型
if (!empty($map['order_contain'])) { if (!empty($map['order_contain'])) {
...@@ -179,10 +178,12 @@ class OrderModel extends Model ...@@ -179,10 +178,12 @@ class OrderModel extends Model
if (isset($map['is_fake'])) { if (isset($map['is_fake'])) {
$query->where('o.is_type', '=', $map['is_fake']); $query->where('o.is_type', '=', $map['is_fake']);
} }
}) });
->where(function ($query) use ($map) {
// 支付方式 if (!empty($map['order_payment_mode'])) {
if (!empty($map['order_payment_mode'])) { $list = $list->leftJoin('lie_pay_log as p', 'o.order_id', '=', 'p.order_id')
->where(function ($query) use ($map) {
// 支付方式
$pay_name = explode(',', $map['order_payment_mode']); $pay_name = explode(',', $map['order_payment_mode']);
$order_payment_mode = []; $order_payment_mode = [];
...@@ -201,9 +202,10 @@ class OrderModel extends Model ...@@ -201,9 +202,10 @@ class OrderModel extends Model
} }
$query->whereIn('p.pay_name', $order_payment_mode); $query->whereIn('p.pay_name', $order_payment_mode);
} });
}) }
->where(function ($query) use ($map) {
$list = $list->where(function ($query) use ($map) {
// 发票类型 // 发票类型
if (!empty($map['order_invoice_status'])) { if (!empty($map['order_invoice_status'])) {
$query->where('i.inv_type', '=', $map['order_invoice_status']); $query->where('i.inv_type', '=', $map['order_invoice_status']);
...@@ -235,7 +237,7 @@ class OrderModel extends Model ...@@ -235,7 +237,7 @@ class OrderModel extends Model
}) })
->where('it.status', 1) ->where('it.status', 1)
->where('o.order_goods_type', '=', $map['order_goods_type']) ->where('o.order_goods_type', '=', $map['order_goods_type'])
->select('it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.goods_class', 'it.self_supplier_type', 'o.order_id', 'o.order_sn', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'a.consignee', 'a.address', 's.status as shipping_status', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'u.is_test', 'c.com_name', 'oe.erp_sn', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate', 'oe.sample_demand_desc','a.mobile as address_mobile','a.province','a.city','a.district') ->select('o.order_id', 'o.order_sn', 'o.order_type', 'o.order_pay_type', 'o.order_goods_type', 'o.order_source', 'o.create_time', 'o.status', 'o.order_amount', 'o.sale_type', 'o.currency', 'o.sale_id', 'o.cancel_reason', 'it.goods_id', 'it.goods_name', 'it.goods_number', 'it.goods_price', 'it.single_pre_price', 'it.brand_name', 'it.supplier_name', 'it.goods_class', 'it.self_supplier_type', 'i.tax_title', 'i.inv_type', 'i.invoice_status', 'i.tax_title', 'i.company_address', 'i.company_phone', 'i.tax_no', 'i.bank_name', 'i.bank_account', 'u.user_id', 'u.mobile', 'u.email', 'u.client_source', 'u.is_new', 'u.is_test', 'oe.erp_sn', 'oe.order_type as extend_order_type', 'oe.send_remark', 'oe.is_new as is_new_order', 'oe.business_type', 'oe.jd_order_id', 'oe.exchange_rate', 'oe.sample_demand_desc')
->groupBy('it.rec_id') ->groupBy('it.rec_id')
->orderBy('o.create_time', 'DESC') ->orderBy('o.create_time', 'DESC')
// ->get() // ->get()
...@@ -324,11 +326,33 @@ class OrderModel extends Model ...@@ -324,11 +326,33 @@ class OrderModel extends Model
$tmp = array(); $tmp = array();
$all_sale_id = array_column($order, 'sale_id');
$all_order_id = array_column($order, 'order_id');
$all_user_id = array_column($order, 'user_id');
// 获取所有客服
$sales = DB::table('user_info')->whereIn('userId', $all_sale_id)->lists('name', 'userId');
// 获取所有价格
$OrderPriceModel = new OrderPriceModel();
$order_price = $OrderPriceModel->whereIn('order_id', $all_order_id)->select('order_id', 'price_type', 'price')->get()->keyBy('order_id')->toArray();
// 获取用户公司名称
$UserCompanyModel = new UserCompanyModel();
$company_info = $UserCompanyModel->whereIn('user_id', $all_user_id)->lists('com_name', 'user_id')->toArray();
// 获取所有订单收货地址
$OrderAddressModel = new OrderAddressModel();
$order_address = $OrderAddressModel->where('address_type', 1)->whereIn('order_id', $all_order_id)->select('order_id', 'mobile', 'consignee', 'province','city','district', 'address')->get()->keyBy('order_id')->toArray();
// 获取所有订单物流信息
$OrderShippingModel = new OrderShippingModel();
$order_shipping = $OrderShippingModel->where('shipping_type', 1)->whereIn('order_id', $all_order_id)->select('order_id', 'status')->get()->keyBy('order_id')->toArray();
for ($i = 0; $i < count($order); $i++) { for ($i = 0; $i < count($order); $i++) {
// 推送人 $current_com_name = isset($company_info[$order[$i]['user_id']]) ? $company_info[$order[$i]['user_id']] : ''; // 当前公司
if ($order[$i]['sale_id']) { $current_order_addr = isset($order_address[$order[$i]['order_id']]) ? $order_address[$order[$i]['order_id']] : ''; // 当前订单收货地址
$sales = DB::table('user_info')->where(['userId' => $order[$i]['sale_id']])->select('name')->first(); $current_order_shipping = isset($order_shipping[$order[$i]['order_id']]) ? $order_shipping[$order[$i]['order_id']] : ''; // 当前订单物流
}
$tmp[$i]['order_id'] = $order[$i]['order_id']; $tmp[$i]['order_id'] = $order[$i]['order_id'];
$tmp[$i]['order_sn'] = "\t".$order[$i]['order_sn']."\t"; $tmp[$i]['order_sn'] = "\t".$order[$i]['order_sn']."\t";
...@@ -337,11 +361,11 @@ class OrderModel extends Model ...@@ -337,11 +361,11 @@ class OrderModel extends Model
$tmp[$i]['user_account'] = $order[$i]['mobile'] ? $order[$i]['mobile'] : $order[$i]['email']; $tmp[$i]['user_account'] = $order[$i]['mobile'] ? $order[$i]['mobile'] : $order[$i]['email'];
// $tmp[$i]['is_new'] = $order[$i]['is_new'] == 1 ? '是' : '否'; // 是否为新用户 // $tmp[$i]['is_new'] = $order[$i]['is_new'] == 1 ? '是' : '否'; // 是否为新用户
$tmp[$i]['consignee'] = isset($order[$i]['consignee']) ? $order[$i]['consignee'] : ''; $tmp[$i]['consignee'] = isset($current_order_addr['consignee']) ? $current_order_addr['consignee'] : '';
$tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']); $tmp[$i]['create_time_date'] = date('Y-m-d', $order[$i]['create_time']);
$tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]['create_time']); $tmp[$i]['create_time_sec'] = date('H:i:s', $order[$i]['create_time']);
$tmp[$i]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $order[$i]['com_name']; $tmp[$i]['com_name'] = !empty($order[$i]['tax_title']) ? $order[$i]['tax_title'] : $current_com_name;
$tmp[$i]['items_source'] = $this->getOrderSource($order[$i]['order_id'], $order[$i]['order_type']); $tmp[$i]['items_source'] = $this->getOrderSource($order[$i]['order_id'], $order[$i]['order_type'], $order[$i]['extend_order_type'], $order[$i]['order_source']);
$tmp[$i]['goods_id'] = $order[$i]['goods_id']; $tmp[$i]['goods_id'] = $order[$i]['goods_id'];
...@@ -355,7 +379,7 @@ class OrderModel extends Model ...@@ -355,7 +379,7 @@ class OrderModel extends Model
$tmp[$i]['single_pre_price'] = $order[$i]['single_pre_price']; $tmp[$i]['single_pre_price'] = $order[$i]['single_pre_price'];
$tmp[$i]['goods_amount'] = $order[$i]['goods_number'] * $order[$i]['goods_price']; $tmp[$i]['goods_amount'] = $order[$i]['goods_number'] * $order[$i]['goods_price'];
$tmp[$i]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD'; $tmp[$i]['currency'] = $order[$i]['currency'] == 1 ? 'RMB' : 'USD';
$tmp[$i]['sale_name'] = isset($sales) ? $sales->name : ''; // 推送业务员 $tmp[$i]['sale_name'] = isset($sales[$order[$i]['sale_id']]) ? $sales[$order[$i]['sale_id']] : ''; // 推送业务员
if ($i > 0 && $order[$i]['order_id'] == $order[$i-1]['order_id']) { if ($i > 0 && $order[$i]['order_id'] == $order[$i-1]['order_id']) {
$tmp[$i]['goods_sum'] = ''; $tmp[$i]['goods_sum'] = '';
...@@ -368,10 +392,12 @@ class OrderModel extends Model ...@@ -368,10 +392,12 @@ class OrderModel extends Model
$tmp[$i]['rmb_amount'] = ''; // 人民币总额 $tmp[$i]['rmb_amount'] = ''; // 人民币总额
} }
} else { } else {
$tmp[$i]['goods_sum'] = $this->getOrderPrice($order[$i]['order_id'], 1); $price = isset($order_price[$order[$i]['order_id']]) ? $order_price[$order[$i]['order_id']] : false;
$tmp[$i]['shipping_fee'] = $this->getOrderPrice($order[$i]['order_id'], 3);
$tmp[$i]['extra_fee'] = $this->getOrderPrice($order[$i]['order_id'], 2); $tmp[$i]['goods_sum'] = $price && $price['price_type'] == 1 ? $price['price'] : 0;
$tmp[$i]['coupon'] = $this->getOrderPrice($order[$i]['order_id'], -4); $tmp[$i]['shipping_fee'] = $price && $price['price_type'] == 3 ? $price['price'] : 0;
$tmp[$i]['extra_fee'] = $price && $price['price_type'] == 2 ? $price['price'] : 0;
$tmp[$i]['coupon'] = $price && $price['price_type'] == -4 ? $price['price'] : 0;
$tmp[$i]['order_amount'] = $order[$i]['order_amount']; $tmp[$i]['order_amount'] = $order[$i]['order_amount'];
if ($order[$i]['order_goods_type'] == 1) { if ($order[$i]['order_goods_type'] == 1) {
...@@ -381,14 +407,19 @@ class OrderModel extends Model ...@@ -381,14 +407,19 @@ class OrderModel extends Model
$tmp[$i]['order_type'] = !empty($order[$i]['order_pay_type']) ? Config('params.order_pay_type')[$order[$i]['order_pay_type']] : '未知'; $tmp[$i]['order_type'] = !empty($order[$i]['order_pay_type']) ? Config('params.order_pay_type')[$order[$i]['order_pay_type']] : '未知';
$tmp[$i]['order_status'] = !empty($order[$i]['status']) ? Config('params.order_status')[$order[$i]['status']] : '未知'; $tmp[$i]['order_status'] = !empty($order[$i]['status']) ? Config('params.order_status')[$order[$i]['status']] : '未知';
$tmp[$i]['shipping_status'] = !empty($order[$i]['shipping_status']) ? $shipping_status[$order[$i]['shipping_status']] : '无发货信息'; // 发货状态 $tmp[$i]['shipping_status'] = isset($current_order_shipping['status']) ? $shipping_status[$current_order_shipping['status']] : '无发货信息'; // 发货状态
//查询发货地址的省市区 //查询发货地址的省市区
$province = self::get_address_name($order[$i]['province']); if ($current_order_addr) {
$city = self::get_address_name($order[$i]['city']); $province = $this->getProvince($current_order_addr['province']);
$district = self::get_address_name($order[$i]['district']); $city = $this->getCity($current_order_addr['province'], $current_order_addr['city']);
$district = $this->getDistrict($current_order_addr['city'], $current_order_addr['district']);
$tmp[$i]['address'] = $province.$city.$district.$current_order_addr['address'];
} else {
$tmp[$i]['address'] = '';
}
$tmp[$i]['address'] = $province.$city.$district.$order[$i]['address'];
$tmp[$i]['inv_type'] = $order[$i]['inv_type'] ? $inv_type[$order[$i]['inv_type']] : '未知'; // 发票类型 $tmp[$i]['inv_type'] = $order[$i]['inv_type'] ? $inv_type[$order[$i]['inv_type']] : '未知'; // 发票类型
$tmp[$i]['invoice_status'] = !empty($order[$i]['invoice_status']) ? $invoice_status[$order[$i]['invoice_status']] : '无发票信息'; // 发票状态 $tmp[$i]['invoice_status'] = !empty($order[$i]['invoice_status']) ? $invoice_status[$order[$i]['invoice_status']] : '无发票信息'; // 发票状态
$tmp[$i]['tax_title'] = $order[$i]['tax_title']; $tmp[$i]['tax_title'] = $order[$i]['tax_title'];
...@@ -416,15 +447,11 @@ class OrderModel extends Model ...@@ -416,15 +447,11 @@ class OrderModel extends Model
$tmp[$i]['business_type'] = $order[$i]['business_type'] ? Config('params.business_type')[$order[$i]['business_type']] : '正常订单'; $tmp[$i]['business_type'] = $order[$i]['business_type'] ? Config('params.business_type')[$order[$i]['business_type']] : '正常订单';
$tmp[$i]['self_supplier_type'] = $self_supplier_type[$order[$i]['self_supplier_type']]; // 自采标记 $tmp[$i]['self_supplier_type'] = $self_supplier_type[$order[$i]['self_supplier_type']]; // 自采标记
$tmp[$i]['sample_demand_desc'] = $order[$i]['sample_demand_desc']; // 样片项目需求描述 $tmp[$i]['sample_demand_desc'] = $order[$i]['sample_demand_desc']; // 样片项目需求描述
//收货地址的电话
$tmp[$i]['receiving_address'] = isset($current_order_addr['address_mobile']) ? $current_order_addr['address_mobile'] : '';
} else { } else {
$tmp[$i]['is_new_order'] = $order[$i]['is_new_order'] == 1 ? '是' : '否'; // 是否为新订单 $tmp[$i]['is_new_order'] = $order[$i]['is_new_order'] == 1 ? '是' : '否'; // 是否为新订单
} }
if($order[$i]['order_goods_type'] != 1){
//收货地址的电话
$tmp[$i]['receiving_address'] = $order[$i]['address_mobile'];
}
unset($sales); unset($sales);
} }
...@@ -432,6 +459,41 @@ class OrderModel extends Model ...@@ -432,6 +459,41 @@ class OrderModel extends Model
return $tmp; return $tmp;
} }
// 获取省
public function getProvince($region_id)
{
if (!$region_id) return '';
$province = S_str('oms:province');
$filter = array_filter($province, function($v) use ($region_id) {
return $v['region_id'] == $region_id;
});
$filter = array_merge($filter); // 重新索引
return $filter ? $filter[0]['region_name'] : '';
}
// 获取城市
public function getCity($parent_id, $region_id)
{
if (!$parent_id || !$region_id) return '';
$city = S_hash('oms:city:'.$parent_id, $region_id);
return $city ? $city['region_name'] : '';
}
// 获取区
public function getDistrict($parent_id, $region_id)
{
if (!$parent_id || !$region_id) return '';
$district = S_hash('oms:district:'.$parent_id, $region_id);
return $district ? $district['region_name'] : '';
}
public function get_address_name($id){ public function get_address_name($id){
$result = $this->from('lie_region')->where(['region_id' => $id])->select(array('region_name','parent_id','region_type'))->get()->toArray(); $result = $this->from('lie_region')->where(['region_id' => $id])->select(array('region_name','parent_id','region_type'))->get()->toArray();
...@@ -477,27 +539,16 @@ class OrderModel extends Model ...@@ -477,27 +539,16 @@ class OrderModel extends Model
} }
// 获取订单来源 // 获取订单来源
public function getOrderSource($order_id, $order_type=1) public function getOrderSource($order_id, $order_type=1, $extend_order_type=0, $order_source='')
{ {
if ($order_type == 1) { if ($order_type == 1) {
$order = DB::connection('order')->table('lie_order_extend')->where('order_id', $order_id)->select('order_type')->first(); if ($extend_order_type) return '后台';
if ($order) {
switch ($order->order_type) {
case 1:
case 2:
case 3:
return '后台';
}
}
$order_source = DB::connection('order')->table('lie_order')->where('order_id', $order_id)->select('order_source')->first();
if (preg_match('/pf=1/', $order_source->order_source)) { if (preg_match('/pf=1/', $order_source)) {
$source = 'PC端'; $source = 'PC端';
} else if (preg_match('/pf=2/', $order_source->order_source)) { } else if (preg_match('/pf=2/', $order_source)) {
$source = '移动端'; $source = '移动端';
} else if (preg_match('/pf=6/', $order_source->order_source)) { } else if (preg_match('/pf=6/', $order_source)) {
$source = '小程序'; $source = '小程序';
} else { } else {
$source = '未知'; $source = '未知';
......
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class OrderShippingModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_order_shipping';
protected $primaryKey = 'order_shipping_id';
public $timestamps = false;
}
\ No newline at end of file
<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class RegionModel extends Model
{
protected $connection = 'order';
protected $table = 'lie_region';
protected $primaryKey = 'region_id';
public $timestamps = false;
// 获取地址
public function getRegion($region_type=1)
{
$map['region_type'] = $region_type;
return $this->where($map)->select('region_id', 'parent_id', 'region_name')->get()->toArray();
}
}
\ 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