12345678910111213141516171819202122232425 |
- <?php
- namespace app\admin\model;
- use think\Model;
- class WechatPlan extends Model
- {
- // 自动写入时间戳字段
- protected $autoWriteTimestamp = 'int';
- // 定义时间戳字段名
- 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(['order_id' => $orderId])->find());
- return $orderId;
- }
- }
|