BGroupServer.php 781 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: Administrator
  5. * Date: 2019/11/11 0011
  6. * Time: 17:01
  7. */
  8. class BGroupServer extends BusinessActiveRecord
  9. {
  10. public static function model($className = __CLASS__){
  11. return parent::model($className);
  12. }
  13. public function tableName(){
  14. return "group_server";
  15. }
  16. public function getDomainUrl($group_id)
  17. {
  18. $table_name = 'group_server';
  19. if (YII_ENV == 'testing'||YII_ENV == 'development'||YII_ENV=='local'){
  20. $table_name = $table_name.'_'.YII_ENV;
  21. }
  22. $sql = 'SELECT static_url FROM '.$table_name.' WHERE group_id='.$group_id;
  23. $static_url = $this->getDbConnection()->createCommand($sql)->queryScalar();
  24. return $static_url ? $static_url : '';
  25. }
  26. }