xiaoyu 2 роки тому
батько
коміт
6f99a83308
1 змінених файлів з 8 додано та 1 видалено
  1. 8 1
      vapi/control/retail.php

+ 8 - 1
vapi/control/retail.php

@@ -30,7 +30,7 @@ class retailControl extends vbaseControl
         $params = [
             'channel_code' => $channel_code, 'province' => $province, 'city' => $city, 'area' => $area,
             'address' => $address, 'applicant_name' => $applicant_name, 'contact_phone' => $contact_phone,
-            'create_time' => time()
+            'create_time' => time(), 'retail_sn' => $this->make_sn()
         ];
 
         $resp = Model('')->table('retail')->insert($params);
@@ -40,4 +40,11 @@ class retailControl extends vbaseControl
             return self::outerr(301, "录入信息失败.");
         }
     }
+
+    private function make_sn()
+    {
+        return 'CARD' . mt_rand(1000, 9999)
+            . sprintf('%010d', time())
+            . sprintf('%06d', (float)microtime() * 1000000);
+    }
 }