Commit 37f59c2b by 杨树贤

询价单号

parent ec3b831c
......@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use App\Http\Services\InquiryService;
use Illuminate\Http\Request;
class AuthController extends Controller
......@@ -9,7 +10,6 @@ class AuthController extends Controller
public function forget()
{
return view('auth.forget');
}
public function change()
......
......@@ -4,6 +4,7 @@ namespace App\Http\Services;
use App\Models\InquiryModel;
use App\Models\InquiryItemsModel;
use Carbon\Carbon;
use Illuminate\Support\Facades\DB;
class InquiryService
......@@ -15,6 +16,7 @@ class InquiryService
$items = json_decode($items, true);
$remark = $data['remark'];
$inquiry = [
'inquiry_sn' => self::generateSn(),
'user_id' => $user->id,
'user_types' => $user->account_properties,
'remark' => $remark,
......@@ -80,4 +82,12 @@ class InquiryService
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