WIN-2308041133\Administrator 6 months ago
parent
commit
deedbf224c

+ 0 - 9
application/admin/model/WechatPlan.php

@@ -13,15 +13,6 @@ class WechatPlan extends Model
     protected $createTime = 'createtime';
     protected $updateTime = 'updatetime';
 
-    public static function getNewCode()
-    {
-        do {
-            list($msec, $sec) = explode(' ', microtime());
-            $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
-            $orderId = 'qy' . $msectime . mt_rand(10000, 99999);
-        } while (self::where(['contract_code' => $orderId])->find());
-        return $orderId;
-    }
     public static function lst($where)
     {
         $model = new self;

+ 9 - 0
application/admin/model/WechatPlanRecord.php

@@ -16,4 +16,13 @@ class WechatPlanRecord extends Model
     {
         return ['0' => __('Is_open 0'), '1' => __('Is_open 1')];
     }
+    public static function getNewCode()
+    {
+        do {
+            list($msec, $sec) = explode(' ', microtime());
+            $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
+            $orderId = 'qy' . $msectime . mt_rand(10000, 99999);
+        } while (self::where(['contract_code' => $orderId])->find());
+        return $orderId;
+    }
 }

+ 1 - 1
application/api/controller/Lave.php

@@ -171,7 +171,7 @@ class Lave extends Api
         $where1 = $where;
         unset($where1['from']);
         $where1['order_id'] = LaveModel::getNewOrderId();
-        $where1['contract_code'] = WechatPlan::getNewCode();
+        $where1['contract_code'] = WechatPlanRecord::getNewCode();
         $contract_display_account = User::where('id', $where1['user_id'])->value('nickname');
         if (empty($contract_display_account)){
             $this->error('用户不存在!');