Commit 37f59c2b by 杨树贤

询价单号

parent ec3b831c
...@@ -2,14 +2,14 @@ ...@@ -2,14 +2,14 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Http\Services\InquiryService;
use Illuminate\Http\Request; use Illuminate\Http\Request;
class AuthController extends Controller class AuthController extends Controller
{ {
public function forget() public function forget()
{ {
return view('auth.forget'); return view('auth.forget');
} }
public function change() public function change()
...@@ -24,5 +24,5 @@ class AuthController extends Controller ...@@ -24,5 +24,5 @@ class AuthController extends Controller
{ {
return view('auth.register'); return view('auth.register');
} }
} }
...@@ -4,6 +4,7 @@ namespace App\Http\Services; ...@@ -4,6 +4,7 @@ namespace App\Http\Services;
use App\Models\InquiryModel; use App\Models\InquiryModel;
use App\Models\InquiryItemsModel; use App\Models\InquiryItemsModel;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\DB;
class InquiryService class InquiryService
...@@ -15,6 +16,7 @@ class InquiryService ...@@ -15,6 +16,7 @@ class InquiryService
$items = json_decode($items, true); $items = json_decode($items, true);
$remark = $data['remark']; $remark = $data['remark'];
$inquiry = [ $inquiry = [
'inquiry_sn' => self::generateSn(),
'user_id' => $user->id, 'user_id' => $user->id,
'user_types' => $user->account_properties, 'user_types' => $user->account_properties,
'remark' => $remark, 'remark' => $remark,
...@@ -80,4 +82,12 @@ class InquiryService ...@@ -80,4 +82,12 @@ class InquiryService
return $result; return $result;
} }
public static function generateSn()
{
$maxInquiryId = InquiryModel::orderBy('inquiry_id', 'desc')->value('inquiry_id');
$id = str_pad(($maxInquiryId + 1), 6, 0, STR_PAD_LEFT);
$time = Carbon::now()->addMonths(-9)->addDays(-10)->timestamp;
return 'XJ' . date('Ymd',$time) . $id;
}
} }
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