根据条件删除实例
@param array $whArr
@throws \wf\model\Exception
@return boolean
519498
public function deleteBy($whArr = [])
    {
        $this->mustBeDataModel();

        $where = \wf\db\QueryBuilder::whereArr($whArr ? $whArr : $this->pkvAsWhere());
        if(!trim($where)) {
            throw new \InvalidArgumentException('请传入删除记录的条件');
        }

        $exe = $this->getDb()->exec("DELETE FROM %t WHERE %x", [$this->table, $where]);

        if (false === $exe) {
            throw new Exception($this->getDb()->getLastErr());
        }

        return $exe;
    }
945308
public function insertModel(): bool
    {
        $this->getFromForm();
        if (!$this->insert()) {
            throw new Exception(\Yii::t('app', 'Ошибка при добавлении в БД'));
        }
        return true;
    }
1187522
protected function fieldSet(array $data)
    {
        if (!$this->tableSchema['field']) {
            throw new Exception('请在' . get_class($this) . '构造函数中调用父类的构造函数');
        }
        return \wf\db\QueryBuilder::buildSqlSet($data, $this->tableSchema['field'], $this->lockedFields);
    }
402028
public function invokeAction(array $params)
    {
        if (!$this->inited) {
            throw new \wf\app\web\Exception('请在'.get_called_class().'::__construct()调用parent::__construct()');
        }

        $action = $this->act . 'Action';

        if(!method_exists($this, $action)) {
            throw new \wf\app\web\NotFoundException;
        }

        // 执行方法
        //call_user_func_array(array($this, $action), $params);
        $method = new \ReflectionMethod($this, $action);
        if (!$method->isPublic()){
            // note：ReflectionException为“Fatal error”，不可捕获，不在这里抛出，也不直接在上一级异常中捕获而不用这个异常抛出
            // 否则不能在上一级异常处理中捕获，而直接到顶级异常处理中
            throw new \wf\app\web\NotFoundException;
        }

        $method->invokeArgs($this, $params); // 在这里加断点，下一步将进入当前请求的控制器业务逻辑中
    }
357302
public function isValid()
    {
        $value = $this->field->getValue();

        if (is_array($value) || is_object($value)) {
            throw new \Exception("This validator only works on scalar types!");
        }

        // required but not given
        if ($this->required && $value == null) {
            return false;
        } // if the field is not required and the value is empty, then it's also valid
        elseif (!$this->required && $value == "") {
            return true;
        }

        $match = preg_match($this->regex, $value);

        return $this->not ? !$match : $match;
    }
39912
public static function __($text,$arr = array(),$language='',$file=''){
		if(!$file){
			$file = 'companie';
		}
		if(!$language){
			$language = self::getCurrentLanguage();
		}
		Yii::$app->language = $language;
		$gText = Yii::t($file, $text);
		if(!empty($arr)){
			foreach($arr as $a){
				$gText = preg_replace('/%s/',$a,$gText,1);
			}
		}
		return $gText;
		
	}
500980
public function authRoleDelete()
    {
        $roleCount = AuthRoleUser::where(['role_id'=>$this->id])->count();
        if($roleCount > 0){
            return "已有{$roleCount}用户在是有此角色不可删除";
        }

        if($this->delete()){
            if($this->authAccess){
                AuthAccess::where(['role_id'=>$this->id,'type'=>'admin_url'])->delete();
            }
            return true;
        }
        return false;
    }
71362
public function getMessageRecord(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_MESSAGE_RECORD_GET_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errcode']) && !$result['errcode'] ? $result['recordlist'] : false;
    }
1042540
private static function _parseStringArray($value)
    {
        if (strlen($value)) {
            $vals = explode(',', $value);
            if ($vals === false)
                return false;
//            $vals = array_unique($vals); // 不需要去重, 不影响结果. 程序员不应该写出重复的字符串
        } else
            $vals = [''];
        if (count($vals) === 0)
            return false;
        return $vals;
    }
1024615
static public function isSysCompanyUser(){
         if(Yii::app()->user->isGuest){
             return FALSE;
         }
         $a = self::getRoles();
         return isset($a[self::RoleSysCompanyUser]);
     }
269161
static function stringContainsWord($str, array $arr)
    {
        foreach($arr as $a) {
            if (stripos($str,$a) !== false) return true;
        }
        return false;
    }
1178314
public function query($sql, array $args = [])
    {
        if ($args) {
            $sql = \wf\db\QueryBuilder::format($sql, $args);
        }
        $sql = \wf\db\QueryBuilder::tablePrefix($sql, $this->cfg['tablePrefix']);
                            
        // 记录数据库查询次数
        $this->execTimes ++;
        $this->log[] = $sql;
        
        $query = $this->dbh->query($sql);        
        if(false === $query) {
            $this->log[] = $this->getLastErr();
            throw new \wf\db\Exception($this->getLastErr());
        }
        
        return $query;
    }
711739
public function archive()
    {
        if (!is_string($this->pharName) || strlen($this->pharName) <= 0) {
            return false;
        }
        if (!is_string($this->directory) || strlen($this->directory) <= 0) {
            return false;
        }
        if (!is_string($this->outputDirectory) || strlen($this->outputDirectory) <= 0) {
            return false;
        }

        $file = $this->getPharFileName();

        $phar = new Phar(
            $this->outputDirectory . '/' . $file,
            FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME,
            $file
        );

        // 开始打包
        $phar->startBuffering();

        // 将后缀名相关的文件打包
        if (is_array($this->extensions)) {
            foreach ($this->extensions as $ext) {
                $phar->buildFromDirectory($this->directory, '/\.' . $ext . '$/');
            }
        }

        // 把builder本身摘除
        if (is_array($this->excludeEntries)) {
            foreach ($this->excludeEntries as $entry) {
                //such as $phar->delete('build.php');
                $phar->delete($entry);
            }
        }

        // 设置入口
        if ($this->bootstrapStub !== null) $phar->setStub($this->bootstrapStub);

        $phar->stopBuffering();

        // 打包完成
        return true;
    }
789614
public function queryRefund(array $args = array()) {
        $args = $this->getQueryRefund()->parameters($this->merge($args))->text();
        if ($args['return_code'] != 'SUCCESS') {
            throw new Exception($args['return_msg']);
        }
        if (!$this->verify($args)) {
            throw new Exception('数据验签失败！');
        }
        return $args;
    }
654364
public function onWorkerStart()
    {
        if (empty($this->serverRoot))
        {
            throw new Exception('server root not set, please use WebServer::addRoot($domain, $root_path) to set server root path');
        }

        // 初始化HttpCache
        HttpCache::init();
        session_name(self::$sessionName);
        HttpCache::$sessionName = self::$sessionName;

        // 尝试执行开发者设定的onWorkerStart回调
        if ($this->_onWorkerStart)
        {
            call_user_func($this->_onWorkerStart, $this);
        }
    }
117309
public function verify()
    {
        $data = $_GET;
        $sign = $data['md5'];

        if (Helper::verify($data, $sign) === false) {
            throw new \Exception('盈华讯方异步通知验签失败');
        }
        return $data;
    }
961954
public function consumeCode(array $data)
    {
        $result = $this->wechat->httpRaw(self::WECHAT_QR_CODE_CREATE_PREFIX, $data, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] === 'ok' ? $result['ticket'] : false;
    }