Exemplo n.º 1
0
 /**
  * 获取返现队列里面的唯一typeid
  *
  * @param int $cashBackType
  * @param int $date
  * @return int
  */
 public static function getCashBackTypeId($cashBackType, $date)
 {
     static $tmpCashBackTypeId;
     if (isset($tmpCashBackTypeId[$cashBackType . '_' . $date])) {
         return $tmpCashBackTypeId[$cashBackType . '_' . $date];
     }
     //查询类型是否创建
     $cashBackTypeInfo = Model_Broker_AjkPpccoinType::getType($cashBackType, $date);
     if (!empty($cashBackTypeInfo)) {
         $tmpCashBackTypeId[$cashBackType . '_' . $date] = $cashBackTypeInfo['id'];
         return $cashBackTypeInfo['id'];
     }
     //不存在添加
     $data = array('acttype' => $cashBackType, 'detail' => self::$detail[$cashBackType], 'addtime' => time(), 'typedate' => $date);
     $CashBackTypeId = Model_Broker_AjkPpccoinType::addType($data);
     //写入成功,加到cache里面
     if (!empty($CashBackTypeId)) {
         $tmpCashBackTypeId[$cashBackType . '_' . $date] = $CashBackTypeId;
     }
     return $CashBackTypeId;
 }