Exemplo n.º 1
0
 /**
  * @author song
  * 产生代金卷号码,查询数据库是否存在,如果数据库中不存在则返回数据,如果存在再次产生
  * 前两位数字代表 代金券类型(01-代金券,02-现金券),
  * 跟随后面两位数字代表 品种应用范围(01-应用全场,02-满200可用一张),
  * 跟随后面六位代表年月(201503),后面六位随机产生(856941),
  *
  * @return int(16) tmpCoupnno
  *
  */
 public function genCouponNumber()
 {
     $volume_model = new Volume();
     do {
         $tmpCouponNumber = '0100' . date('Ym', time()) . mt_rand(100000, 999999);
     } while ($volume_model->getByCouponNumber($tmpCouponNumber));
     return $tmpCouponNumber;
 }