WechatPlanRecord.php 779 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\admin\model;
  3. use think\Model;
  4. class WechatPlanRecord extends Model
  5. {
  6. // 自动写入时间戳字段
  7. protected $autoWriteTimestamp = 'int';
  8. // 定义时间戳字段名
  9. protected $createTime = 'createtime';
  10. protected $updateTime = 'updatetime';
  11. public function getIsOpenList()
  12. {
  13. return ['0' => __('Is_open 0'), '1' => __('Is_open 1')];
  14. }
  15. public static function getNewCode()
  16. {
  17. do {
  18. list($msec, $sec) = explode(' ', microtime());
  19. $msectime = number_format((floatval($msec) + floatval($sec)) * 1000, 0, '', '');
  20. $orderId = 'qy' . $msectime . mt_rand(10000, 99999);
  21. } while (self::where(['contract_code' => $orderId])->find());
  22. return $orderId;
  23. }
  24. }